##// END OF EJS Templates
Backport jupyter/notebook#89...
Matthias Bussonnier -
Show More
@@ -73,14 +73,25 b' define(['
73 73 }
74 74 });
75 75
76 // backward compat.
77 Object.defineProperty(this, 'cm_config', {
78 get: function() {
79 return that._options.cm_config;
80 },
81 set: function(value) {
82 that._options.cm_config = value;
83 }
84 });
85
76 86 // load this from metadata later ?
77 87 this.user_highlight = 'auto';
78 88
89
79 90 var _local_cm_config = {};
80 91 if(this.class_config){
81 92 _local_cm_config = this.class_config.get_sync('cm_config');
82 93 }
83 this.cm_config = utils.mergeopt({}, config.cm_config, _local_cm_config);
94 config.cm_config = utils.mergeopt({}, config.cm_config, _local_cm_config);
84 95 this.cell_id = utils.uuid();
85 96 this._options = config;
86 97
@@ -125,7 +125,7 b' define(['
125 125 "Cmd-/" : "toggleComment",
126 126 "Ctrl-/" : "toggleComment"
127 127 },
128 mode: 'ipython',
128 mode: 'text',
129 129 theme: 'ipython',
130 130 matchBrackets: true,
131 131 autoCloseBrackets: true
@@ -163,7 +163,7 b' define(['
163 163 notebook: this.notebook});
164 164 inner_cell.append(this.celltoolbar.element);
165 165 var input_area = $('<div/>').addClass('input_area');
166 this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config);
166 this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config);
167 167 // In case of bugs that put the keyboard manager into an inconsistent state,
168 168 // ensure KM is enabled when CodeMirror is focused:
169 169 this.code_mirror.on('focus', function () {
@@ -1515,7 +1515,7 b' define(function (require) {'
1515 1515 // This is currently redundant, because cm_config ends up as
1516 1516 // codemirror's own .options object, but I don't want to
1517 1517 // rely on that.
1518 cell.cm_config.mode = spec;
1518 cell._options.cm_config.mode = spec;
1519 1519 }
1520 1520 });
1521 1521 });
@@ -98,7 +98,7 b' define(['
98 98 notebook: this.notebook});
99 99 inner_cell.append(this.celltoolbar.element);
100 100 var input_area = $('<div/>').addClass('input_area');
101 this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config);
101 this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config);
102 102 // In case of bugs that put the keyboard manager into an inconsistent state,
103 103 // ensure KM is enabled when CodeMirror is focused:
104 104 this.code_mirror.on('focus', function () {
General Comments 0
You need to be logged in to leave comments. Login now