Show More
@@ -167,6 +167,13 b' var IPython = (function (IPython) {' | |||||
167 | }; |
|
167 | }; | |
168 | } |
|
168 | } | |
169 | }, |
|
169 | }, | |
|
170 | 'alt+-' : { | |||
|
171 | help : 'split cell', | |||
|
172 | handler : function (event) { | |||
|
173 | IPython.notebook.split_cell(); | |||
|
174 | return false; | |||
|
175 | } | |||
|
176 | }, | |||
170 | } |
|
177 | } | |
171 |
|
178 | |||
172 | // Command mode defaults |
|
179 | // Command mode defaults |
@@ -1053,27 +1053,31 b' 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; | |||
1056 | if (cell instanceof IPython.CodeCell) { |
|
1057 | if (cell instanceof IPython.CodeCell) { | |
|
1058 | // 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. | |||
1057 | cell.set_text(textb); |
|
1060 | cell.set_text(textb); | |
1058 | var new_cell = this.insert_cell_above('code'); |
|
1061 | var new_cell = this.insert_cell_above('code'); | |
1059 | new_cell.set_text(texta); |
|
1062 | new_cell.set_text(texta); | |
1060 | this.select_next(); |
|
1063 | } else if (cell instanceof IPython.MarkdownCell && !cell.rendered) { | |
1061 | } else if (cell instanceof IPython.MarkdownCell) { |
|
|||
1062 | var render = cell.rendered; |
|
|||
1063 | cell.set_text(textb); |
|
1064 | cell.set_text(textb); | |
1064 | cell.render(); |
|
1065 | cell.render(); | |
1065 | var new_cell = this.insert_cell_above('markdown'); |
|
1066 | var new_cell = this.insert_cell_above('markdown'); | |
1066 |
|
|
1067 | // Editor must be visible to call set_text, so we unrender. | |
|
1068 | // Note that this call will focus the CM editor, which selects | |||
|
1069 | // this cell and enters edit mode. | |||
|
1070 | new_cell.unrender(); | |||
1067 | new_cell.set_text(texta); |
|
1071 | new_cell.set_text(texta); | |
1068 | new_cell.render(); |
|
1072 | new_cell.render(); | |
1069 | this.select_next(); |
|
1073 | // The final rendered state of the split cells should | |
1070 | if (!render) { |
|
1074 | // match the original cell's state. The order matters | |
1071 | // The final rendered state of the split cells should |
|
1075 | // here as we want the lower cell (cell) to be selected. | |
1072 | // match the original cell's state. The order matters |
|
1076 | // Each of these involves a CM focus and cell select. | |
1073 | // here as we want the lower cell (cell) to be selected. |
|
1077 | new_cell.unrender(); | |
1074 |
|
|
1078 | cell.unrender(); | |
1075 | cell.unrender(); |
|
1079 | console.log('setting edit mode...') | |
1076 |
|
|
1080 | this.edit_mode(); | |
1077 | } |
|
1081 | } | |
1078 | }; |
|
1082 | }; | |
1079 | }; |
|
1083 | }; |
@@ -262,21 +262,6 b' var IPython = (function (IPython) {' | |||||
262 | }; |
|
262 | }; | |
263 | }; |
|
263 | }; | |
264 |
|
264 | |||
265 |
|
||||
266 | /** @method at_bottom **/ |
|
|||
267 | TextCell.prototype.at_bottom = function () { |
|
|||
268 | if (this.rendered) { |
|
|||
269 | return true |
|
|||
270 | } else { |
|
|||
271 | var cursor = this.code_mirror.getCursor(); |
|
|||
272 | if (cursor.line === (this.code_mirror.lineCount()-1) && cursor.ch === this.code_mirror.getLine(cursor.line).length) { |
|
|||
273 | return true; |
|
|||
274 | } else { |
|
|||
275 | return false; |
|
|||
276 | }; |
|
|||
277 | }; |
|
|||
278 | }; |
|
|||
279 |
|
||||
280 | /** |
|
265 | /** | |
281 | * @method at_bottom |
|
266 | * @method at_bottom | |
282 | * @return {Boolean} |
|
267 | * @return {Boolean} |
General Comments 0
You need to be logged in to leave comments.
Login now