mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-07 13:07:22 +08:00
correct the celltype select box behavior with multiselect
This commit is contained in:
parent
b10a16d378
commit
4a0cfdca6a
@ -89,6 +89,7 @@ define([
|
||||
// encountered when building a toolbar.
|
||||
MainToolBar.prototype._pseudo_actions.add_celltype_list = function () {
|
||||
var that = this;
|
||||
var multiselect = $('<option/>').attr('value','multiselect').attr('disabled','').text('-');
|
||||
var sel = $('<select/>')
|
||||
.attr('id','cell_type')
|
||||
.addClass('form-control select-xs')
|
||||
@ -96,13 +97,19 @@ define([
|
||||
.append($('<option/>').attr('value','markdown').text('Markdown'))
|
||||
.append($('<option/>').attr('value','raw').text('Raw NBConvert'))
|
||||
.append($('<option/>').attr('value','heading').text('Heading'))
|
||||
.append($('<option/>').attr('value','multiselect').text('-'));
|
||||
.append(multiselect);
|
||||
this.notebook.keyboard_manager.register_events(sel);
|
||||
this.events.on('selected_cell_type_changed.Notebook', function (event, data) {
|
||||
if (data.cell_type === 'heading') {
|
||||
sel.val('Markdown');
|
||||
if ( that.notebook.get_selected_cells_indices().length > 1) {
|
||||
multiselect.show();
|
||||
sel.val('multiselect');
|
||||
multiselect.hide();
|
||||
} else {
|
||||
sel.val(data.cell_type);
|
||||
if (data.cell_type === 'heading') {
|
||||
sel.val('Markdown');
|
||||
} else {
|
||||
sel.val(data.cell_type);
|
||||
}
|
||||
}
|
||||
});
|
||||
sel.change(function () {
|
||||
|
@ -709,6 +709,7 @@ define(function (require) {
|
||||
}
|
||||
var cell = this.get_cell(index);
|
||||
cell.select(moveanchor);
|
||||
this.update_soft_selection();
|
||||
if (cell.cell_type === 'heading') {
|
||||
this.events.trigger('selected_cell_type_changed.Notebook',
|
||||
{'cell_type':cell.cell_type,level:cell.level}
|
||||
@ -719,7 +720,6 @@ define(function (require) {
|
||||
);
|
||||
}
|
||||
}
|
||||
this.update_soft_selection();
|
||||
return this;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user