Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Type: IPython Notebook Extension
Name: AddBefore
Description: This extension enables the Add Cell before button (from iPython 1)
Link: readme.md
Icon: icon.png
Main: main.js
Compatibility: 4.x
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions src/jupyter_contrib_nbextensions/nbextensions/addbefore/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
define([
'base/js/namespace',
'jquery',
'require',
'base/js/events',
'base/js/utils',
], function(Jupyter, $, require, events, configmod, utils) {
"use strict";

var load_extension = function() {
Jupyter.toolbar.add_buttons_group([
{
'label' : 'Insert Cell Above',
'icon' : 'fa-arrow-circle-o-up',
'callback': function () {
Jupyter.notebook.insert_cell_above('code');
Jupyter.notebook.select_prev();
Jupyter.notebook.focus_cell();
}
},
{
'label' : 'Insert Cell Below',
'icon' : 'fa-arrow-circle-o-down',
'callback': function () {
Jupyter.notebook.insert_cell_below('code');
Jupyter.notebook.select_next();
Jupyter.notebook.focus_cell();
}
}
]);
$('#insert_above_below').remove()

};



var extension = {
load_jupyter_extension : load_extension,
load_ipython_extension : load_extension
};
return extension;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This extension adds a button to add a empty cell before the currently active cell.
As was present in IPython 1.0.
It is with a circled up arrow.
The plus signed "Add Cell After button" is moved to be next to Add Cell Before,
and given matching circled down arrow icon.

The functionality of the buttons are as per in the Insert Menu,
for Insert Cell Above, and Insert Cell Below.
A empty cell is added, and it takes the cursor focus.