From 43b80ca3e4649b542d2fd5b884c90bcf5ce46e1a 2014-10-09 22:00:15 From: Min RK Date: 2014-10-09 22:00:15 Subject: [PATCH] Merge pull request #6416 from Carreau/foobarcode Unify Text/CodeCell code. --- diff --git a/IPython/html/static/notebook/js/cell.js b/IPython/html/static/notebook/js/cell.js index e0a8165..e53a4e8 100644 --- a/IPython/html/static/notebook/js/cell.js +++ b/IPython/html/static/notebook/js/cell.js @@ -157,6 +157,16 @@ define([ that.events.trigger('command_mode.Cell', {cell: that}); }); } + + this.element.dblclick(function () { + if (that.selected === false) { + this.events.trigger('select.Cell', {'cell':that}); + } + var cont = that.unrender(); + if (cont) { + that.focus_editor(); + } + }); }; /** diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js index 6835cf9..d1a68d8 100644 --- a/IPython/html/static/notebook/js/codecell.js +++ b/IPython/html/static/notebook/js/codecell.js @@ -288,6 +288,7 @@ define([ delete CodeCell.msg_cells[old_msg_id]; } CodeCell.msg_cells[this.last_msg_id] = this; + this.render(); }; /** @@ -360,11 +361,6 @@ define([ return cont; }; - CodeCell.prototype.unrender = function () { - // CodeCell is always rendered - return false; - }; - CodeCell.prototype.select_all = function () { var start = {line: 0, ch: 0}; var nlines = this.code_mirror.lineCount(); diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index f638e24..51e8c18 100644 --- a/IPython/html/static/notebook/js/textcell.js +++ b/IPython/html/static/notebook/js/textcell.js @@ -92,27 +92,6 @@ define([ }; - /** - * Bind the DOM evet to cell actions - * Need to be called after TextCell.create_element - * @private - * @method bind_event - */ - TextCell.prototype.bind_events = function () { - Cell.prototype.bind_events.apply(this); - var that = this; - - this.element.dblclick(function () { - if (that.selected === false) { - this.events.trigger('select.Cell', {'cell':that}); - } - var cont = that.unrender(); - if (cont) { - that.focus_editor(); - } - }); - }; - // Cell level actions TextCell.prototype.select = function () {