Merge pull request #822 from Carreau/merge-below

have shift-m merge below if one cell selected
Min RK 10 years ago
commit bf952c1f86

@ -380,13 +380,25 @@ define(function(require){
env.notebook.merge_cell_below();
}
},
'merge-cells' : {
'merge-selected-cells' : {
help : 'merge selected cells',
help_index: 'el',
handler: function(env) {
env.notebook.merge_selected_cells();
}
},
'merge-cells' : {
help : 'merge selected cells, or current cell with cell below if only one cell selected',
help_index: 'el',
handler: function(env) {
var l = env.notebook.get_selected_cells_indices().length
if(l == 1){
env.notebook.merge_cell_below();
} else {
env.notebook.merge_selected_cells();
}
}
},
'show-command-palette': {
help_index : 'aa',
help: 'open the command palette',

@ -185,14 +185,13 @@ casper.notebook_test(function () {
// shift-m on single selection does nothing.
this.trigger_keydown('shift-m');
this.trigger_keydown('esc');
this.test.assertEquals(this.get_cells_length(), N-1 , 'Merge cell 4 with 5: There are now '+(N-1)+' cells');
this.test.assertEquals(this.get_cells_length(), N-2 , 'Merge cell 4 with 5: There are now '+(N-2)+' cells');
this.test.assertEquals(this.get_cell_text(0), a, 'Merge cell 4 with 5: Cell 0 is unchanged');
this.test.assertEquals(this.get_cell_text(1), b, 'Merge cell 4 with 5: Cell 1 is unchanged');
this.test.assertEquals(this.get_cell_text(2), c, 'Merge cell 4 with 5: Cell 2 is unchanged');
this.test.assertEquals(this.get_cell_text(3), d+'\n\n'+e, 'Merge cell 4 with 5: Cell 3 is unchanged');
this.test.assertEquals(this.get_cell_text(4), f, 'Merge cell 4 with 5: Cell 5 is unchanged');
this.test.assertEquals(this.get_cell_text(5), g, 'Merge cell 4 with 5: Cell 6 is unchanged');
this.validate_notebook_state('merge on single selection does nothing', 'command', 4);
this.test.assertEquals(this.get_cell_text(4), f+'\n\n'+g, 'Merge cell 4 with 5: Cell 4 and 5 are merged');
this.validate_notebook_state('merge on single cell merge with below', 'command', 4);
});

Loading…
Cancel
Save