Browse Source

Fix cell type select for multiple cells

Grant Nestor 6 years ago
parent
commit
34b7c47401
1 changed files with 9 additions and 0 deletions
  1. 9 0
      packages/notebook/src/default-toolbar.tsx

+ 9 - 0
packages/notebook/src/default-toolbar.tsx

@@ -278,6 +278,14 @@ export class CellTypeSwitcher extends ReactWidget {
     if (this._notebook.activeCell) {
       value = this._notebook.activeCell.model.type;
     }
+    for (let widget of this._notebook.widgets) {
+      if (this._notebook.isSelectedOrActive(widget)) {
+        if (widget.model.type !== value) {
+          value = '-';
+          break;
+        }
+      }
+    }
     return (
       <HTMLSelect
         className={TOOLBAR_CELLTYPE_DROPDOWN_CLASS}
@@ -286,6 +294,7 @@ export class CellTypeSwitcher extends ReactWidget {
         value={value}
         minimal
       >
+        <option value="-">-</option>
         <option value="code">Code</option>
         <option value="markdown">Markdown</option>
         <option value="raw">Raw</option>