Show More
@@ -206,7 +206,7 b' var IPython = (function (IPython) {' | |||
|
206 | 206 | |
|
207 | 207 | |
|
208 | 208 | /** |
|
209 |
* can the cell be split |
|
|
209 | * can the cell be split into two cells | |
|
210 | 210 | * @method is_splittable |
|
211 | 211 | **/ |
|
212 | 212 | Cell.prototype.is_splittable = function () { |
@@ -215,6 +215,15 b' var IPython = (function (IPython) {' | |||
|
215 | 215 | |
|
216 | 216 | |
|
217 | 217 | /** |
|
218 | * can the cell be merged with other cells | |
|
219 | * @method is_mergeable | |
|
220 | **/ | |
|
221 | Cell.prototype.is_mergeable = function () { | |
|
222 | return true; | |
|
223 | }; | |
|
224 | ||
|
225 | ||
|
226 | /** | |
|
218 | 227 | * @return {String} - the text before the cursor |
|
219 | 228 | * @method get_pre_cursor |
|
220 | 229 | **/ |
@@ -1174,8 +1174,14 b' var IPython = (function (IPython) {' | |||
|
1174 | 1174 | Notebook.prototype.merge_cell_above = function () { |
|
1175 | 1175 | var index = this.get_selected_index(); |
|
1176 | 1176 | var cell = this.get_cell(index); |
|
1177 | if (!cell.is_mergeable()) { | |
|
1178 | return; | |
|
1179 | } | |
|
1177 | 1180 | if (index > 0) { |
|
1178 | 1181 | var upper_cell = this.get_cell(index-1); |
|
1182 | if (!upper_cell.is_mergeable()) { | |
|
1183 | return; | |
|
1184 | } | |
|
1179 | 1185 | var upper_text = upper_cell.get_text(); |
|
1180 | 1186 | var text = cell.get_text(); |
|
1181 | 1187 | if (cell instanceof IPython.CodeCell) { |
@@ -1198,8 +1204,14 b' var IPython = (function (IPython) {' | |||
|
1198 | 1204 | Notebook.prototype.merge_cell_below = function () { |
|
1199 | 1205 | var index = this.get_selected_index(); |
|
1200 | 1206 | var cell = this.get_cell(index); |
|
1207 | if (!cell.is_mergeable()) { | |
|
1208 | return; | |
|
1209 | } | |
|
1201 | 1210 | if (index < this.ncells()-1) { |
|
1202 | 1211 | var lower_cell = this.get_cell(index+1); |
|
1212 | if (!lower_cell.is_mergeable()) { | |
|
1213 | return; | |
|
1214 | } | |
|
1203 | 1215 | var lower_text = lower_cell.get_text(); |
|
1204 | 1216 | var text = cell.get_text(); |
|
1205 | 1217 | if (cell instanceof IPython.CodeCell) { |
@@ -482,6 +482,22 b' var IPython = (function (IPython) {' | |||
|
482 | 482 | return data; |
|
483 | 483 | }; |
|
484 | 484 | |
|
485 | /** | |
|
486 | * can the cell be split into two cells | |
|
487 | * @method is_splittable | |
|
488 | **/ | |
|
489 | HeadingCell.prototype.is_splittable = function () { | |
|
490 | return false; | |
|
491 | }; | |
|
492 | ||
|
493 | ||
|
494 | /** | |
|
495 | * can the cell be merged with other cells | |
|
496 | * @method is_mergeable | |
|
497 | **/ | |
|
498 | HeadingCell.prototype.is_mergeable = function () { | |
|
499 | return false; | |
|
500 | }; | |
|
485 | 501 | |
|
486 | 502 | /** |
|
487 | 503 | * Change heading level of cell, and re-render |
General Comments 0
You need to be logged in to leave comments.
Login now