From 487d3ecb0966f7ccd58a6e61bfdbf3075e72f707 Mon Sep 17 00:00:00 2001 From: acrule Date: Fri, 21 Apr 2017 10:22:25 -0700 Subject: [PATCH 1/2] redirect paste menu items to call paste actions, not notebook paste functions --- notebook/static/notebook/js/actions.js | 6 ++++++ notebook/static/notebook/js/notebook.js | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/notebook/static/notebook/js/actions.js b/notebook/static/notebook/js/actions.js index 5e766abb1c..66386762b0 100644 --- a/notebook/static/notebook/js/actions.js +++ b/notebook/static/notebook/js/actions.js @@ -283,6 +283,12 @@ define(function(require){ env.notebook.copy_cell(); } }, + 'paste-cell-replace' : { + help: 'paste cells replace', + handler : function (env) { + env.notebook.paste_cell_replace(); + } + }, 'paste-cell-above' : { help: 'paste cells above', help_index : 'eg', diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index 4fb82417a1..e569627cd0 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -1567,11 +1567,14 @@ define([ var that = this; if (!this.paste_enabled) { $('#paste_cell_replace').removeClass('disabled') - .on('click', function () {that.paste_cell_replace();}); + .on('click', function () {that.keyboard_manager.actions.call( + 'jupyter-notebook:paste-cell-replace');}); $('#paste_cell_above').removeClass('disabled') - .on('click', function () {that.paste_cell_above();}); + .on('click', function () {that.keyboard_manager.actions.call( + 'jupyter-notebook:paste_cell_above');}); $('#paste_cell_below').removeClass('disabled') - .on('click', function () {that.paste_cell_below();}); + .on('click', function () {that.keyboard_manager.actions.call( + 'jupyter-notebook:paste-cell-below');}); this.paste_enabled = true; } }; From e928e2170465843cc26067f1c7d8ded73a3a7a7f Mon Sep 17 00:00:00 2001 From: acrule Date: Fri, 21 Apr 2017 10:33:38 -0700 Subject: [PATCH 2/2] fix typo in action name --- notebook/static/notebook/js/notebook.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index e569627cd0..5996520444 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -1571,7 +1571,7 @@ define([ 'jupyter-notebook:paste-cell-replace');}); $('#paste_cell_above').removeClass('disabled') .on('click', function () {that.keyboard_manager.actions.call( - 'jupyter-notebook:paste_cell_above');}); + 'jupyter-notebook:paste-cell-above');}); $('#paste_cell_below').removeClass('disabled') .on('click', function () {that.keyboard_manager.actions.call( 'jupyter-notebook:paste-cell-below');});