From ead33abc79a960b8f6dd07e93412759cf13f5e62 2014-11-29 13:23:28 From: Matthias Bussonnier Date: 2014-11-29 13:23:28 Subject: [PATCH] Merge pull request #7055 from foogunlana/codemirror_bug_fix Fixed the code mirror skipping Markdown cell bug --- diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js index df8ec26..59bd116 100644 --- a/IPython/html/static/notebook/js/codecell.js +++ b/IPython/html/static/notebook/js/codecell.js @@ -226,6 +226,7 @@ define([ * true = ignore, false = don't ignore. * @method handle_codemirror_keyevent */ + CodeCell.prototype.handle_codemirror_keyevent = function (editor, event) { var that = this; diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index 24bd1e4..3cb76ab 100644 --- a/IPython/html/static/notebook/js/textcell.js +++ b/IPython/html/static/notebook/js/textcell.js @@ -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 = $('
').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 = $('
').addClass('text_cell_render rendered_html') .attr('tabindex','-1');