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