mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +08:00
Store codemirror config in only one location
Closes (once backported) #EntropyOrg/p5-Devel-IPerl#40 and jupyter/notebook#88
This commit is contained in:
parent
4be2c7957a
commit
a197d4f7f4
@ -73,14 +73,23 @@ define([
|
||||
}
|
||||
});
|
||||
|
||||
// backward compat.
|
||||
Object.defineProperty(this, 'cm_config', {
|
||||
get: function() {
|
||||
console.warn("warning you are accessing a deprecated field")
|
||||
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…
Reference in New Issue
Block a user