diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index c051d62f6..0ae246db9 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -87,6 +87,7 @@ define([ */ function Notebook(selector, options) { this.config = options.config; + this.config.loaded.then(this.validate_config.bind(this)) this.class_config = new configmod.ConfigWithDefaults(this.config, Notebook.options_default, 'Notebook'); this.base_url = options.base_url; @@ -259,6 +260,15 @@ define([ Toolbar: true }; + Notebook.prototype.validate_config = function() { + var code_cell = this.config.data['CodeCell'] || {}; + var cm_keymap = (code_cell['cm_config'] || {})['keyMap']; + if (cm_keymap && CodeMirror.keyMap[cm_keymap] === undefined) { + console.warn('CodeMirror keymap not found, ignoring: ' + cm_keymap); + delete code_cell.cm_config.keyMap; + } + }; + /** * Create an HTML and CSS representation of the notebook. */