|
|
|
|
@ -89,19 +89,27 @@ 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')
|
|
|
|
|
.append($('<option/>').attr('value','code').text('Code'))
|
|
|
|
|
.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','heading').text('Heading'))
|
|
|
|
|
.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');
|
|
|
|
|
} else {
|
|
|
|
|
sel.val(data.cell_type);
|
|
|
|
|
multiselect.hide()
|
|
|
|
|
if (data.cell_type === 'heading') {
|
|
|
|
|
sel.val('Markdown');
|
|
|
|
|
} else {
|
|
|
|
|
sel.val(data.cell_type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
sel.change(function () {
|
|
|
|
|
@ -121,6 +129,8 @@ define([
|
|
|
|
|
that.notebook.to_heading();
|
|
|
|
|
sel.val('markdown');
|
|
|
|
|
break;
|
|
|
|
|
case 'multiselect':
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
console.log("unrecognized cell type:", cell_type);
|
|
|
|
|
}
|
|
|
|
|
|