##// END OF EJS Templates
Merge codemirror config with user config....
Matthias Bussonnier -
Show More
@@ -56,7 +56,6 b' define(['
56 // superclass default overwrite our default
56 // superclass default overwrite our default
57
57
58 this.placeholder = config.placeholder || '';
58 this.placeholder = config.placeholder || '';
59 this.read_only = config.cm_config.readOnly;
60 this.selected = false;
59 this.selected = false;
61 this.rendered = false;
60 this.rendered = false;
62 this.mode = 'command';
61 this.mode = 'command';
@@ -76,7 +75,12 b' define(['
76
75
77 // load this from metadata later ?
76 // load this from metadata later ?
78 this.user_highlight = 'auto';
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 this.cell_id = utils.uuid();
84 this.cell_id = utils.uuid();
81 this._options = config;
85 this._options = config;
82
86
@@ -163,7 +163,7 b' define(['
163 notebook: this.notebook});
163 notebook: this.notebook});
164 inner_cell.append(this.celltoolbar.element);
164 inner_cell.append(this.celltoolbar.element);
165 var input_area = $('<div/>').addClass('input_area');
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 // In case of bugs that put the keyboard manager into an inconsistent state,
167 // In case of bugs that put the keyboard manager into an inconsistent state,
168 // ensure KM is enabled when CodeMirror is focused:
168 // ensure KM is enabled when CodeMirror is focused:
169 this.code_mirror.on('focus', function () {
169 this.code_mirror.on('focus', function () {
@@ -129,7 +129,6 b' define(['
129 };
129 };
130
130
131 TextCell.prototype.unrender = function () {
131 TextCell.prototype.unrender = function () {
132 if (this.read_only) return;
133 var cont = Cell.prototype.unrender.apply(this);
132 var cont = Cell.prototype.unrender.apply(this);
134 if (cont) {
133 if (cont) {
135 var text_cell = this.element;
134 var text_cell = this.element;
@@ -230,10 +229,10 b' define(['
230 */
229 */
231 options = options || {};
230 options = options || {};
232 var config = utils.mergeopt(MarkdownCell, {});
231 var config = utils.mergeopt(MarkdownCell, {});
233 TextCell.apply(this, [$.extend({}, options, {config: config})]);
234
235 this.class_config = new configmod.ConfigWithDefaults(options.config,
232 this.class_config = new configmod.ConfigWithDefaults(options.config,
236 {}, 'MarkdownCell');
233 {}, 'MarkdownCell');
234 TextCell.apply(this, [$.extend({}, options, {config: config})]);
235
237 this.cell_type = 'markdown';
236 this.cell_type = 'markdown';
238 };
237 };
239
238
General Comments 0
You need to be logged in to leave comments. Login now