Fixed code mirror skipping Markdown cell bug

This commit is contained in:
foogunlana 2014-11-29 11:32:39 +00:00
parent 9fe4bcc817
commit dbc98b5f69
2 changed files with 6 additions and 4 deletions

View File

@ -226,6 +226,10 @@ define([
* true = ignore, false = don't ignore.
* @method handle_codemirror_keyevent
*/
/* Correction here */
CodeCell.prototype.handle_codemirror_keyevent = function (editor, event) {
var that = this;

View File

@ -41,10 +41,7 @@ define([
this.config = options.config;
// we cannot put this as a class key as it has handle to "this".
var cm_overwrite_options = {
onKeyEvent: $.proxy(this.handle_keyevent,this)
};
var config = utils.mergeopt(TextCell, this.config, {cm_config:cm_overwrite_options});
var config = utils.mergeopt(TextCell, this.config);
Cell.apply(this, [{
config: config,
keyboard_manager: options.keyboard_manager,
@ -86,6 +83,7 @@ define([
inner_cell.append(this.celltoolbar.element);
var input_area = $('<div/>').addClass('input_area');
this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config);
this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this))
// The tabindex=-1 makes this div focusable.
var render_area = $('<div/>').addClass('text_cell_render rendered_html')
.attr('tabindex','-1');