diff --git a/IPython/html/static/notebook/js/cell.js b/IPython/html/static/notebook/js/cell.js index dda60e3..9912995 100644 --- a/IPython/html/static/notebook/js/cell.js +++ b/IPython/html/static/notebook/js/cell.js @@ -73,14 +73,25 @@ define([ } }); + // backward compat. + Object.defineProperty(this, 'cm_config', { + get: function() { + return that._options.cm_config; + }, + set: function(value) { + that._options.cm_config = value; + } + }); + // load this from metadata later ? this.user_highlight = 'auto'; + var _local_cm_config = {}; if(this.class_config){ _local_cm_config = this.class_config.get_sync('cm_config'); } - this.cm_config = utils.mergeopt({}, config.cm_config, _local_cm_config); + config.cm_config = utils.mergeopt({}, config.cm_config, _local_cm_config); this.cell_id = utils.uuid(); this._options = config; diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js index 909c5c7..dfff90f 100644 --- a/IPython/html/static/notebook/js/codecell.js +++ b/IPython/html/static/notebook/js/codecell.js @@ -125,7 +125,7 @@ define([ "Cmd-/" : "toggleComment", "Ctrl-/" : "toggleComment" }, - mode: 'ipython', + mode: 'text', theme: 'ipython', matchBrackets: true, autoCloseBrackets: true @@ -163,7 +163,7 @@ define([ notebook: this.notebook}); inner_cell.append(this.celltoolbar.element); var input_area = $('
').addClass('input_area'); - this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config); + this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config); // In case of bugs that put the keyboard manager into an inconsistent state, // ensure KM is enabled when CodeMirror is focused: this.code_mirror.on('focus', function () { diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index bc33c98..c7f5cf7 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -1515,7 +1515,7 @@ define(function (require) { // This is currently redundant, because cm_config ends up as // codemirror's own .options object, but I don't want to // rely on that. - cell.cm_config.mode = spec; + cell._options.cm_config.mode = spec; } }); }); diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index ff9f1f3..5fdbf97 100644 --- a/IPython/html/static/notebook/js/textcell.js +++ b/IPython/html/static/notebook/js/textcell.js @@ -98,7 +98,7 @@ define([ notebook: this.notebook}); inner_cell.append(this.celltoolbar.element); var input_area = $('').addClass('input_area'); - this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config); + this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config); // In case of bugs that put the keyboard manager into an inconsistent state, // ensure KM is enabled when CodeMirror is focused: this.code_mirror.on('focus', function () {