Show More
@@ -1048,7 +1048,8 b' var IPython = (function (IPython) {' | |||||
1048 | * @method split_cell |
|
1048 | * @method split_cell | |
1049 | */ |
|
1049 | */ | |
1050 | Notebook.prototype.split_cell = function () { |
|
1050 | Notebook.prototype.split_cell = function () { | |
1051 | // Todo: implement spliting for other cell types. |
|
1051 | var mdc = IPython.MarkdownCell; | |
|
1052 | var rc = IPython.RawCell; | |||
1052 | var cell = this.get_selected_cell(); |
|
1053 | var cell = this.get_selected_cell(); | |
1053 | if (cell.is_splittable()) { |
|
1054 | if (cell.is_splittable()) { | |
1054 | var texta = cell.get_pre_cursor(); |
|
1055 | var texta = cell.get_pre_cursor(); | |
@@ -1059,10 +1060,10 b' var IPython = (function (IPython) {' | |||||
1059 | cell.set_text(textb); |
|
1060 | cell.set_text(textb); | |
1060 | var new_cell = this.insert_cell_above('code'); |
|
1061 | var new_cell = this.insert_cell_above('code'); | |
1061 | new_cell.set_text(texta); |
|
1062 | new_cell.set_text(texta); | |
1062 |
} else if (cell instanceof |
|
1063 | } else if (((cell instanceof mdc) || (cell instanceof rc)) && !cell.rendered) { | |
1063 | // We know cell is !rendered so we can use set_text. |
|
1064 | // We know cell is !rendered so we can use set_text. | |
1064 | cell.set_text(textb); |
|
1065 | cell.set_text(textb); | |
1065 |
var new_cell = this.insert_cell_above( |
|
1066 | var new_cell = this.insert_cell_above(cell.cell_type); | |
1066 | // Unrender the new cell so we can call set_text. |
|
1067 | // Unrender the new cell so we can call set_text. | |
1067 | new_cell.unrender(); |
|
1068 | new_cell.unrender(); | |
1068 | new_cell.set_text(texta); |
|
1069 | new_cell.set_text(texta); | |
@@ -1076,6 +1077,8 b' var IPython = (function (IPython) {' | |||||
1076 | * @method merge_cell_above |
|
1077 | * @method merge_cell_above | |
1077 | */ |
|
1078 | */ | |
1078 | Notebook.prototype.merge_cell_above = function () { |
|
1079 | Notebook.prototype.merge_cell_above = function () { | |
|
1080 | var mdc = IPython.MarkdownCell; | |||
|
1081 | var rc = IPython.RawCell; | |||
1079 | var index = this.get_selected_index(); |
|
1082 | var index = this.get_selected_index(); | |
1080 | var cell = this.get_cell(index); |
|
1083 | var cell = this.get_cell(index); | |
1081 | var render = cell.rendered; |
|
1084 | var render = cell.rendered; | |
@@ -1091,7 +1094,7 b' var IPython = (function (IPython) {' | |||||
1091 | var text = cell.get_text(); |
|
1094 | var text = cell.get_text(); | |
1092 | if (cell instanceof IPython.CodeCell) { |
|
1095 | if (cell instanceof IPython.CodeCell) { | |
1093 | cell.set_text(upper_text+'\n'+text); |
|
1096 | cell.set_text(upper_text+'\n'+text); | |
1094 |
} else if (cell instanceof |
|
1097 | } else if ((cell instanceof mdc) || (cell instanceof rc)) { | |
1095 | cell.unrender(); // Must unrender before we set_text. |
|
1098 | cell.unrender(); // Must unrender before we set_text. | |
1096 | cell.set_text(upper_text+'\n\n'+text); |
|
1099 | cell.set_text(upper_text+'\n\n'+text); | |
1097 | if (render) { |
|
1100 | if (render) { | |
@@ -1111,6 +1114,8 b' var IPython = (function (IPython) {' | |||||
1111 | * @method merge_cell_below |
|
1114 | * @method merge_cell_below | |
1112 | */ |
|
1115 | */ | |
1113 | Notebook.prototype.merge_cell_below = function () { |
|
1116 | Notebook.prototype.merge_cell_below = function () { | |
|
1117 | var mdc = IPython.MarkdownCell; | |||
|
1118 | var rc = IPython.RawCell; | |||
1114 | var index = this.get_selected_index(); |
|
1119 | var index = this.get_selected_index(); | |
1115 | var cell = this.get_cell(index); |
|
1120 | var cell = this.get_cell(index); | |
1116 | var render = cell.rendered; |
|
1121 | var render = cell.rendered; | |
@@ -1126,7 +1131,7 b' var IPython = (function (IPython) {' | |||||
1126 | var text = cell.get_text(); |
|
1131 | var text = cell.get_text(); | |
1127 | if (cell instanceof IPython.CodeCell) { |
|
1132 | if (cell instanceof IPython.CodeCell) { | |
1128 | cell.set_text(text+'\n'+lower_text); |
|
1133 | cell.set_text(text+'\n'+lower_text); | |
1129 |
} else if (cell instanceof |
|
1134 | } else if ((cell instanceof mdc) || (cell instanceof rc)) { | |
1130 | cell.unrender(); // Must unrender before we set_text. |
|
1135 | cell.unrender(); // Must unrender before we set_text. | |
1131 | cell.set_text(text+'\n\n'+lower_text); |
|
1136 | cell.set_text(text+'\n\n'+lower_text); | |
1132 | if (render) { |
|
1137 | if (render) { |
General Comments 0
You need to be logged in to leave comments.
Login now