Refactored multiselect toggles

Safia Abdalla 10 years ago
parent b382950432
commit 068f4e9136

@ -310,30 +310,20 @@ define(function(require){
help : 'toggle output of selected cells',
help_index : 'gb',
handler : function (env) {
var indices = env.notebook.get_selected_cells_indices();
console.log(indices)
for(var i =0; i< indices.length; i++){
env.notebook.toggle_output(indices[i]);
}
env.notebook.toggle_cells_outputs();
}
},
'toggle-cell-output-scrolled' : {
help : 'toggle output scrolling of selected cells',
help_index : 'gc',
handler : function (env) {
var indices = env.notebook.get_selected_cells_indices();
for(var i =0; i< indices.length; i++){
env.notebook.toggle_output_scroll(indices[i]);
}
env.notebook.toggle_cells_outputs_scroll();
}
},
'clear-cell-output' : {
help : 'clear output of selected cells',
handler : function (env) {
var indices = env.notebook.get_selected_cells_indices();
for(var i =0; i< indices.length; i++){
env.notebook.clear_output(indices[i]);
}
env.notebook.clear_cells_outputs();
}
},
'move-cell-down' : {

@ -1600,6 +1600,20 @@ define(function (require) {
}
};
/**
* Clear multiple selected CodeCells' output areas.
*
*/
Notebook.prototype.clear_cells_outputs = function(indices) {
if (!indices) {
var indices = this.get_selected_cells_indices();
}
for (var i = 0; i < indices.length; i++){
this.clear_output(indices[i]);
}
}
/**
* Clear each code cell's output area.
*/
@ -1653,6 +1667,21 @@ define(function (require) {
}
};
/**
* Toggle whether all selected cells' outputs are collapsed or expanded.
*
* @param {integer} indices - the indices of the cells to toggle
*/
Notebook.prototype.toggle_cells_outputs = function(indices) {
if (!indices) {
var indices = this.get_selected_cells_indices();
}
for (var i = 0; i < indices.length; i++){
this.toggle_output(indices[i]);
}
}
/**
* Toggle the output of all cells.
*/
@ -1680,6 +1709,21 @@ define(function (require) {
}
};
/**
* Toggle a scrollbar for selected long cells' outputs.
*
* @param {integer} indices - the indices of the cells to toggle
*/
Notebook.prototype.toggle_cells_outputs_scroll = function(indices) {
if (!indices) {
var indices = this.get_selected_cells_indices();
}
for (var i = 0; i < indices.length; i++){
this.toggle_output_scroll(indices[i]);
}
}
/**
* Toggle the scrolling of long output on all cells.
*/

Loading…
Cancel
Save