Show More
@@ -615,31 +615,30 var IPython = (function (IPython) { | |||||
615 | * return true if everything whent fine. |
|
615 | * return true if everything whent fine. | |
616 | **/ |
|
616 | **/ | |
617 | Notebook.prototype._insert_element_at_index = function(element, index){ |
|
617 | Notebook.prototype._insert_element_at_index = function(element, index){ | |
|
618 | if (element == undefined){ | |||
|
619 | return false; | |||
|
620 | } | |||
|
621 | ||||
618 | var ncells = this.ncells(); |
|
622 | var ncells = this.ncells(); | |
619 |
|
623 | |||
620 | /// this use to be index < this.undelete_index in some case |
|
624 | if (ncells === 0) { | |
|
625 | // special case append if empty | |||
|
626 | this.element.find('div.end_space').before(element); | |||
|
627 | } else if ( ncells == index ) { | |||
|
628 | // special case append it the end, but not empty | |||
|
629 | this.get_cell_element(index-1).after(element); | |||
|
630 | } else if (this.is_valid_cell_index(index)) { | |||
|
631 | // otherwise always somewhere to append to | |||
|
632 | this.get_cell_element(index).before(element); | |||
|
633 | } else { | |||
|
634 | return false; | |||
|
635 | } | |||
|
636 | ||||
621 | if (this.undelete_index !== null && index <= this.undelete_index) { |
|
637 | if (this.undelete_index !== null && index <= this.undelete_index) { | |
622 | this.undelete_index = this.undelete_index + 1; |
|
638 | this.undelete_index = this.undelete_index + 1; | |
623 | this.dirty = true; |
|
639 | this.dirty = true; | |
624 | } |
|
640 | } | |
625 |
|
641 | return true; | ||
626 | // this should be alway true now |
|
|||
627 | if (ncells === 0 || this.is_valid_cell_index(index) || index== ncells) { |
|
|||
628 | if (element !== null) { |
|
|||
629 | if (ncells === 0) { |
|
|||
630 | // special case append if empty |
|
|||
631 | this.element.find('div.end_space').before(element); |
|
|||
632 | } else if ( ncells == index ) { |
|
|||
633 | // special case append it the end, but not empty |
|
|||
634 | this.get_cell_element(index-1).after(element); |
|
|||
635 | } else if (this.is_valid_cell_index(index)) { |
|
|||
636 | // otherwise always somewhere to append to |
|
|||
637 | this.get_cell_element(index).before(element); |
|
|||
638 | } |
|
|||
639 | return true; |
|
|||
640 | } |
|
|||
641 | } |
|
|||
642 | return false; |
|
|||
643 | }; |
|
642 | }; | |
644 |
|
643 | |||
645 | /** |
|
644 | /** |
General Comments 0
You need to be logged in to leave comments.
Login now