mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-15 04:00:34 +08:00
Insert cell above/below and multiple selection
This commit is contained in:
parent
cdd59fd140
commit
46f0cd9c34
@ -675,13 +675,13 @@ define(function (require) {
|
||||
} else {
|
||||
cell.element.removeClass(_SOFT_SELECTION_CLASS);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Notebook.prototype._contract_selection = function(){
|
||||
var i = this.get_selected_index();
|
||||
this.select(i, true);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Programmatically select a cell.
|
||||
@ -1148,7 +1148,9 @@ define(function (require) {
|
||||
* @return {Cell|null} handle to created cell or null
|
||||
*/
|
||||
Notebook.prototype.insert_cell_above = function (type, index) {
|
||||
index = this.index_or_selected(index);
|
||||
if (index === null || index === undefined) {
|
||||
index = Math.min(this.get_selected_index(index), this.get_anchor_index());
|
||||
}
|
||||
return this.insert_cell_at_index(type, index);
|
||||
};
|
||||
|
||||
@ -1161,7 +1163,9 @@ define(function (require) {
|
||||
* @return {Cell|null} handle to created cell or null
|
||||
*/
|
||||
Notebook.prototype.insert_cell_below = function (type, index) {
|
||||
index = this.index_or_selected(index);
|
||||
if (index === null || index === undefined) {
|
||||
index = Math.max(this.get_selected_index(index), this.get_anchor_index());
|
||||
}
|
||||
return this.insert_cell_at_index(type, index+1);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user