diff --git a/IPython/html/static/base/js/dialog.js b/IPython/html/static/base/js/dialog.js index 4ec8ec0..350bd2a 100644 --- a/IPython/html/static/base/js/dialog.js +++ b/IPython/html/static/base/js/dialog.js @@ -69,12 +69,13 @@ IPython.dialog = (function (IPython) { if (IPython.notebook) { var cell = IPython.notebook.get_selected_cell(); if (cell) cell.select(); + IPython.keyboard_manager.enable(); IPython.keyboard_manager.command_mode(); } }); if (IPython.keyboard_manager) { - IPython.keyboard_manager.null_mode(); + IPython.keyboard_manager.disable(); } return dialog.modal(options); diff --git a/IPython/html/static/notebook/js/completer.js b/IPython/html/static/notebook/js/completer.js index f089879..e3e4617 100644 --- a/IPython/html/static/notebook/js/completer.js +++ b/IPython/html/static/notebook/js/completer.js @@ -257,7 +257,7 @@ var IPython = (function (IPython) { this.build_gui_list(this.raw_result); this.sel.focus(); - IPython.keyboard_manager.null_mode(); + IPython.keyboard_manager.disable(); // Opera sometimes ignores focusing a freshly created node if (window.opera) setTimeout(function () { if (!this.done) this.sel.focus(); @@ -282,7 +282,7 @@ var IPython = (function (IPython) { if (this.done) return; this.done = true; $('.completions').remove(); - IPython.keyboard_manager.edit_mode(); + IPython.keyboard_manager.enable(); } Completer.prototype.pick = function () { diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js index edf26de..00cb28a 100644 --- a/IPython/html/static/notebook/js/keyboardmanager.js +++ b/IPython/html/static/notebook/js/keyboardmanager.js @@ -16,7 +16,7 @@ var IPython = (function (IPython) { var KeyboardManager = function () { this.mode = 'command'; - this.last_mode = 'command'; + this.enabled = true; this.bind_events(); }; @@ -38,8 +38,8 @@ var IPython = (function (IPython) { event.preventDefault(); } - if (this.mode === 'null') { - return this.handle_null_mode(event); + if (!this.enabled) { + return true; } // Event handlers for both command and edit mode @@ -75,11 +75,6 @@ var IPython = (function (IPython) { } } - KeyboardManager.prototype.handle_null_mode = function (event) { - return true; - } - - KeyboardManager.prototype.handle_edit_mode = function (event) { var notebook = IPython.notebook; @@ -263,19 +258,6 @@ var IPython = (function (IPython) { this.mode = 'command'; } - KeyboardManager.prototype.null_mode = function () { - console.log('KeyboardManager', 'changing to null mode'); - this.last_mode = this.mode; - this.mode = 'null'; - } - - KeyboardManager.prototype.last_mode = function () { - var lm = this.last_mode; - this.last_mode = this.mode; - this.mode = lm; - } - - IPython.KeyboardManager = KeyboardManager; return IPython;