mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +08:00
Adding keyboard sortcuts for cut/copy/paste.
This commit is contained in:
parent
ccc5aa04b2
commit
06cc810b80
@ -88,6 +88,21 @@ var IPython = (function (IPython) {
|
||||
} else if (event.which === 77 && event.ctrlKey) {
|
||||
that.control_key_active = true;
|
||||
return false;
|
||||
} else if (event.which === 88 && that.control_key_active) {
|
||||
// Cut selected cell = x
|
||||
that.cut_cell();
|
||||
that.control_key_active = false;
|
||||
return false;
|
||||
} else if (event.which === 67 && that.control_key_active) {
|
||||
// Copy selected cell = c
|
||||
that.copy_cell();
|
||||
that.control_key_active = false;
|
||||
return false;
|
||||
} else if (event.which === 86 && that.control_key_active) {
|
||||
// Paste selected cell = v
|
||||
that.paste_cell();
|
||||
that.control_key_active = false;
|
||||
return false;
|
||||
} else if (event.which === 68 && that.control_key_active) {
|
||||
// Delete selected cell = d
|
||||
that.delete_cell();
|
||||
@ -103,8 +118,8 @@ var IPython = (function (IPython) {
|
||||
that.insert_code_cell_below();
|
||||
that.control_key_active = false;
|
||||
return false;
|
||||
} else if (event.which === 67 && that.control_key_active) {
|
||||
// To code = c
|
||||
} else if (event.which === 89 && that.control_key_active) {
|
||||
// To code = y
|
||||
that.to_code();
|
||||
that.control_key_active = false;
|
||||
return false;
|
||||
|
@ -28,6 +28,9 @@ var IPython = (function (IPython) {
|
||||
var shortcuts = [
|
||||
{key: 'Shift-Enter', help: 'run cell'},
|
||||
{key: 'Ctrl-Enter', help: 'run cell in-place'},
|
||||
{key: 'Ctrl-m x', help: 'cut cell'},
|
||||
{key: 'Ctrl-m c', help: 'copy cell'},
|
||||
{key: 'Ctrl-m v', help: 'paste cell'},
|
||||
{key: 'Ctrl-m d', help: 'delete cell'},
|
||||
{key: 'Ctrl-m a', help: 'insert cell above'},
|
||||
{key: 'Ctrl-m b', help: 'insert cell below'},
|
||||
@ -36,7 +39,7 @@ var IPython = (function (IPython) {
|
||||
{key: 'Ctrl-m s', help: 'save notebook'},
|
||||
{key: 'Ctrl-m j', help: 'move cell down'},
|
||||
{key: 'Ctrl-m k', help: 'move cell up'},
|
||||
{key: 'Ctrl-m c', help: 'code cell'},
|
||||
{key: 'Ctrl-m y', help: 'code cell'},
|
||||
{key: 'Ctrl-m m', help: 'markdown cell'},
|
||||
{key: 'Ctrl-m p', help: 'select previous'},
|
||||
{key: 'Ctrl-m n', help: 'select next'},
|
||||
|
@ -91,8 +91,8 @@
|
||||
<li id="paste_cell_below" class="ui-state-disabled"><a href="#">Paste Below</a></li>
|
||||
<li id="delete_cell"><a href="#">Delete</a></li>
|
||||
<hr/>
|
||||
<li id="move_cell_up"><a href="#">Move Cell Up</a></li>
|
||||
<li id="move_cell_down"><a href="#">Move Cell Down</a></li>
|
||||
<li id="move_cell_up"><a href="#">Move Up</a></li>
|
||||
<li id="move_cell_down"><a href="#">Move Down</a></li>
|
||||
<hr/>
|
||||
<li id="select_previous"><a href="#">Select Previous</a></li>
|
||||
<li id="select_next"><a href="#">Select Next</a></li>
|
||||
|
Loading…
Reference in New Issue
Block a user