From df418c6a62859db70d56a2e58d77cb721d4c8a2d Mon Sep 17 00:00:00 2001 From: Bussonnier Matthias Date: Tue, 16 Dec 2014 14:04:20 +0100 Subject: [PATCH 1/2] fix restore checkpoint add an empty cell --- IPython/html/static/notebook/js/notebook.js | 23 ++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index 0d9e6f15d..ab41fdebb 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -766,6 +766,27 @@ define([ // Insertion, deletion. + /** + * Delete a cell from the notebook without any precautions + * Needed to reload checkpoints and other things like that. + * + * @param {integer} [index] - cell's numeric index + * @return {Notebook} This notebook + */ + Notebook.prototype.unsafe_delete_cell = function (index) { + var i = this.index_or_selected(index); + var cell = this.get_cell(i); + + $('#undelete_cell').addClass('disabled'); + if (this.is_valid_cell_index(i)) { + var old_ncells = this.ncells(); + var ce = this.get_cell_element(i); + ce.remove(); + this.set_dirty(true); + } + return this; + }; + /** * Delete a cell from the notebook. * @@ -1734,7 +1755,7 @@ define([ var i; for (i=0; i Date: Tue, 16 Dec 2014 18:13:14 +0100 Subject: [PATCH 2/2] make method private --- IPython/html/static/notebook/js/notebook.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index ab41fdebb..94be416de 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -773,7 +773,7 @@ define([ * @param {integer} [index] - cell's numeric index * @return {Notebook} This notebook */ - Notebook.prototype.unsafe_delete_cell = function (index) { + Notebook.prototype._unsafe_delete_cell = function (index) { var i = this.index_or_selected(index); var cell = this.get_cell(i); @@ -1755,7 +1755,7 @@ define([ var i; for (i=0; i