From 212ad35b6f83389e2faedf96cffafecb0f4ef69f 2014-10-09 10:14:56 From: Matthias BUSSONNIER Date: 2014-10-09 10:14:56 Subject: [PATCH] Generalise render/unrender to all cells type Allow change of behavior in pure (custom) css. --- diff --git a/IPython/html/static/notebook/js/cell.js b/IPython/html/static/notebook/js/cell.js index e695b3e..ac42942 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 2703042..a4a2ba3 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 () {