diff --git a/notebook/static/notebook/js/maintoolbar.js b/notebook/static/notebook/js/maintoolbar.js index e0ef4482b..16bfeffa8 100644 --- a/notebook/static/notebook/js/maintoolbar.js +++ b/notebook/static/notebook/js/maintoolbar.js @@ -80,11 +80,17 @@ define([ .append(multiselect); this.notebook.keyboard_manager.register_events(sel); this.events.on('selected_cell_type_changed.Notebook', function (event, data) { - if ( that.notebook.get_selected_cells_indices().length > 1) { + if (data.editable === false) { + sel.attr('disabled', true); + } else { + sel.removeAttr('disabled'); + } + + if (that.notebook.get_selected_cells_indices().length > 1) { multiselect.show(); sel.val('multiselect'); } else { - multiselect.hide() + multiselect.hide(); if (data.cell_type === 'heading') { sel.val('Markdown'); } else { diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index 8fedb6a6e..176d5e9e4 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -855,11 +855,18 @@ define([ 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} + { + 'cell_type': cell.cell_type, + 'level': cell.level, + 'editable': cell.is_editable() + } ); } else { this.events.trigger('selected_cell_type_changed.Notebook', - {'cell_type':cell.cell_type} + { + 'cell_type': cell.cell_type, + 'editable': cell.is_editable() + } ); } } @@ -1416,7 +1423,7 @@ define([ var i = this.index_or_selected(index); if (this.is_valid_cell_index(i)) { var source_cell = this.get_cell(i); - if (!(source_cell instanceof codecell.CodeCell)) { + if (!(source_cell instanceof codecell.CodeCell) && source_cell.is_editable()) { var target_cell = this.insert_cell_below('code',i); var text = source_cell.get_text(); if (text === source_cell.placeholder) { @@ -1466,7 +1473,7 @@ define([ if (this.is_valid_cell_index(i)) { var source_cell = this.get_cell(i); - if (!(source_cell instanceof textcell.MarkdownCell)) { + if (!(source_cell instanceof textcell.MarkdownCell) && source_cell.is_editable()) { var target_cell = this.insert_cell_below('markdown',i); var text = source_cell.get_text(); @@ -1521,7 +1528,7 @@ define([ var target_cell = null; var source_cell = this.get_cell(i); - if (!(source_cell instanceof textcell.RawCell)) { + if (!(source_cell instanceof textcell.RawCell) && source_cell.is_editable()) { target_cell = this.insert_cell_below('raw',i); var text = source_cell.get_text(); if (text === source_cell.placeholder) {