##// END OF EJS Templates
Carefully manage rendered state in merge cell.
Brian E. Granger -
Show More
@@ -1073,6 +1073,7 b' var IPython = (function (IPython) {'
1073 1073 Notebook.prototype.merge_cell_above = function () {
1074 1074 var index = this.get_selected_index();
1075 1075 var cell = this.get_cell(index);
1076 var render = cell.rendered;
1076 1077 if (!cell.is_mergeable()) {
1077 1078 return;
1078 1079 }
@@ -1086,9 +1087,13 b' var IPython = (function (IPython) {'
1086 1087 if (cell instanceof IPython.CodeCell) {
1087 1088 cell.set_text(upper_text+'\n'+text);
1088 1089 } else if (cell instanceof IPython.MarkdownCell) {
1089 cell.unrender();
1090 cell.unrender(); // Must unrender before we set_text.
1090 1091 cell.set_text(upper_text+'\n\n'+text);
1092 if (render) {
1093 // The rendered state of the final cell should match
1094 // that of the original selected cell;
1091 1095 cell.render();
1096 }
1092 1097 };
1093 1098 this.delete_cell(index-1);
1094 1099 this.select(this.find_cell_index(cell));
@@ -1103,6 +1108,7 b' var IPython = (function (IPython) {'
1103 1108 Notebook.prototype.merge_cell_below = function () {
1104 1109 var index = this.get_selected_index();
1105 1110 var cell = this.get_cell(index);
1111 var render = cell.rendered;
1106 1112 if (!cell.is_mergeable()) {
1107 1113 return;
1108 1114 }
@@ -1116,9 +1122,13 b' var IPython = (function (IPython) {'
1116 1122 if (cell instanceof IPython.CodeCell) {
1117 1123 cell.set_text(text+'\n'+lower_text);
1118 1124 } else if (cell instanceof IPython.MarkdownCell) {
1119 cell.unrender();
1125 cell.unrender(); // Must unrender before we set_text.
1120 1126 cell.set_text(text+'\n\n'+lower_text);
1127 if (render) {
1128 // The rendered state of the final cell should match
1129 // that of the original selected cell;
1121 1130 cell.render();
1131 }
1122 1132 };
1123 1133 this.delete_cell(index+1);
1124 1134 this.select(this.find_cell_index(cell));
General Comments 0
You need to be logged in to leave comments. Login now