Show More
@@ -167,6 +167,13 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 | 179 | // Command mode defaults |
@@ -1053,27 +1053,31 var IPython = (function (IPython) { | |||
|
1053 | 1053 | if (cell.is_splittable()) { |
|
1054 | 1054 | var texta = cell.get_pre_cursor(); |
|
1055 | 1055 | var textb = cell.get_post_cursor(); |
|
1056 | var mode = cell.mode; | |
|
1056 | 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 | 1060 | cell.set_text(textb); |
|
1058 | 1061 | var new_cell = this.insert_cell_above('code'); |
|
1059 | 1062 | new_cell.set_text(texta); |
|
1060 | this.select_next(); | |
|
1061 | } else if (cell instanceof IPython.MarkdownCell) { | |
|
1062 | var render = cell.rendered; | |
|
1063 | } else if (cell instanceof IPython.MarkdownCell && !cell.rendered) { | |
|
1063 | 1064 | cell.set_text(textb); |
|
1064 | 1065 | cell.render(); |
|
1065 | 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 | 1071 | new_cell.set_text(texta); |
|
1068 | 1072 | new_cell.render(); |
|
1069 | this.select_next(); | |
|
1070 | if (!render) { | |
|
1071 | 1073 |
|
|
1072 | 1074 |
|
|
1073 | 1075 |
|
|
1076 | // Each of these involves a CM focus and cell select. | |
|
1074 | 1077 |
|
|
1075 | 1078 |
|
|
1076 | } | |
|
1079 | console.log('setting edit mode...') | |
|
1080 | this.edit_mode(); | |
|
1077 | 1081 | } |
|
1078 | 1082 | }; |
|
1079 | 1083 | }; |
@@ -262,21 +262,6 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 | 266 | * @method at_bottom |
|
282 | 267 | * @return {Boolean} |
General Comments 0
You need to be logged in to leave comments.
Login now