mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-05 12:19:58 +08:00
Merge pull request #2572 from dwf/paste_above_as_default
Make 'Paste Below' the default paste behavior in notebook.
This commit is contained in:
commit
01a54bee69
@ -51,10 +51,10 @@ var IPython = (function (IPython) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id : 'paste_b',
|
id : 'paste_b',
|
||||||
label : 'Paste Cell',
|
label : 'Paste Cell Below',
|
||||||
icon : 'ui-icon-clipboard',
|
icon : 'ui-icon-clipboard',
|
||||||
callback : function () {
|
callback : function () {
|
||||||
IPython.notebook.paste_cell();
|
IPython.notebook.paste_cell_below();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],'cut_copy_paste');
|
],'cut_copy_paste');
|
||||||
|
@ -142,8 +142,8 @@ var IPython = (function (IPython) {
|
|||||||
that.control_key_active = false;
|
that.control_key_active = false;
|
||||||
return false;
|
return false;
|
||||||
} else if (event.which === 86 && that.control_key_active) {
|
} else if (event.which === 86 && that.control_key_active) {
|
||||||
// Paste selected cell = v
|
// Paste below selected cell = v
|
||||||
that.paste_cell();
|
that.paste_cell_below();
|
||||||
that.control_key_active = false;
|
that.control_key_active = false;
|
||||||
return false;
|
return false;
|
||||||
} else if (event.which === 68 && that.control_key_active) {
|
} else if (event.which === 68 && that.control_key_active) {
|
||||||
@ -778,8 +778,8 @@ var IPython = (function (IPython) {
|
|||||||
Notebook.prototype.enable_paste = function () {
|
Notebook.prototype.enable_paste = function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
if (!this.paste_enabled) {
|
if (!this.paste_enabled) {
|
||||||
$('#paste_cell').removeClass('ui-state-disabled')
|
$('#paste_cell_replace').removeClass('ui-state-disabled')
|
||||||
.on('click', function () {that.paste_cell();});
|
.on('click', function () {that.paste_cell_replace();});
|
||||||
$('#paste_cell_above').removeClass('ui-state-disabled')
|
$('#paste_cell_above').removeClass('ui-state-disabled')
|
||||||
.on('click', function () {that.paste_cell_above();});
|
.on('click', function () {that.paste_cell_above();});
|
||||||
$('#paste_cell_below').removeClass('ui-state-disabled')
|
$('#paste_cell_below').removeClass('ui-state-disabled')
|
||||||
@ -791,7 +791,7 @@ var IPython = (function (IPython) {
|
|||||||
|
|
||||||
Notebook.prototype.disable_paste = function () {
|
Notebook.prototype.disable_paste = function () {
|
||||||
if (this.paste_enabled) {
|
if (this.paste_enabled) {
|
||||||
$('#paste_cell').addClass('ui-state-disabled').off('click');
|
$('#paste_cell_replace').addClass('ui-state-disabled').off('click');
|
||||||
$('#paste_cell_above').addClass('ui-state-disabled').off('click');
|
$('#paste_cell_above').addClass('ui-state-disabled').off('click');
|
||||||
$('#paste_cell_below').addClass('ui-state-disabled').off('click');
|
$('#paste_cell_below').addClass('ui-state-disabled').off('click');
|
||||||
this.paste_enabled = false;
|
this.paste_enabled = false;
|
||||||
@ -811,7 +811,7 @@ var IPython = (function (IPython) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Notebook.prototype.paste_cell = function () {
|
Notebook.prototype.paste_cell_replace = function () {
|
||||||
if (this.clipboard !== null && this.paste_enabled) {
|
if (this.clipboard !== null && this.paste_enabled) {
|
||||||
var cell_data = this.clipboard;
|
var cell_data = this.clipboard;
|
||||||
var new_cell = this.insert_cell_above(cell_data.cell_type);
|
var new_cell = this.insert_cell_above(cell_data.cell_type);
|
||||||
|
@ -75,9 +75,9 @@ data-notebook-id={{notebook_id}}
|
|||||||
<ul>
|
<ul>
|
||||||
<li id="cut_cell"><a href="#">Cut Cell</a></li>
|
<li id="cut_cell"><a href="#">Cut Cell</a></li>
|
||||||
<li id="copy_cell"><a href="#">Copy Cell</a></li>
|
<li id="copy_cell"><a href="#">Copy Cell</a></li>
|
||||||
<li id="paste_cell" class="ui-state-disabled"><a href="#">Paste Cell</a></li>
|
|
||||||
<li id="paste_cell_above" class="ui-state-disabled"><a href="#">Paste Cell Above</a></li>
|
<li id="paste_cell_above" class="ui-state-disabled"><a href="#">Paste Cell Above</a></li>
|
||||||
<li id="paste_cell_below" class="ui-state-disabled"><a href="#">Paste Cell Below</a></li>
|
<li id="paste_cell_below" class="ui-state-disabled"><a href="#">Paste Cell Below</a></li>
|
||||||
|
<li id="paste_cell_replace" class="ui-state-disabled"><a href="#">Paste Cell & Replace</a></li>
|
||||||
<li id="delete_cell"><a href="#">Delete</a></li>
|
<li id="delete_cell"><a href="#">Delete</a></li>
|
||||||
<hr/>
|
<hr/>
|
||||||
<li id="split_cell"><a href="#">Split Cell</a></li>
|
<li id="split_cell"><a href="#">Split Cell</a></li>
|
||||||
|
Loading…
Reference in New Issue
Block a user