##// END OF EJS Templates
enable keyboard manager when codemirror is focused...
Min RK -
Show More
@@ -150,6 +150,7 b' define(['
150 /** @method create_element */
150 /** @method create_element */
151 CodeCell.prototype.create_element = function () {
151 CodeCell.prototype.create_element = function () {
152 Cell.prototype.create_element.apply(this, arguments);
152 Cell.prototype.create_element.apply(this, arguments);
153 var that = this;
153
154
154 var cell = $('<div></div>').addClass('cell code_cell');
155 var cell = $('<div></div>').addClass('cell code_cell');
155 cell.attr('tabindex','2');
156 cell.attr('tabindex','2');
@@ -163,6 +164,13 b' define(['
163 inner_cell.append(this.celltoolbar.element);
164 inner_cell.append(this.celltoolbar.element);
164 var input_area = $('<div/>').addClass('input_area');
165 var input_area = $('<div/>').addClass('input_area');
165 this.code_mirror = new CodeMirror(input_area.get(0), this.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,
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 this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this));
174 this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this));
167 $(this.code_mirror.getInputField()).attr("spellcheck", "false");
175 $(this.code_mirror.getInputField()).attr("spellcheck", "false");
168 inner_cell.append(input_area);
176 inner_cell.append(input_area);
@@ -85,6 +85,7 b' define(['
85 */
85 */
86 TextCell.prototype.create_element = function () {
86 TextCell.prototype.create_element = function () {
87 Cell.prototype.create_element.apply(this, arguments);
87 Cell.prototype.create_element.apply(this, arguments);
88 var that = this;
88
89
89 var cell = $("<div>").addClass('cell text_cell');
90 var cell = $("<div>").addClass('cell text_cell');
90 cell.attr('tabindex','2');
91 cell.attr('tabindex','2');
@@ -98,6 +99,13 b' define(['
98 inner_cell.append(this.celltoolbar.element);
99 inner_cell.append(this.celltoolbar.element);
99 var input_area = $('<div/>').addClass('input_area');
100 var input_area = $('<div/>').addClass('input_area');
100 this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config);
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 this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this))
109 this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this))
102 // The tabindex=-1 makes this div focusable.
110 // The tabindex=-1 makes this div focusable.
103 var render_area = $('<div/>').addClass('text_cell_render rendered_html')
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