Show More
@@ -731,13 +731,16 b' var IPython = (function (IPython) {' | |||||
731 | /** |
|
731 | /** | |
732 | * Insert a cell so that after insertion the cell is at given index. |
|
732 | * Insert a cell so that after insertion the cell is at given index. | |
733 | * |
|
733 | * | |
|
734 | * If cell type is not provided, it will default to the type of the | |||
|
735 | * currently active cell. | |||
|
736 | * | |||
734 | * Similar to insert_above, but index parameter is mandatory |
|
737 | * Similar to insert_above, but index parameter is mandatory | |
735 | * |
|
738 | * | |
736 |
* Index will be brought back into the acc |
|
739 | * Index will be brought back into the accessible range [0,n] | |
737 | * |
|
740 | * | |
738 | * @method insert_cell_at_index |
|
741 | * @method insert_cell_at_index | |
739 | * @param type {string} in ['code','markdown','heading'] |
|
742 | * @param [type] {string} in ['code','markdown','heading'], defaults to 'code' | |
740 | * @param [index] {int} a valid index where to inser cell |
|
743 | * @param [index] {int} a valid index where to insert cell | |
741 | * |
|
744 | * | |
742 | * @return cell {cell|null} created cell or null |
|
745 | * @return cell {cell|null} created cell or null | |
743 | **/ |
|
746 | **/ | |
@@ -747,6 +750,7 b' var IPython = (function (IPython) {' | |||||
747 | index = Math.min(index,ncells); |
|
750 | index = Math.min(index,ncells); | |
748 | index = Math.max(index,0); |
|
751 | index = Math.max(index,0); | |
749 | var cell = null; |
|
752 | var cell = null; | |
|
753 | type = type || this.get_selected_cell().cell_type; | |||
750 |
|
754 | |||
751 | if (ncells === 0 || this.is_valid_cell_index(index) || index === ncells) { |
|
755 | if (ncells === 0 || this.is_valid_cell_index(index) || index === ncells) { | |
752 | if (type === 'code') { |
|
756 | if (type === 'code') { | |
@@ -819,7 +823,7 b' var IPython = (function (IPython) {' | |||||
819 | * default index value is the one of currently selected cell |
|
823 | * default index value is the one of currently selected cell | |
820 | * |
|
824 | * | |
821 | * @method insert_cell_above |
|
825 | * @method insert_cell_above | |
822 | * @param type {string} cell type |
|
826 | * @param [type] {string} cell type | |
823 | * @param [index] {integer} |
|
827 | * @param [index] {integer} | |
824 | * |
|
828 | * | |
825 | * @return handle to created cell or null |
|
829 | * @return handle to created cell or null | |
@@ -831,12 +835,12 b' var IPython = (function (IPython) {' | |||||
831 |
|
835 | |||
832 | /** |
|
836 | /** | |
833 | * Insert a cell of given type below given index, or at bottom |
|
837 | * Insert a cell of given type below given index, or at bottom | |
834 |
* of notebook if index greater tha |
|
838 | * of notebook if index greater than number of cells | |
835 | * |
|
839 | * | |
836 | * default index value is the one of currently selected cell |
|
840 | * default index value is the one of currently selected cell | |
837 | * |
|
841 | * | |
838 | * @method insert_cell_below |
|
842 | * @method insert_cell_below | |
839 | * @param type {string} cell type |
|
843 | * @param [type] {string} cell type | |
840 | * @param [index] {integer} |
|
844 | * @param [index] {integer} | |
841 | * |
|
845 | * | |
842 | * @return handle to created cell or null |
|
846 | * @return handle to created cell or null |
General Comments 0
You need to be logged in to leave comments.
Login now