Show More
@@ -767,6 +767,27 b' define([' | |||||
767 | // Insertion, deletion. |
|
767 | // Insertion, deletion. | |
768 |
|
768 | |||
769 | /** |
|
769 | /** | |
|
770 | * Delete a cell from the notebook without any precautions | |||
|
771 | * Needed to reload checkpoints and other things like that. | |||
|
772 | * | |||
|
773 | * @param {integer} [index] - cell's numeric index | |||
|
774 | * @return {Notebook} This notebook | |||
|
775 | */ | |||
|
776 | Notebook.prototype._unsafe_delete_cell = function (index) { | |||
|
777 | var i = this.index_or_selected(index); | |||
|
778 | var cell = this.get_cell(i); | |||
|
779 | ||||
|
780 | $('#undelete_cell').addClass('disabled'); | |||
|
781 | if (this.is_valid_cell_index(i)) { | |||
|
782 | var old_ncells = this.ncells(); | |||
|
783 | var ce = this.get_cell_element(i); | |||
|
784 | ce.remove(); | |||
|
785 | this.set_dirty(true); | |||
|
786 | } | |||
|
787 | return this; | |||
|
788 | }; | |||
|
789 | ||||
|
790 | /** | |||
770 | * Delete a cell from the notebook. |
|
791 | * Delete a cell from the notebook. | |
771 | * |
|
792 | * | |
772 | * @param {integer} [index] - cell's numeric index |
|
793 | * @param {integer} [index] - cell's numeric index | |
@@ -1734,7 +1755,7 b' define([' | |||||
1734 | var i; |
|
1755 | var i; | |
1735 | for (i=0; i<ncells; i++) { |
|
1756 | for (i=0; i<ncells; i++) { | |
1736 | // Always delete cell 0 as they get renumbered as they are deleted. |
|
1757 | // Always delete cell 0 as they get renumbered as they are deleted. | |
1737 | this.delete_cell(0); |
|
1758 | this._unsafe_delete_cell(0); | |
1738 | } |
|
1759 | } | |
1739 | // Save the metadata and name. |
|
1760 | // Save the metadata and name. | |
1740 | this.metadata = content.metadata; |
|
1761 | this.metadata = content.metadata; |
General Comments 0
You need to be logged in to leave comments.
Login now