##// END OF EJS Templates
Merge pull request #6225 from ivanov/split-merge-heading-cells...
Thomas Kluyver -
r17458:ba3d5acf merge
parent child Browse files
Show More
@@ -1224,20 +1224,11 b' define(['
1224 if (cell.is_splittable()) {
1224 if (cell.is_splittable()) {
1225 var texta = cell.get_pre_cursor();
1225 var texta = cell.get_pre_cursor();
1226 var textb = cell.get_post_cursor();
1226 var textb = cell.get_post_cursor();
1227 if (cell instanceof codecell.CodeCell) {
1227 cell.set_text(textb);
1228 // In this case the operations keep the notebook in its existing mode
1228 var new_cell = this.insert_cell_above(cell.cell_type);
1229 // so we don't need to do any post-op mode changes.
1229 // Unrender the new cell so we can call set_text.
1230 cell.set_text(textb);
1230 new_cell.unrender();
1231 var new_cell = this.insert_cell_above('code');
1231 new_cell.set_text(texta);
1232 new_cell.set_text(texta);
1233 } else if ((cell instanceof mdc && !cell.rendered) || (cell instanceof rc)) {
1234 // We know cell is !rendered so we can use set_text.
1235 cell.set_text(textb);
1236 var new_cell = this.insert_cell_above(cell.cell_type);
1237 // Unrender the new cell so we can call set_text.
1238 new_cell.unrender();
1239 new_cell.set_text(texta);
1240 }
1241 }
1232 }
1242 };
1233 };
1243
1234
@@ -1264,7 +1255,7 b' define(['
1264 var text = cell.get_text();
1255 var text = cell.get_text();
1265 if (cell instanceof codecell.CodeCell) {
1256 if (cell instanceof codecell.CodeCell) {
1266 cell.set_text(upper_text+'\n'+text);
1257 cell.set_text(upper_text+'\n'+text);
1267 } else if ((cell instanceof mdc) || (cell instanceof rc)) {
1258 } else {
1268 cell.unrender(); // Must unrender before we set_text.
1259 cell.unrender(); // Must unrender before we set_text.
1269 cell.set_text(upper_text+'\n\n'+text);
1260 cell.set_text(upper_text+'\n\n'+text);
1270 if (render) {
1261 if (render) {
@@ -1301,7 +1292,7 b' define(['
1301 var text = cell.get_text();
1292 var text = cell.get_text();
1302 if (cell instanceof codecell.CodeCell) {
1293 if (cell instanceof codecell.CodeCell) {
1303 cell.set_text(text+'\n'+lower_text);
1294 cell.set_text(text+'\n'+lower_text);
1304 } else if ((cell instanceof mdc) || (cell instanceof rc)) {
1295 } else {
1305 cell.unrender(); // Must unrender before we set_text.
1296 cell.unrender(); // Must unrender before we set_text.
1306 cell.set_text(text+'\n\n'+lower_text);
1297 cell.set_text(text+'\n\n'+lower_text);
1307 if (render) {
1298 if (render) {
@@ -373,23 +373,6 b' define(['
373 };
373 };
374
374
375 /**
375 /**
376 * can the cell be split into two cells
377 * @method is_splittable
378 **/
379 HeadingCell.prototype.is_splittable = function () {
380 return false;
381 };
382
383
384 /**
385 * can the cell be merged with other cells
386 * @method is_mergeable
387 **/
388 HeadingCell.prototype.is_mergeable = function () {
389 return false;
390 };
391
392 /**
393 * Change heading level of cell, and re-render
376 * Change heading level of cell, and re-render
394 * @method set_level
377 * @method set_level
395 */
378 */
General Comments 0
You need to be logged in to leave comments. Login now