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