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 | // load this from metadata later ? |
|
86 | // load this from metadata later ? | |
77 | this.user_highlight = 'auto'; |
|
87 | this.user_highlight = 'auto'; | |
78 |
|
88 | |||
|
89 | ||||
79 | var _local_cm_config = {}; |
|
90 | var _local_cm_config = {}; | |
80 | if(this.class_config){ |
|
91 | if(this.class_config){ | |
81 | _local_cm_config = this.class_config.get_sync('cm_config'); |
|
92 | _local_cm_config = this.class_config.get_sync('cm_config'); | |
82 | } |
|
93 | } | |
83 |
|
|
94 | config.cm_config = utils.mergeopt({}, config.cm_config, _local_cm_config); | |
84 | this.cell_id = utils.uuid(); |
|
95 | this.cell_id = utils.uuid(); | |
85 | this._options = config; |
|
96 | this._options = config; | |
86 |
|
97 |
@@ -125,7 +125,7 b' define([' | |||||
125 | "Cmd-/" : "toggleComment", |
|
125 | "Cmd-/" : "toggleComment", | |
126 | "Ctrl-/" : "toggleComment" |
|
126 | "Ctrl-/" : "toggleComment" | |
127 | }, |
|
127 | }, | |
128 |
mode: ' |
|
128 | mode: 'text', | |
129 | theme: 'ipython', |
|
129 | theme: 'ipython', | |
130 | matchBrackets: true, |
|
130 | matchBrackets: true, | |
131 | autoCloseBrackets: true |
|
131 | autoCloseBrackets: true | |
@@ -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.cm_config); |
|
166 | this.code_mirror = new CodeMirror(input_area.get(0), this._options.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 () { |
@@ -1515,7 +1515,7 b' define(function (require) {' | |||||
1515 | // This is currently redundant, because cm_config ends up as |
|
1515 | // This is currently redundant, because cm_config ends up as | |
1516 | // codemirror's own .options object, but I don't want to |
|
1516 | // codemirror's own .options object, but I don't want to | |
1517 | // rely on that. |
|
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 | notebook: this.notebook}); |
|
98 | notebook: this.notebook}); | |
99 | inner_cell.append(this.celltoolbar.element); |
|
99 | inner_cell.append(this.celltoolbar.element); | |
100 | var input_area = $('<div/>').addClass('input_area'); |
|
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 | // In case of bugs that put the keyboard manager into an inconsistent state, |
|
102 | // In case of bugs that put the keyboard manager into an inconsistent state, | |
103 | // ensure KM is enabled when CodeMirror is focused: |
|
103 | // ensure KM is enabled when CodeMirror is focused: | |
104 | this.code_mirror.on('focus', function () { |
|
104 | this.code_mirror.on('focus', function () { |
General Comments 0
You need to be logged in to leave comments.
Login now