|
@@ -306,28 +306,11 @@ namespace ToolbarItems {
|
|
|
* A toolbar widget that switches cell types.
|
|
|
*/
|
|
|
class CellTypeSwitcher extends Widget {
|
|
|
- /**
|
|
|
- * Create the node for the cell type switcher.
|
|
|
- */
|
|
|
- static createNode(): HTMLElement {
|
|
|
- let div = document.createElement('div');
|
|
|
- let select = document.createElement('select');
|
|
|
- for (let t of ['Code', 'Markdown', 'Raw']) {
|
|
|
- let option = document.createElement('option');
|
|
|
- option.value = t.toLowerCase();
|
|
|
- option.textContent = t;
|
|
|
- select.appendChild(option);
|
|
|
- }
|
|
|
- select.className = TOOLBAR_CELLTYPE_DROPDOWN;
|
|
|
- div.appendChild(select);
|
|
|
- return div;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Construct a new cell type switcher.
|
|
|
*/
|
|
|
constructor(widget: Notebook) {
|
|
|
- super();
|
|
|
+ super({ node: createCellTypeSwitcherNode() });
|
|
|
this.addClass(TOOLBAR_CELLTYPE);
|
|
|
|
|
|
let select = this.node.firstChild as HTMLSelectElement;
|
|
@@ -393,6 +376,24 @@ class CellTypeSwitcher extends Widget {
|
|
|
}
|
|
|
|
|
|
|
|
|
+/**
|
|
|
+ * Create the node for the cell type switcher.
|
|
|
+ */
|
|
|
+function createCellTypeSwitcherNode(): HTMLElement {
|
|
|
+ let div = document.createElement('div');
|
|
|
+ let select = document.createElement('select');
|
|
|
+ for (let t of ['Code', 'Markdown', 'Raw']) {
|
|
|
+ let option = document.createElement('option');
|
|
|
+ option.value = t.toLowerCase();
|
|
|
+ option.textContent = t;
|
|
|
+ select.appendChild(option);
|
|
|
+ }
|
|
|
+ select.className = TOOLBAR_CELLTYPE_DROPDOWN;
|
|
|
+ div.appendChild(select);
|
|
|
+ return div;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* A toolbar item that displays kernel status.
|
|
|
*/
|