##// END OF EJS Templates
Cleanup of cell splitting.
Brian E. Granger -
Show More
@@ -1053,7 +1053,6 var IPython = (function (IPython) {
1053 if (cell.is_splittable()) {
1053 if (cell.is_splittable()) {
1054 var texta = cell.get_pre_cursor();
1054 var texta = cell.get_pre_cursor();
1055 var textb = cell.get_post_cursor();
1055 var textb = cell.get_post_cursor();
1056 var mode = cell.mode;
1057 if (cell instanceof IPython.CodeCell) {
1056 if (cell instanceof IPython.CodeCell) {
1058 // In this case the operations keep the notebook in its existing mode
1057 // In this case the operations keep the notebook in its existing mode
1059 // so we don't need to do any post-op mode changes.
1058 // so we don't need to do any post-op mode changes.
@@ -1061,23 +1060,12 var IPython = (function (IPython) {
1061 var new_cell = this.insert_cell_above('code');
1060 var new_cell = this.insert_cell_above('code');
1062 new_cell.set_text(texta);
1061 new_cell.set_text(texta);
1063 } else if (cell instanceof IPython.MarkdownCell && !cell.rendered) {
1062 } else if (cell instanceof IPython.MarkdownCell && !cell.rendered) {
1063 // We know cell is !rendered so we can use set_text.
1064 cell.set_text(textb);
1064 cell.set_text(textb);
1065 cell.render();
1066 var new_cell = this.insert_cell_above('markdown');
1065 var new_cell = this.insert_cell_above('markdown');
1067 // Editor must be visible to call set_text, so we unrender.
1066 // Unrender the new cell so we can call set_text.
1068 // Note that this call will focus the CM editor, which selects
1069 // this cell and enters edit mode.
1070 new_cell.unrender();
1071 new_cell.set_text(texta);
1072 new_cell.render();
1073 // The final rendered state of the split cells should
1074 // match the original cell's state. The order matters
1075 // here as we want the lower cell (cell) to be selected.
1076 // Each of these involves a CM focus and cell select.
1077 new_cell.unrender();
1067 new_cell.unrender();
1078 cell.unrender();
1068 new_cell.set_text(texta);
1079 console.log('setting edit mode...')
1080 this.edit_mode();
1081 }
1069 }
1082 };
1070 };
1083 };
1071 };
General Comments 0
You need to be logged in to leave comments. Login now