Show More
@@ -150,6 +150,7 b' define([' | |||
|
150 | 150 | /** @method create_element */ |
|
151 | 151 | CodeCell.prototype.create_element = function () { |
|
152 | 152 | Cell.prototype.create_element.apply(this, arguments); |
|
153 | var that = this; | |
|
153 | 154 | |
|
154 | 155 | var cell = $('<div></div>').addClass('cell code_cell'); |
|
155 | 156 | cell.attr('tabindex','2'); |
@@ -163,6 +164,13 b' define([' | |||
|
163 | 164 | inner_cell.append(this.celltoolbar.element); |
|
164 | 165 | var input_area = $('<div/>').addClass('input_area'); |
|
165 | 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, | |
|
168 | // ensure KM is enabled when CodeMirror is focused: | |
|
169 | this.code_mirror.on('focus', function () { | |
|
170 | if (that.keyboard_manager) { | |
|
171 | that.keyboard_manager.enable(); | |
|
172 | } | |
|
173 | }); | |
|
166 | 174 | this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this)); |
|
167 | 175 | $(this.code_mirror.getInputField()).attr("spellcheck", "false"); |
|
168 | 176 | inner_cell.append(input_area); |
@@ -85,6 +85,7 b' define([' | |||
|
85 | 85 | */ |
|
86 | 86 | TextCell.prototype.create_element = function () { |
|
87 | 87 | Cell.prototype.create_element.apply(this, arguments); |
|
88 | var that = this; | |
|
88 | 89 | |
|
89 | 90 | var cell = $("<div>").addClass('cell text_cell'); |
|
90 | 91 | cell.attr('tabindex','2'); |
@@ -98,6 +99,13 b' define([' | |||
|
98 | 99 | inner_cell.append(this.celltoolbar.element); |
|
99 | 100 | var input_area = $('<div/>').addClass('input_area'); |
|
100 | 101 | this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config); |
|
102 | // In case of bugs that put the keyboard manager into an inconsistent state, | |
|
103 | // ensure KM is enabled when CodeMirror is focused: | |
|
104 | this.code_mirror.on('focus', function () { | |
|
105 | if (that.keyboard_manager) { | |
|
106 | that.keyboard_manager.enable(); | |
|
107 | } | |
|
108 | }); | |
|
101 | 109 | this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this)) |
|
102 | 110 | // The tabindex=-1 makes this div focusable. |
|
103 | 111 | var render_area = $('<div/>').addClass('text_cell_render rendered_html') |
General Comments 0
You need to be logged in to leave comments.
Login now