mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-15 04:00:34 +08:00
Renaming commands
This commit is contained in:
parent
5deceb4a8b
commit
7df94eb001
@ -114,7 +114,7 @@
|
||||
"source": [
|
||||
"%%javascript\n",
|
||||
"\n",
|
||||
"Jupyter.keyboard_manager.command_shortcuts.add_shortcut('r', 'ipython.change-selected-cell-to-raw-cell');"
|
||||
"Jupyter.keyboard_manager.command_shortcuts.add_shortcut('r', 'ipython.change-cell-to-raw');"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -66,6 +66,6 @@ back to it's initial behavior:
|
||||
|
||||
%%javascript
|
||||
|
||||
Jupyter.keyboard_manager.command_shortcuts.add_shortcut('r', 'ipython.change-selected-cell-to-raw-cell');
|
||||
Jupyter.keyboard_manager.command_shortcuts.add_shortcut('r', 'ipython.change-cell-to-raw');
|
||||
|
||||
`View the original notebook on nbviewer <http://nbviewer.jupyter.org/github/jupyter/notebook/blob/master/docs/source/examples/Notebook/Custom%20Keyboard%20Shortcuts.ipynb>`__
|
||||
|
@ -40,22 +40,52 @@ define(function(require){
|
||||
*
|
||||
**/
|
||||
var _actions = {
|
||||
'toggle-toolbar':{
|
||||
help: 'hide/show the toolbar',
|
||||
handler : function(env){
|
||||
$('div#maintoolbar').toggle();
|
||||
events.trigger('resize-header.Page');
|
||||
'restart-kernel': {
|
||||
help: 'restart the kernel (no confirmation dialog)',
|
||||
handler: function (env) {
|
||||
env.notebook.restart_kernel({confirm: false});
|
||||
},
|
||||
},
|
||||
'confirm-restart-kernel':{
|
||||
icon: 'fa-repeat',
|
||||
help_index : 'hb',
|
||||
help: 'restart the kernel (with dialog)',
|
||||
handler : function (env) {
|
||||
env.notebook.restart_kernel();
|
||||
}
|
||||
},
|
||||
'toggle-header':{
|
||||
help: 'hide/show the header',
|
||||
handler : function(env){
|
||||
$('#header-container').toggle();
|
||||
$('.header-bar').toggle();
|
||||
events.trigger('resize-header.Page');
|
||||
'restart-kernel-and-run-all-cells': {
|
||||
help: 'restart the kernel, then re-run the whole notebook (no confirmation dialog)',
|
||||
handler: function (env) {
|
||||
env.notebook.restart_run_all({confirm: false});
|
||||
}
|
||||
},
|
||||
'run-select-next': {
|
||||
'confirm-restart-kernel-and-run-all-cells': {
|
||||
help: 'restart the kernel, then re-run the whole notebook (with dialog)',
|
||||
handler: function (env) {
|
||||
env.notebook.restart_run_all();
|
||||
}
|
||||
},
|
||||
'restart-kernel-and-clear-output': {
|
||||
help: 'restart the kernel and clear all output (no confirmation dialog)',
|
||||
handler: function (env) {
|
||||
env.notebook.restart_clear_output({confirm: false});
|
||||
}
|
||||
},
|
||||
'confirm-restart-kernel-and-clear-output': {
|
||||
help: 'restart the kernel and clear all output (with dialog)',
|
||||
handler: function (env) {
|
||||
env.notebook.restart_clear_output();
|
||||
}
|
||||
},
|
||||
'interrupt-kernel':{
|
||||
icon: 'fa-stop',
|
||||
help_index : 'ha',
|
||||
handler : function (env) {
|
||||
env.notebook.kernel.interrupt();
|
||||
}
|
||||
},
|
||||
'run-cell-and-select-next': {
|
||||
icon: 'fa-step-forward',
|
||||
help : 'run cell, select below',
|
||||
help_index : 'ba',
|
||||
@ -63,14 +93,14 @@ define(function(require){
|
||||
env.notebook.execute_cell_and_select_below();
|
||||
}
|
||||
},
|
||||
'execute-in-place':{
|
||||
'run-cell':{
|
||||
help : 'run cell',
|
||||
help_index : 'bb',
|
||||
handler : function (env) {
|
||||
env.notebook.execute_cell();
|
||||
}
|
||||
},
|
||||
'execute-and-insert-after':{
|
||||
'run-cell-and-insert-below':{
|
||||
help : 'run cell, insert below',
|
||||
help_index : 'bc',
|
||||
handler : function (env) {
|
||||
@ -84,43 +114,6 @@ define(function(require){
|
||||
env.notebook.execute_all_cells();
|
||||
}
|
||||
},
|
||||
'restart-run-all-dialog': {
|
||||
help: 'restart the kernel, then re-run the whole notebook (with dialog)',
|
||||
handler: function (env) {
|
||||
env.notebook.restart_run_all();
|
||||
}
|
||||
},
|
||||
'restart-clear-output-dialog': {
|
||||
help: 'restart the kernel and clear all output (with dialog)',
|
||||
handler: function (env) {
|
||||
env.notebook.restart_clear_output();
|
||||
}
|
||||
},
|
||||
'restart-dialog': {
|
||||
help: 'restart the kernel (with dialog)',
|
||||
help_index: 'bf',
|
||||
handler: function (env) {
|
||||
env.notebook.restart_kernel();
|
||||
},
|
||||
},
|
||||
'restart-run-all': {
|
||||
help: 'restart the kernel, then re-run the whole notebook (no confirmation dialog)',
|
||||
handler: function (env) {
|
||||
env.notebook.restart_run_all({confirm: false});
|
||||
}
|
||||
},
|
||||
'restart-clear-output': {
|
||||
help: 'restart the kernel and clear all output (no confirmation dialog)',
|
||||
handler: function (env) {
|
||||
env.notebook.restart_clear_output({confirm: false});
|
||||
}
|
||||
},
|
||||
'restart': {
|
||||
help: 'restart the kernel (no confirmation dialog)',
|
||||
handler: function (env) {
|
||||
env.notebook.restart_kernel({confirm: false});
|
||||
},
|
||||
},
|
||||
'run-all-cells-above':{
|
||||
handler : function (env) {
|
||||
env.notebook.execute_cells_above();
|
||||
@ -131,7 +124,7 @@ define(function(require){
|
||||
env.notebook.execute_cells_below();
|
||||
}
|
||||
},
|
||||
'go-to-command-mode': {
|
||||
'enter-command-mode': {
|
||||
help : 'command mode',
|
||||
help_index : 'aa',
|
||||
handler : function (env) {
|
||||
@ -187,7 +180,7 @@ define(function(require){
|
||||
env.notebook.extend_marked(1);
|
||||
}
|
||||
},
|
||||
'cut-selected-cell' : {
|
||||
'cut-cell' : {
|
||||
icon: 'fa-cut',
|
||||
help_index : 'ee',
|
||||
handler : function (env) {
|
||||
@ -196,21 +189,21 @@ define(function(require){
|
||||
env.notebook.select(index);
|
||||
}
|
||||
},
|
||||
'copy-selected-cell' : {
|
||||
'copy-cell' : {
|
||||
icon: 'fa-copy',
|
||||
help_index : 'ef',
|
||||
handler : function (env) {
|
||||
env.notebook.copy_cell();
|
||||
}
|
||||
},
|
||||
'paste-cell-before' : {
|
||||
'paste-cell-above' : {
|
||||
help: 'paste cell above',
|
||||
help_index : 'eg',
|
||||
handler : function (env) {
|
||||
env.notebook.paste_cell_above();
|
||||
}
|
||||
},
|
||||
'paste-cell-after' : {
|
||||
'paste-cell-below' : {
|
||||
help: 'paste cell below',
|
||||
icon: 'fa-paste',
|
||||
help_index : 'eh',
|
||||
@ -218,7 +211,7 @@ define(function(require){
|
||||
env.notebook.paste_cell_below();
|
||||
}
|
||||
},
|
||||
'insert-cell-before' : {
|
||||
'insert-cell-above' : {
|
||||
help: 'insert cell above',
|
||||
help_index : 'ec',
|
||||
handler : function (env) {
|
||||
@ -227,7 +220,7 @@ define(function(require){
|
||||
env.notebook.focus_cell();
|
||||
}
|
||||
},
|
||||
'insert-cell-after' : {
|
||||
'insert-cell-below' : {
|
||||
help: 'insert cell below',
|
||||
icon : 'fa-plus',
|
||||
help_index : 'ed',
|
||||
@ -237,110 +230,110 @@ define(function(require){
|
||||
env.notebook.focus_cell();
|
||||
}
|
||||
},
|
||||
'change-selected-cell-to-code-cell' : {
|
||||
'change-cell-to-code' : {
|
||||
help : 'to code',
|
||||
help_index : 'ca',
|
||||
handler : function (env) {
|
||||
env.notebook.to_code();
|
||||
}
|
||||
},
|
||||
'change-selected-cell-to-markdown-cell' : {
|
||||
'change-cell-to-markdown' : {
|
||||
help : 'to markdown',
|
||||
help_index : 'cb',
|
||||
handler : function (env) {
|
||||
env.notebook.to_markdown();
|
||||
}
|
||||
},
|
||||
'change-selected-cell-to-raw-cell' : {
|
||||
'change-cell-to-raw' : {
|
||||
help : 'to raw',
|
||||
help_index : 'cc',
|
||||
handler : function (env) {
|
||||
env.notebook.to_raw();
|
||||
}
|
||||
},
|
||||
'change-selected-cell-to-heading-1' : {
|
||||
'change-cell-to-heading-1' : {
|
||||
help : 'to heading 1',
|
||||
help_index : 'cd',
|
||||
handler : function (env) {
|
||||
env.notebook.to_heading(undefined, 1);
|
||||
}
|
||||
},
|
||||
'change-selected-cell-to-heading-2' : {
|
||||
'change-cell-to-heading-2' : {
|
||||
help : 'to heading 2',
|
||||
help_index : 'ce',
|
||||
handler : function (env) {
|
||||
env.notebook.to_heading(undefined, 2);
|
||||
}
|
||||
},
|
||||
'change-selected-cell-to-heading-3' : {
|
||||
'change-cell-to-heading-3' : {
|
||||
help : 'to heading 3',
|
||||
help_index : 'cf',
|
||||
handler : function (env) {
|
||||
env.notebook.to_heading(undefined, 3);
|
||||
}
|
||||
},
|
||||
'change-selected-cell-to-heading-4' : {
|
||||
'change-cell-to-heading-4' : {
|
||||
help : 'to heading 4',
|
||||
help_index : 'cg',
|
||||
handler : function (env) {
|
||||
env.notebook.to_heading(undefined, 4);
|
||||
}
|
||||
},
|
||||
'change-selected-cell-to-heading-5' : {
|
||||
'change-cell-to-heading-5' : {
|
||||
help : 'to heading 5',
|
||||
help_index : 'ch',
|
||||
handler : function (env) {
|
||||
env.notebook.to_heading(undefined, 5);
|
||||
}
|
||||
},
|
||||
'change-selected-cell-to-heading-6' : {
|
||||
'change-cell-to-heading-6' : {
|
||||
help : 'to heading 6',
|
||||
help_index : 'ci',
|
||||
handler : function (env) {
|
||||
env.notebook.to_heading(undefined, 6);
|
||||
}
|
||||
},
|
||||
'toggle-output-visibility-selected-cell' : {
|
||||
'toggle-cell-output-visibility' : {
|
||||
help : 'toggle output',
|
||||
help_index : 'gb',
|
||||
handler : function (env) {
|
||||
env.notebook.toggle_output();
|
||||
}
|
||||
},
|
||||
'toggle-output-scrolling-selected-cell' : {
|
||||
'toggle-cell-output-scrolling' : {
|
||||
help : 'toggle output scrolling',
|
||||
help_index : 'gc',
|
||||
handler : function (env) {
|
||||
env.notebook.toggle_output_scroll();
|
||||
}
|
||||
},
|
||||
'clear-output-selected-cell' : {
|
||||
'clear-cell-output' : {
|
||||
handler : function (env) {
|
||||
env.notebook.clear_output();
|
||||
}
|
||||
},
|
||||
'move-selected-cell-down' : {
|
||||
'move-cell-down' : {
|
||||
icon: 'fa-arrow-down',
|
||||
help_index : 'eb',
|
||||
handler : function (env) {
|
||||
env.notebook.move_cell_down();
|
||||
}
|
||||
},
|
||||
'move-selected-cell-up' : {
|
||||
'move-cell-up' : {
|
||||
icon: 'fa-arrow-up',
|
||||
help_index : 'ea',
|
||||
handler : function (env) {
|
||||
env.notebook.move_cell_up();
|
||||
}
|
||||
},
|
||||
'toggle-line-number-selected-cell' : {
|
||||
'toggle-cell-line-numbers' : {
|
||||
help : 'toggle line numbers',
|
||||
help_index : 'ga',
|
||||
handler : function (env) {
|
||||
env.notebook.cell_toggle_line_numbers();
|
||||
}
|
||||
},
|
||||
'show-keyboard-shortcut-help-dialog' : {
|
||||
'show-keyboard-shortcuts' : {
|
||||
help_index : 'ge',
|
||||
handler : function (env) {
|
||||
env.quick_help.show_keyboard_shortcuts();
|
||||
@ -353,21 +346,7 @@ define(function(require){
|
||||
env.notebook.delete_cell();
|
||||
}
|
||||
},
|
||||
'interrupt-kernel':{
|
||||
icon: 'fa-stop',
|
||||
help_index : 'ha',
|
||||
handler : function (env) {
|
||||
env.notebook.kernel.interrupt();
|
||||
}
|
||||
},
|
||||
'restart-kernel':{
|
||||
icon: 'fa-repeat',
|
||||
help_index : 'hb',
|
||||
handler : function (env) {
|
||||
env.notebook.restart_kernel();
|
||||
}
|
||||
},
|
||||
'undo-last-cell-deletion' : {
|
||||
'undo-cell-deletion' : {
|
||||
help_index : 'ei',
|
||||
handler : function (env) {
|
||||
env.notebook.undelete_cell();
|
||||
@ -375,12 +354,12 @@ define(function(require){
|
||||
},
|
||||
// TODO reminder
|
||||
// open an issue, merge with above merge with last cell of notebook if at top.
|
||||
'merge-selected-cell-with-cell-before' : {
|
||||
'merge-cell-with-previous-cell' : {
|
||||
handler : function (env) {
|
||||
env.notebook.merge_cell_above();
|
||||
}
|
||||
},
|
||||
'merge-selected-cell-with-cell-after' : {
|
||||
'merge-cell-with-next-cell' : {
|
||||
help : 'merge cell below',
|
||||
help_index : 'ek',
|
||||
handler : function (env) {
|
||||
@ -400,7 +379,7 @@ define(function(require){
|
||||
env.pager.collapse();
|
||||
}
|
||||
},
|
||||
'command-palette': {
|
||||
'show-command-palette': {
|
||||
help_index : 'aa',
|
||||
help: 'open the command palette',
|
||||
icon: 'fa-keyboard-o',
|
||||
@ -417,6 +396,21 @@ define(function(require){
|
||||
env.notebook.get_selected_cell().marked ^= true;
|
||||
}
|
||||
},
|
||||
'toggle-toolbar':{
|
||||
help: 'hide/show the toolbar',
|
||||
handler : function(env){
|
||||
$('div#maintoolbar').toggle();
|
||||
events.trigger('resize-header.Page');
|
||||
}
|
||||
},
|
||||
'toggle-header':{
|
||||
help: 'hide/show the header',
|
||||
handler : function(env){
|
||||
$('#header-container').toggle();
|
||||
$('.header-bar').toggle();
|
||||
events.trigger('resize-header.Page');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -438,7 +432,7 @@ define(function(require){
|
||||
return true;
|
||||
}
|
||||
},
|
||||
'move-cursor-up-or-previous-cell':{
|
||||
'move-cursor-up':{
|
||||
handler : function (env, event) {
|
||||
var index = env.notebook.get_selected_index();
|
||||
var cell = env.notebook.get_cell(index);
|
||||
@ -457,7 +451,7 @@ define(function(require){
|
||||
return false;
|
||||
}
|
||||
},
|
||||
'move-cursor-down-or-next-cell':{
|
||||
'move-cursor-down':{
|
||||
handler : function (env, event) {
|
||||
var index = env.notebook.get_selected_index();
|
||||
var cell = env.notebook.get_cell(index);
|
||||
@ -474,7 +468,7 @@ define(function(require){
|
||||
return false;
|
||||
}
|
||||
},
|
||||
'scroll-down': {
|
||||
'scroll-notebook-down': {
|
||||
handler: function(env, event) {
|
||||
if(event){
|
||||
event.preventDefault();
|
||||
@ -482,7 +476,7 @@ define(function(require){
|
||||
return env.notebook.scroll_manager.scroll(1);
|
||||
},
|
||||
},
|
||||
'scroll-up': {
|
||||
'scroll-notebook-up': {
|
||||
handler: function(env, event) {
|
||||
if(event){
|
||||
event.preventDefault();
|
||||
@ -539,13 +533,13 @@ define(function(require){
|
||||
},
|
||||
};
|
||||
|
||||
// private stuff that prepend `.ipython` to actions names
|
||||
// private stuff that prepend `jupyter-notebook:` to actions names
|
||||
// and uniformize/fill in missing pieces in of an action.
|
||||
var _prepare_handler = function(registry, subkey, source){
|
||||
registry['ipython.'+subkey] = {};
|
||||
registry['ipython.'+subkey].help = source[subkey].help||subkey.replace(/-/g,' ');
|
||||
registry['ipython.'+subkey].help_index = source[subkey].help_index;
|
||||
registry['ipython.'+subkey].icon = source[subkey].icon;
|
||||
registry['jupyter-notebook:'+subkey] = {};
|
||||
registry['jupyter-notebook:'+subkey].help = source[subkey].help||subkey.replace(/-/g,' ');
|
||||
registry['jupyter-notebook:'+subkey].help_index = source[subkey].help_index;
|
||||
registry['jupyter-notebook:'+subkey].icon = source[subkey].icon;
|
||||
return source[subkey].handler;
|
||||
};
|
||||
|
||||
@ -556,11 +550,11 @@ define(function(require){
|
||||
for(k in _actions){
|
||||
if(_actions.hasOwnProperty(k)){
|
||||
// Js closure are function level not block level need to wrap in a IIFE
|
||||
// and append ipython to event name these things do intercept event so are wrapped
|
||||
// and append jupyter-notebook: to event name these things do intercept event so are wrapped
|
||||
// in a function that return false.
|
||||
var handler = _prepare_handler(final_actions, k, _actions);
|
||||
(function(key, handler){
|
||||
final_actions['ipython.'+key].handler = function(env, event){
|
||||
final_actions['jupyter-notebook:'+key].handler = function(env, event){
|
||||
handler(env);
|
||||
if(event){
|
||||
event.preventDefault();
|
||||
@ -577,7 +571,7 @@ define(function(require){
|
||||
if(custom_ignore.hasOwnProperty(k)){
|
||||
var handler = _prepare_handler(final_actions, k, custom_ignore);
|
||||
(function(key, handler){
|
||||
final_actions['ipython.'+key].handler = function(env, event){
|
||||
final_actions['jupyter-notebook:'+key].handler = function(env, event){
|
||||
return handler(env, event);
|
||||
};
|
||||
})(k, handler);
|
||||
@ -612,7 +606,7 @@ define(function(require){
|
||||
name = 'autogenerated-'+String(action.handler);
|
||||
}
|
||||
prefix = prefix || 'auto';
|
||||
var full_name = prefix+'.'+name;
|
||||
var full_name = prefix+':'+name;
|
||||
this._actions[full_name] = action;
|
||||
return full_name;
|
||||
|
||||
|
@ -14,7 +14,7 @@ define(function(require){
|
||||
* we drop <namesapce> and replace dashes for space.
|
||||
*/
|
||||
var humanize_action_id = function(str) {
|
||||
return str.split('.')[1].replace(/-/g, ' ').replace(/_/g, '-');
|
||||
return str.split(':')[1].replace(/-/g, ' ').replace(/_/g, '-');
|
||||
};
|
||||
|
||||
/**
|
||||
@ -125,7 +125,7 @@ define(function(require){
|
||||
for (var i = 0; i < actions.length; i++) {
|
||||
var action_id = actions[i];
|
||||
var action = notebook.keyboard_manager.actions.get(action_id);
|
||||
var group = action_id.split('.')[0];
|
||||
var group = action_id.split(':')[0];
|
||||
if (group === 'ipython') {
|
||||
group = 'built-in';
|
||||
}
|
||||
@ -159,7 +159,7 @@ define(function(require){
|
||||
maxItem: 1e3,
|
||||
minLength: 0,
|
||||
hint: true,
|
||||
group: ["group", "{{group}} extension"],
|
||||
group: ["group", "{{group}} command group"],
|
||||
searchOnFocus: true,
|
||||
mustSelectItem: true,
|
||||
template: '<i class="fa fa-icon {{icon}}"></i>{{display}} <div class="pull-right {{mode_shortcut}}">{{shortcut}}</div>',
|
||||
|
@ -62,69 +62,68 @@ define([
|
||||
*/
|
||||
KeyboardManager.prototype.get_default_common_shortcuts = function() {
|
||||
return {
|
||||
'shift' : 'ipython.ignore',
|
||||
'shift-enter' : 'ipython.run-select-next',
|
||||
'ctrl-enter' : 'ipython.execute-in-place',
|
||||
'alt-enter' : 'ipython.execute-and-insert-after',
|
||||
'shift' : 'jupyter-notebook:ignore',
|
||||
'shift-enter' : 'jupyter-notebook:run-cell-and-select-next',
|
||||
'ctrl-enter' : 'jupyter-notebook:run-cell',
|
||||
'alt-enter' : 'jupyter-notebook:run-cell-and-insert-below',
|
||||
// cmd on mac, ctrl otherwise
|
||||
'cmdtrl-s' : 'ipython.save-notebook',
|
||||
'cmdtrl-s' : 'jupyter-notebook:save-notebook',
|
||||
};
|
||||
};
|
||||
|
||||
KeyboardManager.prototype.get_default_edit_shortcuts = function() {
|
||||
return {
|
||||
'cmdtrl-shift-p' : 'ipython.command-palette',
|
||||
'esc' : 'ipython.go-to-command-mode',
|
||||
'ctrl-m' : 'ipython.go-to-command-mode',
|
||||
'up' : 'ipython.move-cursor-up-or-previous-cell',
|
||||
'down' : 'ipython.move-cursor-down-or-next-cell',
|
||||
'ctrl-shift--' : 'ipython.split-cell-at-cursor',
|
||||
'ctrl-shift-subtract' : 'ipython.split-cell-at-cursor',
|
||||
'cmdtrl-shift-p' : 'jupyter-notebook:show-command-palette',
|
||||
'esc' : 'jupyter-notebook:enter-command-mode',
|
||||
'ctrl-m' : 'jupyter-notebook:enter-command-mode',
|
||||
'up' : 'jupyter-notebook:move-cursor-up',
|
||||
'down' : 'jupyter-notebook:move-cursor-down',
|
||||
'ctrl-shift--' : 'jupyter-notebook:split-cell-at-cursor',
|
||||
'ctrl-shift-subtract' : 'jupyter-notebook:split-cell-at-cursor',
|
||||
};
|
||||
};
|
||||
|
||||
KeyboardManager.prototype.get_default_command_shortcuts = function() {
|
||||
return {
|
||||
'cmdtrl-shift-p': 'ipython.command-palette',
|
||||
'shift-space': 'ipython.scroll-up',
|
||||
'shift-v' : 'ipython.paste-cell-before',
|
||||
'shift-m' : 'ipython.merge-marked-cells',
|
||||
'shift-o' : 'ipython.toggle-output-scrolling-selected-cell',
|
||||
'enter' : 'ipython.enter-edit-mode',
|
||||
'space' : 'ipython.scroll-down',
|
||||
'down' : 'ipython.select-next-cell',
|
||||
'ctrl-space' : 'ipython.toggle-cell-marked',
|
||||
'i,i' : 'ipython.interrupt-kernel',
|
||||
'0,0' : 'ipython.restart-kernel',
|
||||
'd,d' : 'ipython.delete-cell',
|
||||
'esc': 'ipython.close-pager',
|
||||
'up' : 'ipython.select-previous-cell',
|
||||
'k' : 'ipython.select-previous-cell',
|
||||
'j' : 'ipython.select-next-cell',
|
||||
'shift-k': 'ipython.extend-marked-previous',
|
||||
'shift-j': 'ipython.extend-marked-next',
|
||||
'shift-up': 'ipython.extend-marked-previous',
|
||||
'shift-down': 'ipython.extend-marked-next',
|
||||
'x' : 'ipython.cut-selected-cell',
|
||||
'c' : 'ipython.copy-selected-cell',
|
||||
'v' : 'ipython.paste-cell-after',
|
||||
'a' : 'ipython.insert-cell-before',
|
||||
'b' : 'ipython.insert-cell-after',
|
||||
'y' : 'ipython.change-selected-cell-to-code-cell',
|
||||
'm' : 'ipython.change-selected-cell-to-markdown-cell',
|
||||
'r' : 'ipython.change-selected-cell-to-raw-cell',
|
||||
'1' : 'ipython.change-selected-cell-to-heading-1',
|
||||
'2' : 'ipython.change-selected-cell-to-heading-2',
|
||||
'3' : 'ipython.change-selected-cell-to-heading-3',
|
||||
'4' : 'ipython.change-selected-cell-to-heading-4',
|
||||
'5' : 'ipython.change-selected-cell-to-heading-5',
|
||||
'6' : 'ipython.change-selected-cell-to-heading-6',
|
||||
'o' : 'ipython.toggle-output-visibility-selected-cell',
|
||||
's' : 'ipython.save-notebook',
|
||||
'l' : 'ipython.toggle-line-number-selected-cell',
|
||||
'h' : 'ipython.show-keyboard-shortcut-help-dialog',
|
||||
'z' : 'ipython.undo-last-cell-deletion',
|
||||
'q' : 'ipython.close-pager',
|
||||
'cmdtrl-shift-p': 'jupyter-notebook:show-command-palette',
|
||||
'shift-space': 'jupyter-notebook:scroll-notebook-up',
|
||||
'shift-v' : 'jupyter-notebook:paste-cell-above',
|
||||
'shift-m' : 'jupyter-notebook:merge-cells',
|
||||
'shift-o' : 'jupyter-notebook:toggle-cell-output-scrolling',
|
||||
'enter' : 'jupyter-notebook:enter-edit-mode',
|
||||
'space' : 'jupyter-notebook:scroll-notebook-down',
|
||||
'down' : 'jupyter-notebook:select-next-cell',
|
||||
'i,i' : 'jupyter-notebook:interrupt-kernel',
|
||||
'0,0' : 'jupyter-notebook:confirm-restart-kernel',
|
||||
'd,d' : 'jupyter-notebook:delete-cell',
|
||||
'esc': 'jupyter-notebook:close-pager',
|
||||
'up' : 'jupyter-notebook:select-previous-cell',
|
||||
'k' : 'jupyter-notebook:select-previous-cell',
|
||||
'j' : 'jupyter-notebook:select-next-cell',
|
||||
'shift-k': 'jupyter-notebook:extend-cell-selection-above',
|
||||
'shift-j': 'jupyter-notebook:extend-cell-selection-below',
|
||||
'shift-up': 'jupyter-notebook:extend-cell-selection-above',
|
||||
'shift-down': 'jupyter-notebook:extend-cell-selection-below',
|
||||
'x' : 'jupyter-notebook:cut-cell',
|
||||
'c' : 'jupyter-notebook:copy-cell',
|
||||
'v' : 'jupyter-notebook:paste-cell-below',
|
||||
'a' : 'jupyter-notebook:insert-cell-above',
|
||||
'b' : 'jupyter-notebook:insert-cell-below',
|
||||
'y' : 'jupyter-notebook:change-cell-to-code',
|
||||
'm' : 'jupyter-notebook:change-cell-to-markdown',
|
||||
'r' : 'jupyter-notebook:change-cell-to-raw',
|
||||
'1' : 'jupyter-notebook:change-cell-to-heading-1',
|
||||
'2' : 'jupyter-notebook:change-cell-to-heading-2',
|
||||
'3' : 'jupyter-notebook:change-cell-to-heading-3',
|
||||
'4' : 'jupyter-notebook:change-cell-to-heading-4',
|
||||
'5' : 'jupyter-notebook:change-cell-to-heading-5',
|
||||
'6' : 'jupyter-notebook:change-cell-to-heading-6',
|
||||
'o' : 'jupyter-notebook:toggle-cell-output-visibility',
|
||||
's' : 'jupyter-notebook:save-notebook',
|
||||
'l' : 'jupyter-notebook:toggle-cell-line-numbers',
|
||||
'h' : 'jupyter-notebook:show-keyboard-shortcuts',
|
||||
'z' : 'jupyter-notebook:undo-cell-deletion',
|
||||
'q' : 'jupyter-notebook:close-pager',
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -32,30 +32,30 @@ define([
|
||||
MainToolBar.prototype._make = function () {
|
||||
var grps = [
|
||||
[
|
||||
['ipython.save-notebook'],
|
||||
['jupyter-notebook:save-notebook'],
|
||||
'save-notbook'
|
||||
],
|
||||
[
|
||||
['ipython.insert-cell-after'],
|
||||
['jupyter-notebook:insert-cell-below'],
|
||||
'insert_above_below'],
|
||||
[
|
||||
['ipython.cut-selected-cell',
|
||||
'ipython.copy-selected-cell',
|
||||
'ipython.paste-cell-after'
|
||||
['jupyter-notebook:cut-cell',
|
||||
'jupyter-notebook:copy-cell',
|
||||
'jupyter-notebook:paste-cell-below'
|
||||
] ,
|
||||
'cut_copy_paste'],
|
||||
[
|
||||
['ipython.move-selected-cell-up',
|
||||
'ipython.move-selected-cell-down'
|
||||
['jupyter-notebook:move-cell-up',
|
||||
'jupyter-notebook:move-cell-down'
|
||||
],
|
||||
'move_up_down'],
|
||||
[ ['ipython.run-select-next',
|
||||
'ipython.interrupt-kernel',
|
||||
'ipython.restart-kernel'
|
||||
[ ['jupyter-notebook:run-cell-and-select-next',
|
||||
'jupyter-notebook:interrupt-kernel',
|
||||
'jupyter-notebook:confirm-restart-kernel'
|
||||
],
|
||||
'run_int'],
|
||||
['<add_celltype_list>'],
|
||||
[['ipython.command-palette']]
|
||||
[['jupyter-notebook:show-command-palette']]
|
||||
];
|
||||
this.construct(grps);
|
||||
};
|
||||
|
@ -203,37 +203,37 @@ define([
|
||||
});
|
||||
|
||||
var id_actions_dict = {
|
||||
'#find_and_replace' : 'ipython.find-and-replace-dialog',
|
||||
'#save_checkpoint': 'ipython.save-notebook',
|
||||
'#restart_kernel': 'ipython.restart-dialog',
|
||||
'#restart_clear_output': 'ipython.restart-clear-output-dialog',
|
||||
'#restart_run_all': 'ipython.restart-run-all-dialog',
|
||||
'#int_kernel': 'ipython.interrupt-kernel',
|
||||
'#cut_cell': 'ipython.cut-selected-cell',
|
||||
'#copy_cell': 'ipython.copy-selected-cell',
|
||||
'#delete_cell': 'ipython.delete-cell',
|
||||
'#undelete_cell': 'ipython.undo-last-cell-deletion',
|
||||
'#split_cell': 'ipython.split-cell-at-cursor',
|
||||
'#merge_cell_above': 'ipython.merge-selected-cell-with-cell-before',
|
||||
'#merge_cell_below': 'ipython.merge-selected-cell-with-cell-after',
|
||||
'#move_cell_up': 'ipython.move-selected-cell-up',
|
||||
'#move_cell_down': 'ipython.move-selected-cell-down',
|
||||
'#toggle_header': 'ipython.toggle-header',
|
||||
'#toggle_toolbar': 'ipython.toggle-toolbar',
|
||||
'#insert_cell_above': 'ipython.insert-cell-before',
|
||||
'#insert_cell_below': 'ipython.insert-cell-after',
|
||||
'#run_cell': 'ipython.execute-in-place',
|
||||
'#run_cell_select_below': 'ipython.run-select-next',
|
||||
'#run_cell_insert_below': 'ipython.execute-and-insert-after',
|
||||
'#run_all_cells': 'ipython.run-all-cells',
|
||||
'#run_all_cells_above': 'ipython.run-all-cells-above',
|
||||
'#run_all_cells_below': 'ipython.run-all-cells-below',
|
||||
'#to_code': 'ipython.change-selected-cell-to-code-cell',
|
||||
'#to_markdown': 'ipython.change-selected-cell-to-markdown-cell',
|
||||
'#to_raw': 'ipython.change-selected-cell-to-raw-cell',
|
||||
'#toggle_current_output': 'ipython.toggle-output-visibility-selected-cell',
|
||||
'#toggle_current_output_scroll': 'ipython.toggle-output-scrolling-selected-cell',
|
||||
'#clear_current_output': 'ipython.clear-output-selected-cell',
|
||||
'#find_and_replace' : 'jupyter-notebook:find-and-replace',
|
||||
'#save_checkpoint': 'jupyter-notebook:save-notebook',
|
||||
'#restart_kernel': 'jupyter-notebook:confirm-restart-kernel',
|
||||
'#restart_clear_output': 'jupyter-notebook:confirm-restart-kernel-and-clear-output',
|
||||
'#restart_run_all': 'jupyter-notebook:confirm-restart-kernel-and-run-all-cells',
|
||||
'#int_kernel': 'jupyter-notebook:interrupt-kernel',
|
||||
'#cut_cell': 'jupyter-notebook:cut-cell',
|
||||
'#copy_cell': 'jupyter-notebook:copy-cell',
|
||||
'#delete_cell': 'jupyter-notebook:delete-cell',
|
||||
'#undelete_cell': 'jupyter-notebook:undo-cell-deletion',
|
||||
'#split_cell': 'jupyter-notebook:split-cell-at-cursor',
|
||||
'#merge_cell_above': 'jupyter-notebook:merge-cell-with-previous-cell',
|
||||
'#merge_cell_below': 'jupyter-notebook:merge-cell-with-next-cell',
|
||||
'#move_cell_up': 'jupyter-notebook:move-cell-up',
|
||||
'#move_cell_down': 'jupyter-notebook:move-cell-down',
|
||||
'#toggle_header': 'jupyter-notebook:toggle-header',
|
||||
'#toggle_toolbar': 'jupyter-notebook:toggle-toolbar',
|
||||
'#insert_cell_above': 'jupyter-notebook:insert-cell-above',
|
||||
'#insert_cell_below': 'jupyter-notebook:insert-cell-below',
|
||||
'#run_cell': 'jupyter-notebook:run-cell',
|
||||
'#run_cell_select_below': 'jupyter-notebook:run-cell-and-select-next',
|
||||
'#run_cell_insert_below': 'jupyter-notebook:run-cell-and-insert-below',
|
||||
'#run_all_cells': 'jupyter-notebook:run-all-cells',
|
||||
'#run_all_cells_above': 'jupyter-notebook:run-all-cells-above',
|
||||
'#run_all_cells_below': 'jupyter-notebook:run-all-cells-below',
|
||||
'#to_code': 'jupyter-notebook:change-cell-to-code',
|
||||
'#to_markdown': 'jupyter-notebook:change-cell-to-markdown',
|
||||
'#to_raw': 'jupyter-notebook:change-cell-to-raw',
|
||||
'#toggle_current_output': 'jupyter-notebook:toggle-cell-output-visibility',
|
||||
'#toggle_current_output_scroll': 'jupyter-notebook:toggle-cell-output-scrolling',
|
||||
'#clear_current_output': 'jupyter-notebook:clear-cell-output',
|
||||
};
|
||||
|
||||
for(var idx in id_actions_dict){
|
||||
|
@ -377,10 +377,10 @@ define(function(require){
|
||||
}
|
||||
};
|
||||
|
||||
var act_all = keyboard_manager.actions.register(action_all, 'find-and-replace-dialog', 'ipython');
|
||||
var act_all = keyboard_manager.actions.register(action_all, 'find-and-replace', 'jupyter-notebook');
|
||||
|
||||
keyboard_manager.command_shortcuts.add_shortcuts({
|
||||
'f': 'ipython.find-and-replace-dialog'
|
||||
'f': 'jupyter-notebook:find-and-replace'
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -66,7 +66,7 @@ casper.notebook_test(function () {
|
||||
IPython.notebook.select(0);
|
||||
cell.clear_output();
|
||||
cell.set_text('a=13; print(a)');
|
||||
$("button[data-jupyter-action='ipython.run-select-next']")[0].click()
|
||||
$("button[data-jupyter-action='ipython.run-cell-and-select-next']")[0].click()
|
||||
});
|
||||
|
||||
this.wait_for_output(0);
|
||||
|
@ -30,7 +30,7 @@ casper.notebook_test(function () {
|
||||
$('#cell_type').val('markdown').change();
|
||||
var cell = IPython.notebook.get_selected_cell();
|
||||
cell.set_text('*Baz*');
|
||||
$("button[data-jupyter-action='ipython.run-select-next']")[0].click();
|
||||
$("button[data-jupyter-action='ipython.run-cell-and-select-next']")[0].click();
|
||||
return cell.get_rendered();
|
||||
});
|
||||
this.test.assertEquals(output.trim(), '<p><em>Baz</em></p>', 'Markdown toolbar items work.');
|
||||
|
Loading…
Reference in New Issue
Block a user