Skip to content

Commit fd82b35

Browse files
committed
Refactoring of the notebooks cell management.
* Cell insertion code completely rewritten. We now have two methods rather than 9: insert_cell_above, insert_cell_below. * Renaming methods to be more consistent. * Creating new methods to provide a uniform API. * Minor bug fixes.
1 parent 5281dc6 commit fd82b35

3 files changed

Lines changed: 254 additions & 260 deletions

File tree

‎IPython/frontend/html/notebook/static/js/fulleditwidget.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var IPython = (function (IPython) {
4949

5050

5151
FullEditWidget.prototype.open = function () {
52-
var cell = IPython.notebook.selected_cell();
52+
var cell = IPython.notebook.get_selected_cell();
5353
if (!this.opened && cell instanceof IPython.CodeCell) {
5454
$('#fulledit_widget').show();
5555
$('#main_app').hide();
@@ -75,7 +75,7 @@ var IPython = (function (IPython) {
7575
$('#menubar').show();
7676
$('body').css({overflow : 'hidden'});
7777
var code = this.ace_editor.getSession().getValue();
78-
var cell = IPython.notebook.selected_cell();
78+
var cell = IPython.notebook.get_selected_cell();
7979
cell.set_text(code);
8080
cell.select();
8181
this.opened = false;

‎IPython/frontend/html/notebook/static/js/menubar.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var IPython = (function (IPython) {
2626
select : function (event, ui) {
2727
// The selected cell loses focus when the menu is entered, so we
2828
// re-select it upon selection.
29-
var i = IPython.notebook.selected_index();
29+
var i = IPython.notebook.get_selected_index();
3030
IPython.notebook.select(i);
3131
}
3232
});
@@ -100,10 +100,10 @@ var IPython = (function (IPython) {
100100
});
101101
// Insert
102102
this.element.find('#insert_cell_above').click(function () {
103-
IPython.notebook.insert_code_cell_above();
103+
IPython.notebook.insert_cell_above('code');
104104
});
105105
this.element.find('#insert_cell_below').click(function () {
106-
IPython.notebook.insert_code_cell_below();
106+
IPython.notebook.insert_cell_below('code');
107107
});
108108
// Cell
109109
this.element.find('#full_edit_cell').click(function () {

0 commit comments

Comments
 (0)