##// END OF EJS Templates
allow splitting and merging of heading cells...
Paul Ivanov -
Show More
@@ -1203,21 +1203,12 define([
1203 1203 if (cell.is_splittable()) {
1204 1204 var texta = cell.get_pre_cursor();
1205 1205 var textb = cell.get_post_cursor();
1206 if (cell instanceof codecell.CodeCell) {
1207 // In this case the operations keep the notebook in its existing mode
1208 // so we don't need to do any post-op mode changes.
1209 cell.set_text(textb);
1210 var new_cell = this.insert_cell_above('code');
1211 new_cell.set_text(texta);
1212 } else if ((cell instanceof mdc && !cell.rendered) || (cell instanceof rc)) {
1213 // We know cell is !rendered so we can use set_text.
1214 1206 cell.set_text(textb);
1215 1207 var new_cell = this.insert_cell_above(cell.cell_type);
1216 1208 // Unrender the new cell so we can call set_text.
1217 1209 new_cell.unrender();
1218 1210 new_cell.set_text(texta);
1219 1211 }
1220 }
1221 1212 };
1222 1213
1223 1214 /**
@@ -1243,7 +1234,7 define([
1243 1234 var text = cell.get_text();
1244 1235 if (cell instanceof codecell.CodeCell) {
1245 1236 cell.set_text(upper_text+'\n'+text);
1246 } else if ((cell instanceof mdc) || (cell instanceof rc)) {
1237 } else {
1247 1238 cell.unrender(); // Must unrender before we set_text.
1248 1239 cell.set_text(upper_text+'\n\n'+text);
1249 1240 if (render) {
@@ -1280,7 +1271,7 define([
1280 1271 var text = cell.get_text();
1281 1272 if (cell instanceof codecell.CodeCell) {
1282 1273 cell.set_text(text+'\n'+lower_text);
1283 } else if ((cell instanceof mdc) || (cell instanceof rc)) {
1274 } else {
1284 1275 cell.unrender(); // Must unrender before we set_text.
1285 1276 cell.set_text(text+'\n\n'+lower_text);
1286 1277 if (render) {
@@ -373,23 +373,6 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 376 * Change heading level of cell, and re-render
394 377 * @method set_level
395 378 */
General Comments 0
You need to be logged in to leave comments. Login now