##// END OF EJS Templates
Merge codemirror config with user config....
Matthias Bussonnier -
Show More
@@ -56,7 +56,6 b' define(['
56 56 // superclass default overwrite our default
57 57
58 58 this.placeholder = config.placeholder || '';
59 this.read_only = config.cm_config.readOnly;
60 59 this.selected = false;
61 60 this.rendered = false;
62 61 this.mode = 'command';
@@ -76,7 +75,12 b' define(['
76 75
77 76 // load this from metadata later ?
78 77 this.user_highlight = 'auto';
79 this.cm_config = config.cm_config;
78
79 var class_conf_value = {};
80 if(this.class_config){
81 class_conf_value = this.class_config.get_sync('cm_config');
82 }
83 this.cm_config = utils.mergeopt({}, config.cm_config, class_conf_value);
80 84 this.cell_id = utils.uuid();
81 85 this._options = config;
82 86
@@ -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.class_config.get_sync('cm_config'));
166 this.code_mirror = new CodeMirror(input_area.get(0), this.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 () {
@@ -129,7 +129,6 b' define(['
129 129 };
130 130
131 131 TextCell.prototype.unrender = function () {
132 if (this.read_only) return;
133 132 var cont = Cell.prototype.unrender.apply(this);
134 133 if (cont) {
135 134 var text_cell = this.element;
@@ -230,10 +229,10 b' define(['
230 229 */
231 230 options = options || {};
232 231 var config = utils.mergeopt(MarkdownCell, {});
233 TextCell.apply(this, [$.extend({}, options, {config: config})]);
234
235 232 this.class_config = new configmod.ConfigWithDefaults(options.config,
236 233 {}, 'MarkdownCell');
234 TextCell.apply(this, [$.extend({}, options, {config: config})]);
235
237 236 this.cell_type = 'markdown';
238 237 };
239 238
General Comments 0
You need to be logged in to leave comments. Login now