From 33bd6d4d1e7da0baca3bfc46a93d40d66864c416 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Mon, 26 Oct 2015 08:17:47 -0700 Subject: [PATCH 1/2] Escape: Close pager if open otherwise unmark all --- notebook/static/notebook/js/actions.js | 13 ++++++++++++- notebook/static/notebook/js/keyboardmanager.js | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/notebook/static/notebook/js/actions.js b/notebook/static/notebook/js/actions.js index ca1b2761b..07de08acd 100644 --- a/notebook/static/notebook/js/actions.js +++ b/notebook/static/notebook/js/actions.js @@ -437,7 +437,18 @@ define(function(require){ $('.header-bar').toggle(); events.trigger('resize-header.Page'); } - } + }, + 'escape': { + help : 'close the pager or unmark all cells', + handler : function(env) { + // Collapse the page if it is open, otherwise unmark all. + if (env.pager && env.pager.expanded) { + env.pager.collapse(); + } else { + env.notebook.unmark_all_cells(); + } + } + }, }; /** diff --git a/notebook/static/notebook/js/keyboardmanager.js b/notebook/static/notebook/js/keyboardmanager.js index d6a91579d..1c91b1d9e 100644 --- a/notebook/static/notebook/js/keyboardmanager.js +++ b/notebook/static/notebook/js/keyboardmanager.js @@ -96,7 +96,7 @@ define([ 'i,i' : 'jupyter-notebook:interrupt-kernel', '0,0' : 'jupyter-notebook:confirm-restart-kernel', 'd,d' : 'jupyter-notebook:delete-cell', - 'esc': 'jupyter-notebook:close-pager', + 'esc': 'jupyter-notebook:escape', 'up' : 'jupyter-notebook:select-previous-cell', 'k' : 'jupyter-notebook:select-previous-cell', 'j' : 'jupyter-notebook:select-next-cell', From 4e06573ae1c219b60965db6c7a1efacb90dbaf27 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Mon, 26 Oct 2015 09:48:49 -0700 Subject: [PATCH 2/2] @carreau 's suggestion --- notebook/static/notebook/js/actions.js | 2 +- notebook/static/notebook/js/keyboardmanager.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/notebook/static/notebook/js/actions.js b/notebook/static/notebook/js/actions.js index 07de08acd..13c1db565 100644 --- a/notebook/static/notebook/js/actions.js +++ b/notebook/static/notebook/js/actions.js @@ -438,7 +438,7 @@ define(function(require){ events.trigger('resize-header.Page'); } }, - 'escape': { + 'close-pager-or-unmark-all-cells': { help : 'close the pager or unmark all cells', handler : function(env) { // Collapse the page if it is open, otherwise unmark all. diff --git a/notebook/static/notebook/js/keyboardmanager.js b/notebook/static/notebook/js/keyboardmanager.js index 1c91b1d9e..9e618a552 100644 --- a/notebook/static/notebook/js/keyboardmanager.js +++ b/notebook/static/notebook/js/keyboardmanager.js @@ -96,7 +96,7 @@ define([ 'i,i' : 'jupyter-notebook:interrupt-kernel', '0,0' : 'jupyter-notebook:confirm-restart-kernel', 'd,d' : 'jupyter-notebook:delete-cell', - 'esc': 'jupyter-notebook:escape', + 'esc': 'jupyter-notebook:close-pager-or-unmark-all-cells', 'up' : 'jupyter-notebook:select-previous-cell', 'k' : 'jupyter-notebook:select-previous-cell', 'j' : 'jupyter-notebook:select-next-cell',