Merge pull request #89 from Carreau/one-config-to-rule-them-all

Store codemirror config in only one location
Min RK 11 years ago
commit fb8b83e905

@ -73,14 +73,23 @@ define([
}
});
// backward compat.
Object.defineProperty(this, 'cm_config', {
get: function() {
console.warn("Warning: accessing Cell.cm_config directly is deprecate.")
return that._options.cm_config;
},
});
// 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;

@ -123,7 +123,7 @@ define([
"Cmd-/" : "toggleComment",
"Ctrl-/" : "toggleComment"
},
mode: 'ipython',
mode: 'text',
theme: 'ipython',
matchBrackets: true,
autoCloseBrackets: true
@ -162,7 +162,7 @@ define([
notebook: this.notebook});
inner_cell.append(this.celltoolbar.element);
var input_area = $('<div/>').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 () {

@ -1526,7 +1526,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;
}
});

@ -98,7 +98,7 @@ define([
notebook: this.notebook});
inner_cell.append(this.celltoolbar.element);
var input_area = $('<div/>').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 () {

Loading…
Cancel
Save