@jupyterlab/notebook 0.17.2 → 0.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/widget.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../../notebook/src/widget.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D,mDAAqD;AAMrD,mDAA+C;AAE/C,qDAAwD;AAExD,mDAAsD;AAEtD,iDAAsD;AAEtD,+CAAwD;AAExD,qDAAqD;AAErD,6CAS2B;AAE3B,uDAA4E;AAU5E;;GAEG;AACH,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,GAAG,UAAU,CAAC;AAE1B;;GAEG;AACH,MAAM,QAAQ,GAAG,aAAa,CAAC;AAE/B;;GAEG;AACH,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAEzC;;GAEG;AACH,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAErC;;GAEG;AACH,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE3C;;GAEG;AACH,MAAM,YAAY,GAAG,eAAe,CAAC;AAErC;;GAEG;AACH,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAEzC;;GAEG;AACH,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAEpD;;GAEG;AACH,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAE7C;;GAEG;AACH,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;GAEG;AACH,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;GAEG;AACH,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AAE5D;;GAEG;AACH,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAEvD;;GAEG;A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E,SAAS,EAAE,uBAAuB,EAAE,EAAE,WAAW,CAAC,CAC5D,CACF,CACF,CAAC;aACH;iBAAM;gBACL,OAAO,uBAAU,CAAC,OAAO,CACvB,cAAC,CAAC,GAAG,CACH,cAAC,CAAC,GAAG,CACH,EAAE,SAAS,EAAE,GAAG,gBAAgB,IAAI,uBAAuB,EAAE,EAAE,EAC/D,cAAC,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,CAAC,EAC7C,cAAC,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,EAAE,WAAW,CAAC,CAC5D,CACF,CACF,CAAC;aACH;SACF;IACH,CAAC;IA1De,uBAAe,kBA0D9B,CAAA;IAED;;;;;OAKG;IACH,gCAAuC,OAA0B;QAC/D,IAAI,OAAO,CAAC,cAAc,EAAE;YAC1B,OAAO,OAAO,CAAC;SAChB;aAAM;YACL,OAAO;gBACL,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;gBAC9C,cAAc,EAAE,QAAQ,CAAC,qBAAqB;gBAC9C,eAAe,EAAE,OAAO,CAAC,eAAe;aACzC,CAAC;SACH;IACH,CAAC;IAXe,8BAAsB,yBAWrC,CAAA;AACH,CAAC,EA1GS,OAAO,KAAP,OAAO,QA0GhB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt, each } from '@phosphor/algorithm';\n\nimport { JSONValue } from '@phosphor/coreutils';\n\nimport { Message } from '@phosphor/messaging';\n\nimport { MimeData } from '@phosphor/coreutils';\n\nimport { AttachedProperty } from '@phosphor/properties';\n\nimport { ISignal, Signal } from '@phosphor/signaling';\n\nimport { Drag, IDragEvent } from '@phosphor/dragdrop';\n\nimport { PanelLayout, Widget } from '@phosphor/widgets';\n\nimport { h, VirtualDOM } from '@phosphor/virtualdom';\n\nimport {\n ICellModel,\n Cell,\n IMarkdownCellModel,\n CodeCell,\n MarkdownCell,\n ICodeCellModel,\n RawCell,\n IRawCellModel\n} from '@jupyterlab/cells';\n\nimport { IEditorMimeTypeService, CodeEditor } from '@jupyterlab/codeeditor';\n\nimport { IChangedArgs, nbformat } from '@jupyterlab/coreutils';\n\nimport { IObservableMap, IObservableList } from '@jupyterlab/observables';\n\nimport { RenderMimeRegistry } from '@jupyterlab/rendermime';\n\nimport { INotebookModel } from './model';\n\n/**\n * The data attribute added to a widget that has an active kernel.\n */\nconst KERNEL_USER = 'jpKernelUser';\n\n/**\n * The data attribute added to a widget that can run code.\n */\nconst CODE_RUNNER = 'jpCodeRunner';\n\n/**\n * The data attribute added to a widget that can undo.\n */\nconst UNDOER = 'jpUndoer';\n\n/**\n * The class name added to notebook widgets.\n */\nconst NB_CLASS = 'jp-Notebook';\n\n/**\n * The class name added to notebook widget cells.\n */\nconst NB_CELL_CLASS = 'jp-Notebook-cell';\n\n/**\n * The class name added to a notebook in edit mode.\n */\nconst EDIT_CLASS = 'jp-mod-editMode';\n\n/**\n * The class name added to a notebook in command mode.\n */\nconst COMMAND_CLASS = 'jp-mod-commandMode';\n\n/**\n * The class name added to the active cell.\n */\nconst ACTIVE_CLASS = 'jp-mod-active';\n\n/**\n * The class name added to selected cells.\n */\nconst SELECTED_CLASS = 'jp-mod-selected';\n\n/**\n * The class name added to an active cell when there are other selected cells.\n */\nconst OTHER_SELECTED_CLASS = 'jp-mod-multiSelected';\n\n/**\n * The class name added to unconfined images.\n */\nconst UNCONFINED_CLASS = 'jp-mod-unconfined';\n\n/**\n * The class name added to a drop target.\n */\nconst DROP_TARGET_CLASS = 'jp-mod-dropTarget';\n\n/**\n * The class name added to a drop source.\n */\nconst DROP_SOURCE_CLASS = 'jp-mod-dropSource';\n\n/**\n * The class name added to drag images.\n */\nconst DRAG_IMAGE_CLASS = 'jp-dragImage';\n\n/**\n * The class name added to singular drag images\n */\nconst SINGLE_DRAG_IMAGE_CLASS = 'jp-dragImage-singlePrompt';\n\n/**\n * The class name added to the drag image cell content.\n */\nconst CELL_DRAG_CONTENT_CLASS = 'jp-dragImage-content';\n\n/**\n * The class name added to the drag image cell content.\n */\nconst CELL_DRAG_PROMPT_CLASS = 'jp-dragImage-prompt';\n\n/**\n * The class name added to the drag image cell content.\n */\nconst CELL_DRAG_MULTIPLE_BACK = 'jp-dragImage-multipleBack';\n\n/**\n * The mimetype used for Jupyter cell data.\n */\nconst JUPYTER_CELL_MIME = 'application/vnd.jupyter.cells';\n\n/**\n * The threshold in pixels to start a drag event.\n */\nconst DRAG_THRESHOLD = 5;\n\n/**\n * The interactivity modes for the notebook.\n */\nexport type NotebookMode = 'command' | 'edit';\n\n/**\n * A widget which renders static non-interactive notebooks.\n *\n * #### Notes\n * The widget model must be set separately and can be changed\n * at any time. Consumers of the widget must account for a\n * `null` model, and may want to listen to the `modelChanged`\n * signal.\n */\nexport class StaticNotebook extends Widget {\n /**\n * Construct a notebook widget.\n */\n constructor(options: StaticNotebook.IOptions) {\n super();\n this.addClass(NB_CLASS);\n this.node.dataset[KERNEL_USER] = 'true';\n this.node.dataset[UNDOER] = 'true';\n this.rendermime = options.rendermime;\n this.layout = new Private.NotebookPanelLayout();\n this.contentFactory =\n options.contentFactory || StaticNotebook.defaultContentFactory;\n this.editorConfig =\n options.editorConfig || StaticNotebook.defaultEditorConfig;\n this._mimetypeService = options.mimeTypeService;\n }\n\n /**\n * A signal emitted when the model of the notebook changes.\n */\n get modelChanged(): ISignal<this, void> {\n return this._modelChanged;\n }\n\n /**\n * A signal emitted when the model content changes.\n *\n * #### Notes\n * This is a convenience signal that follows the current model.\n */\n get modelContentChanged(): ISignal<this, void> {\n return this._modelContentChanged;\n }\n\n /**\n * The cell factory used by the widget.\n */\n readonly contentFactory: StaticNotebook.IContentFactory;\n\n /**\n * The Rendermime instance used by the widget.\n */\n readonly rendermime: RenderMimeRegistry;\n\n /**\n * The model for the widget.\n */\n get model(): INotebookModel {\n return this._model;\n }\n set model(newValue: INotebookModel) {\n newValue = newValue || null;\n if (this._model === newValue) {\n return;\n }\n let oldValue = this._model;\n this._model = newValue;\n\n if (oldValue && oldValue.modelDB.isCollaborative) {\n oldValue.modelDB.connected.then(() => {\n oldValue.modelDB.collaborators.changed.disconnect(\n this._onCollaboratorsChanged,\n this\n );\n });\n }\n if (newValue && newValue.modelDB.isCollaborative) {\n newValue.modelDB.connected.then(() => {\n newValue.modelDB.collaborators.changed.connect(\n this._onCollaboratorsChanged,\n this\n );\n });\n }\n\n // Trigger private, protected, and public changes.\n this._onModelChanged(oldValue, newValue);\n this.onModelChanged(oldValue, newValue);\n this._modelChanged.emit(void 0);\n }\n\n /**\n * Get the mimetype for code cells.\n */\n get codeMimetype(): string {\n return this._mimetype;\n }\n\n /**\n * A read-only sequence of the widgets in the notebook.\n */\n get widgets(): ReadonlyArray<Cell> {\n return (this.layout as PanelLayout).widgets as ReadonlyArray<Cell>;\n }\n\n /**\n * A configuration object for cell editor settings.\n */\n get editorConfig(): StaticNotebook.IEditorConfig {\n return this._editorConfig;\n }\n set editorConfig(value: StaticNotebook.IEditorConfig) {\n this._editorConfig = value;\n this._updateEditorConfig();\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose() {\n // Do nothing if already disposed.\n if (this.isDisposed) {\n return;\n }\n this._model = null;\n super.dispose();\n }\n\n /**\n * Handle a new model.\n *\n * #### Notes\n * This method is called after the model change has been handled\n * internally and before the `modelChanged` signal is emitted.\n * The default implementation is a no-op.\n */\n protected onModelChanged(\n oldValue: INotebookModel,\n newValue: INotebookModel\n ): void {\n // No-op.\n }\n\n /**\n * Handle changes to the notebook model content.\n *\n * #### Notes\n * The default implementation emits the `modelContentChanged` signal.\n */\n protected onModelContentChanged(model: INotebookModel, args: void): void {\n this._modelContentChanged.emit(void 0);\n }\n\n /**\n * Handle changes to the notebook model metadata.\n *\n * #### Notes\n * The default implementation updates the mimetypes of the code cells\n * when the `language_info` metadata changes.\n */\n protected onMetadataChanged(\n sender: IObservableMap<JSONValue>,\n args: IObservableMap.IChangedArgs<JSONValue>\n ): void {\n switch (args.key) {\n case 'language_info':\n this._updateMimetype();\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle a cell being inserted.\n *\n * The default implementation is a no-op\n */\n protected onCellInserted(index: number, cell: Cell): void {\n // This is a no-op.\n }\n\n /**\n * Handle a cell being moved.\n *\n * The default implementation is a no-op\n */\n protected onCellMoved(fromIndex: number, toIndex: number): void {\n // This is a no-op.\n }\n\n /**\n * Handle a cell being removed.\n *\n * The default implementation is a no-op\n */\n protected onCellRemoved(index: number, cell: Cell): void {\n // This is a no-op.\n }\n\n /**\n * Handle a new model on the widget.\n */\n private _onModelChanged(\n oldValue: INotebookModel,\n newValue: INotebookModel\n ): void {\n let layout = this.layout as PanelLayout;\n if (oldValue) {\n oldValue.cells.changed.disconnect(this._onCellsChanged, this);\n oldValue.metadata.changed.disconnect(this.onMetadataChanged, this);\n oldValue.contentChanged.disconnect(this.onModelContentChanged, this);\n // TODO: reuse existing cell widgets if possible. Remember to initially\n // clear the history of each cell if we do this.\n while (layout.widgets.length) {\n this._removeCell(0);\n }\n }\n if (!newValue) {\n this._mimetype = 'text/plain';\n return;\n }\n this._updateMimetype();\n let cells = newValue.cells;\n each(cells, (cell: ICellModel, i: number) => {\n this._insertCell(i, cell);\n });\n cells.changed.connect(this._onCellsChanged, this);\n newValue.contentChanged.connect(this.onModelContentChanged, this);\n newValue.metadata.changed.connect(this.onMetadataChanged, this);\n }\n\n /**\n * Handle a change cells event.\n */\n private _onCellsChanged(\n sender: IObservableList<ICellModel>,\n args: IObservableList.IChangedArgs<ICellModel>\n ) {\n let index = 0;\n switch (args.type) {\n case 'add':\n index = args.newIndex;\n each(args.newValues, value => {\n this._insertCell(index++, value);\n });\n break;\n case 'move':\n this._moveCell(args.oldIndex, args.newIndex);\n break;\n case 'remove':\n each(args.oldValues, value => {\n this._removeCell(args.oldIndex);\n });\n break;\n case 'set':\n // TODO: reuse existing widgets if possible.\n index = args.newIndex;\n each(args.newValues, value => {\n // Note: this ordering (insert then remove)\n // is important for getting the active cell\n // index for the editable notebook correct.\n this._insertCell(index, value);\n this._removeCell(index + 1);\n index++;\n });\n break;\n default:\n return;\n }\n }\n\n /**\n * Create a cell widget and insert into the notebook.\n */\n private _insertCell(index: number, cell: ICellModel): void {\n let widget: Cell;\n switch (cell.type) {\n case 'code':\n widget = this._createCodeCell(cell as ICodeCellModel);\n widget.model.mimeType = this._mimetype;\n break;\n case 'markdown':\n widget = this._createMarkdownCell(cell as IMarkdownCellModel);\n break;\n default:\n widget = this._createRawCell(cell as IRawCellModel);\n }\n widget.addClass(NB_CELL_CLASS);\n let layout = this.layout as PanelLayout;\n layout.insertWidget(index, widget);\n this.onCellInserted(index, widget);\n }\n\n /**\n * Create a code cell widget from a code cell model.\n */\n private _createCodeCell(model: ICodeCellModel): CodeCell {\n let rendermime = this.rendermime;\n let contentFactory = this.contentFactory;\n const editorConfig = this.editorConfig.code;\n let options = { editorConfig, model, rendermime, contentFactory };\n return this.contentFactory.createCodeCell(options, this);\n }\n\n /**\n * Create a markdown cell widget from a markdown cell model.\n */\n private _createMarkdownCell(model: IMarkdownCellModel): MarkdownCell {\n let rendermime = this.rendermime;\n let contentFactory = this.contentFactory;\n const editorConfig = this.editorConfig.markdown;\n let options = { editorConfig, model, rendermime, contentFactory };\n return this.contentFactory.createMarkdownCell(options, this);\n }\n\n /**\n * Create a raw cell widget from a raw cell model.\n */\n private _createRawCell(model: IRawCellModel): RawCell {\n let contentFactory = this.contentFactory;\n const editorConfig = this.editorConfig.raw;\n let options = { editorConfig, model, contentFactory };\n return this.contentFactory.createRawCell(options, this);\n }\n\n /**\n * Move a cell widget.\n */\n private _moveCell(fromIndex: number, toIndex: number): void {\n let layout = this.layout as PanelLayout;\n layout.insertWidget(toIndex, layout.widgets[fromIndex]);\n this.onCellMoved(fromIndex, toIndex);\n }\n\n /**\n * Remove a cell widget.\n */\n private _removeCell(index: number): void {\n let layout = this.layout as PanelLayout;\n let widget = layout.widgets[index] as Cell;\n widget.parent = null;\n this.onCellRemoved(index, widget);\n widget.dispose();\n }\n\n /**\n * Update the mimetype of the notebook.\n */\n private _updateMimetype(): void {\n let info = this._model.metadata.get(\n 'language_info'\n ) as nbformat.ILanguageInfoMetadata;\n if (!info) {\n return;\n }\n this._mimetype = this._mimetypeService.getMimeTypeByLanguage(info);\n each(this.widgets, widget => {\n if (widget.model.type === 'code') {\n widget.model.mimeType = this._mimetype;\n }\n });\n }\n\n /**\n * Handle an update to the collaborators.\n */\n private _onCollaboratorsChanged(): void {\n // If there are selections corresponding to non-collaborators,\n // they are stale and should be removed.\n for (let i = 0; i < this.widgets.length; i++) {\n let cell = this.widgets[i];\n for (let key of cell.model.selections.keys()) {\n if (!this._model.modelDB.collaborators.has(key)) {\n cell.model.selections.delete(key);\n }\n }\n }\n }\n\n /**\n * Update editor settings for notebook cells.\n */\n private _updateEditorConfig() {\n for (let i = 0; i < this.widgets.length; i++) {\n const cell = this.widgets[i];\n let config: Partial<CodeEditor.IConfig>;\n switch (cell.model.type) {\n case 'code':\n config = this._editorConfig.code;\n break;\n case 'markdown':\n config = this._editorConfig.markdown;\n break;\n default:\n config = this._editorConfig.raw;\n break;\n }\n Object.keys(config).forEach((key: keyof CodeEditor.IConfig) => {\n cell.editor.setOption(key, config[key]);\n });\n }\n }\n\n private _editorConfig = StaticNotebook.defaultEditorConfig;\n private _mimetype = 'text/plain';\n private _model: INotebookModel = null;\n private _mimetypeService: IEditorMimeTypeService;\n private _modelChanged = new Signal<this, void>(this);\n private _modelContentChanged = new Signal<this, void>(this);\n}\n\n/**\n * The namespace for the `StaticNotebook` class statics.\n */\nexport namespace StaticNotebook {\n /**\n * An options object for initializing a static notebook.\n */\n export interface IOptions {\n /**\n * The rendermime instance used by the widget.\n */\n rendermime: RenderMimeRegistry;\n\n /**\n * The language preference for the model.\n */\n languagePreference?: string;\n\n /**\n * A factory for creating content.\n */\n contentFactory?: IContentFactory;\n\n /**\n * A configuration object for the cell editor settings.\n */\n editorConfig?: IEditorConfig;\n\n /**\n * The service used to look up mime types.\n */\n mimeTypeService: IEditorMimeTypeService;\n }\n\n /**\n * A factory for creating notebook content.\n *\n * #### Notes\n * This extends the content factory of the cell itself, which extends the content\n * factory of the output area and input area. The result is that there is a single\n * factory for creating all child content of a notebook.\n */\n export interface IContentFactory extends Cell.IContentFactory {\n /**\n * Create a new code cell widget.\n */\n createCodeCell(\n options: CodeCell.IOptions,\n parent: StaticNotebook\n ): CodeCell;\n\n /**\n * Create a new markdown cell widget.\n */\n createMarkdownCell(\n options: MarkdownCell.IOptions,\n parent: StaticNotebook\n ): MarkdownCell;\n\n /**\n * Create a new raw cell widget.\n */\n createRawCell(options: RawCell.IOptions, parent: StaticNotebook): RawCell;\n }\n\n /**\n * A config object for the cell editors.\n */\n export interface IEditorConfig {\n /**\n * Config options for code cells.\n */\n readonly code: Partial<CodeEditor.IConfig>;\n /**\n * Config options for markdown cells.\n */\n readonly markdown: Partial<CodeEditor.IConfig>;\n /**\n * Config options for raw cells.\n */\n readonly raw: Partial<CodeEditor.IConfig>;\n }\n\n /**\n * Default configuration options for cell editors.\n */\n export const defaultEditorConfig: IEditorConfig = {\n code: {\n ...CodeEditor.defaultConfig,\n lineWrap: 'off',\n matchBrackets: true,\n autoClosingBrackets: true\n },\n markdown: {\n ...CodeEditor.defaultConfig,\n lineWrap: 'on',\n matchBrackets: false,\n autoClosingBrackets: false\n },\n raw: {\n ...CodeEditor.defaultConfig,\n lineWrap: 'on',\n matchBrackets: false,\n autoClosingBrackets: false\n }\n };\n\n /**\n * The default implementation of an `IContentFactory`.\n */\n export class ContentFactory extends Cell.ContentFactory\n implements IContentFactory {\n /**\n * Create a new code cell widget.\n *\n * #### Notes\n * If no cell content factory is passed in with the options, the one on the\n * notebook content factory is used.\n */\n createCodeCell(\n options: CodeCell.IOptions,\n parent: StaticNotebook\n ): CodeCell {\n if (!options.contentFactory) {\n options.contentFactory = this;\n }\n return new CodeCell(options);\n }\n\n /**\n * Create a new markdown cell widget.\n *\n * #### Notes\n * If no cell content factory is passed in with the options, the one on the\n * notebook content factory is used.\n */\n createMarkdownCell(\n options: MarkdownCell.IOptions,\n parent: StaticNotebook\n ): MarkdownCell {\n if (!options.contentFactory) {\n options.contentFactory = this;\n }\n return new MarkdownCell(options);\n }\n\n /**\n * Create a new raw cell widget.\n *\n * #### Notes\n * If no cell content factory is passed in with the options, the one on the\n * notebook content factory is used.\n */\n createRawCell(options: RawCell.IOptions, parent: StaticNotebook): RawCell {\n if (!options.contentFactory) {\n options.contentFactory = this;\n }\n return new RawCell(options);\n }\n }\n\n /**\n * A namespace for the staic notebook content factory.\n */\n export namespace ContentFactory {\n /**\n * Options for the content factory.\n */\n export interface IOptions extends Cell.ContentFactory.IOptions {}\n }\n\n /**\n * Default content factory for the static notebook widget.\n */\n export const defaultContentFactory: IContentFactory = new ContentFactory();\n}\n\n/**\n * A notebook widget that supports interactivity.\n */\nexport class Notebook extends StaticNotebook {\n /**\n * Construct a notebook widget.\n */\n constructor(options: Notebook.IOptions) {\n super(Private.processNotebookOptions(options));\n this.node.tabIndex = -1; // Allow the widget to take focus.\n // Allow the node to scroll while dragging items.\n this.node.setAttribute('data-p-dragscroll', 'true');\n }\n\n /**\n * A signal emitted when the active cell changes.\n *\n * #### Notes\n * This can be due to the active index changing or the\n * cell at the active index changing.\n */\n get activeCellChanged(): ISignal<this, Cell> {\n return this._activeCellChanged;\n }\n\n /**\n * A signal emitted when the state of the notebook changes.\n */\n get stateChanged(): ISignal<this, IChangedArgs<any>> {\n return this._stateChanged;\n }\n\n /**\n * A signal emitted when the selection state of the notebook changes.\n */\n get selectionChanged(): ISignal<this, void> {\n return this._selectionChanged;\n }\n\n /**\n * The interactivity mode of the notebook.\n */\n get mode(): NotebookMode {\n return this._mode;\n }\n set mode(newValue: NotebookMode) {\n let activeCell = this.activeCell;\n if (!activeCell) {\n newValue = 'command';\n }\n if (newValue === this._mode) {\n this._ensureFocus();\n return;\n }\n // Post an update request.\n this.update();\n let oldValue = this._mode;\n this._mode = newValue;\n\n if (newValue === 'edit') {\n // Edit mode deselects all cells.\n each(this.widgets, widget => {\n this.deselect(widget);\n });\n // Edit mode unrenders an active markdown widget.\n if (activeCell instanceof MarkdownCell) {\n activeCell.rendered = false;\n }\n activeCell.inputHidden = false;\n } else {\n // Focus on the notebook document, which blurs the active cell.\n this.node.focus();\n }\n this._stateChanged.emit({ name: 'mode', oldValue, newValue });\n this._ensureFocus();\n }\n\n /**\n * The active cell index of the notebook.\n *\n * #### Notes\n * The index will be clamped to the bounds of the notebook cells.\n */\n get activeCellIndex(): number {\n if (!this.model) {\n return -1;\n }\n return this.model.cells.length ? this._activeCellIndex : -1;\n }\n set activeCellIndex(newValue: number) {\n let oldValue = this._activeCellIndex;\n if (!this.model || !this.model.cells.length) {\n newValue = -1;\n } else {\n newValue = Math.max(newValue, 0);\n newValue = Math.min(newValue, this.model.cells.length - 1);\n }\n\n this._activeCellIndex = newValue;\n let cell = this.widgets[newValue];\n if (cell !== this._activeCell) {\n // Post an update request.\n this.update();\n this._activeCell = cell;\n this._activeCellChanged.emit(cell);\n }\n if (this.mode === 'edit' && cell instanceof MarkdownCell) {\n cell.rendered = false;\n }\n this._ensureFocus();\n if (newValue === oldValue) {\n return;\n }\n this._trimSelections();\n this._stateChanged.emit({ name: 'activeCellIndex', oldValue, newValue });\n }\n\n /**\n * Get the active cell widget.\n *\n * #### Notes\n * This is a cell or undefined if there is no active cell.\n */\n get activeCell(): Cell | undefined {\n return this._activeCell;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._activeCell = undefined;\n super.dispose();\n }\n\n /**\n * Select a cell widget.\n *\n * #### Notes\n * It is a no-op if the value does not change.\n * It will emit the `selectionChanged` signal.\n */\n select(widget: Cell): void {\n if (Private.selectedProperty.get(widget)) {\n return;\n }\n Private.selectedProperty.set(widget, true);\n this._selectionChanged.emit(void 0);\n this.update();\n }\n\n /**\n * Deselect a cell widget.\n *\n * #### Notes\n * It is a no-op if the value does not change.\n * It will emit the `selectionChanged` signal.\n */\n deselect(widget: Cell): void {\n if (!Private.selectedProperty.get(widget)) {\n return;\n }\n Private.selectedProperty.set(widget, false);\n this._selectionChanged.emit(void 0);\n this.update();\n }\n\n /**\n * Whether a cell is selected.\n */\n isSelected(widget: Cell): boolean {\n return Private.selectedProperty.get(widget);\n }\n\n /**\n * Whether a cell is selected or is the active cell.\n */\n isSelectedOrActive(widget: Cell): boolean {\n if (widget === this._activeCell) {\n return true;\n }\n return Private.selectedProperty.get(widget);\n }\n\n /**\n * Deselect all of the cells.\n */\n deselectAll(): void {\n let changed = false;\n each(this.widgets, widget => {\n if (Private.selectedProperty.get(widget)) {\n changed = true;\n }\n Private.selectedProperty.set(widget, false);\n });\n if (changed) {\n this._selectionChanged.emit(void 0);\n }\n // Make sure we have a valid active cell.\n this.activeCellIndex = this.activeCellIndex;\n this.update();\n }\n\n /**\n * Move the head of an existing contiguous selection to extend the selection.\n *\n * @param index - The new head of the existing selection.\n *\n * #### Notes\n * If there is no existing selection, the active cell is considered an\n * existing one-cell selection.\n *\n * If the new selection is a single cell, that cell becomes the active cell\n * and all cells are deselected.\n *\n * There is no change if there are no cells (i.e., activeCellIndex is -1).\n */\n extendContiguousSelectionTo(index: number): void {\n let { head, anchor } = this.getContiguousSelection();\n let i: number;\n\n // Handle the case of no current selection.\n if (anchor === null) {\n if (index === this.activeCellIndex) {\n // Already collapsed selection, nothing more to do.\n return;\n }\n\n // We will start a new selection below.\n head = this.activeCellIndex;\n anchor = this.activeCellIndex;\n }\n\n // Move the active cell. We do this before the collapsing shortcut below.\n this.activeCellIndex = index;\n\n // Make sure the index is valid, according to the rules for setting and clipping the\n // active cell index. This may change the index.\n index = this.activeCellIndex;\n\n // Collapse the selection if it is only the active cell.\n if (index === anchor) {\n this.deselectAll();\n return;\n }\n\n let selectionChanged = false;\n\n if (head < index) {\n if (head < anchor) {\n Private.selectedProperty.set(this.widgets[head], false);\n selectionChanged = true;\n }\n\n // Toggle everything strictly between head and index except anchor.\n for (i = head + 1; i < index; i++) {\n if (i !== anchor) {\n Private.selectedProperty.set(\n this.widgets[i],\n !Private.selectedProperty.get(this.widgets[i])\n );\n selectionChanged = true;\n }\n }\n } else if (index < head) {\n if (anchor < head) {\n Private.selectedProperty.set(this.widgets[head], false);\n selectionChanged = true;\n }\n\n // Toggle everything strictly between index and head except anchor.\n for (i = index + 1; i < head; i++) {\n if (i !== anchor) {\n Private.selectedProperty.set(\n this.widgets[i],\n !Private.selectedProperty.get(this.widgets[i])\n );\n selectionChanged = true;\n }\n }\n }\n\n // Anchor and index should *always* be selected.\n if (!Private.selectedProperty.get(this.widgets[anchor])) {\n selectionChanged = true;\n }\n Private.selectedProperty.set(this.widgets[anchor], true);\n\n if (!Private.selectedProperty.get(this.widgets[index])) {\n selectionChanged = true;\n }\n Private.selectedProperty.set(this.widgets[index], true);\n\n if (selectionChanged) {\n this._selectionChanged.emit(void 0);\n }\n }\n\n /**\n * Get the head and anchor of a contiguous cell selection.\n *\n * The head of a contiguous selection is always the active cell.\n *\n * If there are no cells selected, `{head: null, anchor: null}` is returned.\n *\n * Throws an error if the currently selected cells do not form a contiguous\n * selection.\n */\n getContiguousSelection(): { head: number | null; anchor: number | null } {\n let cells = this.widgets;\n let first = ArrayExt.findFirstIndex(cells, c => this.isSelected(c));\n\n // Return early if no cells are selected.\n if (first === -1) {\n return { head: null, anchor: null };\n }\n\n let last = ArrayExt.findLastIndex(\n cells,\n c => this.isSelected(c),\n -1,\n first\n );\n\n // Check that the selection is contiguous.\n for (let i = first; i <= last; i++) {\n if (!this.isSelected(cells[i])) {\n throw new Error('Selection not contiguous');\n }\n }\n\n // Check that the active cell is one of the endpoints of the selection.\n let activeIndex = this.activeCellIndex;\n if (first !== activeIndex && last !== activeIndex) {\n throw new Error('Active cell not at endpoint of selection');\n }\n\n // Determine the head and anchor of the selection.\n if (first === activeIndex) {\n return { head: first, anchor: last };\n } else {\n return { head: last, anchor: first };\n }\n }\n\n /**\n * Scroll so that the given position is centered.\n *\n * @param position - The vertical position in the notebook widget.\n *\n * @param threshold - An optional threshold for the scroll (0-50, defaults to\n * 25).\n *\n * #### Notes\n * If the position is within the threshold percentage of the widget height,\n * measured from the center of the widget, the scroll position will not be\n * changed. A threshold of 0 means we will always scroll so the position is\n * centered, and a threshold of 50 means scrolling only happens if position is\n * outside the current window.\n */\n scrollToPosition(position: number, threshold = 25): void {\n let node = this.node;\n let ar = node.getBoundingClientRect();\n let delta = position - ar.top - ar.height / 2;\n if (Math.abs(delta) > ar.height * threshold / 100) {\n node.scrollTop += delta;\n }\n }\n\n /**\n * Handle the DOM events for the widget.\n *\n * @param event - The DOM event sent to the widget.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the notebook panel's node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n if (!this.model) {\n return;\n }\n\n switch (event.type) {\n case 'contextmenu':\n if (event.eventPhase === Event.CAPTURING_PHASE) {\n this._evtContextMenuCapture(event as PointerEvent);\n }\n break;\n case 'mousedown':\n if (event.eventPhase === Event.CAPTURING_PHASE) {\n this._evtMouseDownCapture(event as MouseEvent);\n } else {\n this._evtMouseDown(event as MouseEvent);\n }\n break;\n case 'mouseup':\n if (event.currentTarget === document) {\n this._evtDocumentMouseup(event as MouseEvent);\n }\n break;\n case 'mousemove':\n if (event.currentTarget === document) {\n this._evtDocumentMousemove(event as MouseEvent);\n }\n break;\n case 'keydown':\n this._ensureFocus(true);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'focusin':\n this._evtFocusIn(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as MouseEvent);\n break;\n case 'p-dragenter':\n this._evtDragEnter(event as IDragEvent);\n break;\n case 'p-dragleave':\n this._evtDragLeave(event as IDragEvent);\n break;\n case 'p-dragover':\n this._evtDragOver(event as IDragEvent);\n break;\n case 'p-drop':\n this._evtDrop(event as IDragEvent);\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle `after-attach` messages for the widget.\n */\n protected onAfterAttach(msg: Message): void {\n super.onAfterAttach(msg);\n let node = this.node;\n node.addEventListener('contextmenu', this, true);\n node.addEventListener('mousedown', this, true);\n node.addEventListener('mousedown', this);\n node.addEventListener('keydown', this);\n node.addEventListener('dblclick', this);\n node.addEventListener('focusin', this);\n node.addEventListener('focusout', this);\n node.addEventListener('p-dragenter', this);\n node.addEventListener('p-dragleave', this);\n node.addEventListener('p-dragover', this);\n node.addEventListener('p-drop', this);\n }\n\n /**\n * Handle `before-detach` messages for the widget.\n */\n protected onBeforeDetach(msg: Message): void {\n let node = this.node;\n node.removeEventListener('contextmenu', this, true);\n node.removeEventListener('mousedown', this, true);\n node.removeEventListener('mousedown', this);\n node.removeEventListener('keydown', this);\n node.removeEventListener('dblclick', this);\n node.removeEventListener('focusin', this);\n node.removeEventListener('focusout', this);\n node.removeEventListener('p-dragenter', this);\n node.removeEventListener('p-dragleave', this);\n node.removeEventListener('p-dragover', this);\n node.removeEventListener('p-drop', this);\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n }\n\n /**\n * Handle `'activate-request'` messages.\n */\n protected onActivateRequest(msg: Message): void {\n this._ensureFocus(true);\n }\n\n /**\n * Handle `update-request` messages sent to the widget.\n */\n protected onUpdateRequest(msg: Message): void {\n let activeCell = this.activeCell;\n\n // Set the appropriate classes on the cells.\n if (this.mode === 'edit') {\n this.addClass(EDIT_CLASS);\n this.removeClass(COMMAND_CLASS);\n } else {\n this.addClass(COMMAND_CLASS);\n this.removeClass(EDIT_CLASS);\n }\n if (activeCell) {\n activeCell.addClass(ACTIVE_CLASS);\n }\n\n let count = 0;\n each(this.widgets, widget => {\n if (widget !== activeCell) {\n widget.removeClass(ACTIVE_CLASS);\n }\n widget.removeClass(OTHER_SELECTED_CLASS);\n if (this.isSelectedOrActive(widget)) {\n widget.addClass(SELECTED_CLASS);\n count++;\n } else {\n widget.removeClass(SELECTED_CLASS);\n }\n });\n if (count > 1) {\n activeCell.addClass(OTHER_SELECTED_CLASS);\n }\n }\n\n /**\n * Handle a cell being inserted.\n */\n protected onCellInserted(index: number, cell: Cell): void {\n if (this.model && this.model.modelDB.isCollaborative) {\n let modelDB = this.model.modelDB;\n modelDB.connected.then(() => {\n if (!cell.isDisposed) {\n // Setup the selection style for collaborators.\n let localCollaborator = modelDB.collaborators.localCollaborator;\n cell.editor.uuid = localCollaborator.sessionId;\n cell.editor.selectionStyle = {\n ...CodeEditor.defaultSelectionStyle,\n color: localCollaborator.color\n };\n }\n });\n }\n cell.editor.edgeRequested.connect(this._onEdgeRequest, this);\n // If the insertion happened above, increment the active cell\n // index, otherwise it stays the same.\n this.activeCellIndex =\n index <= this.activeCellIndex\n ? this.activeCellIndex + 1\n : this.activeCellIndex;\n }\n\n /**\n * Handle a cell being moved.\n */\n protected onCellMoved(fromIndex: number, toIndex: number): void {\n let i = this.activeCellIndex;\n if (fromIndex === i) {\n this.activeCellIndex = toIndex;\n } else if (fromIndex < i && i <= toIndex) {\n this.activeCellIndex--;\n } else if (toIndex <= i && i < fromIndex) {\n this.activeCellIndex++;\n }\n }\n\n /**\n * Handle a cell being removed.\n */\n protected onCellRemoved(index: number, cell: Cell): void {\n // If the removal happened above, decrement the active\n // cell index, otherwise it stays the same.\n this.activeCellIndex =\n index <= this.activeCellIndex\n ? this.activeCellIndex - 1\n : this.activeCellIndex;\n if (this.isSelected(cell)) {\n this._selectionChanged.emit(void 0);\n }\n }\n\n /**\n * Handle a new model.\n */\n protected onModelChanged(\n oldValue: INotebookModel,\n newValue: INotebookModel\n ): void {\n super.onModelChanged(oldValue, newValue);\n\n // Try to set the active cell index to 0.\n // It will be set to `-1` if there is no new model or the model is empty.\n this.activeCellIndex = 0;\n }\n\n /**\n * Handle edge request signals from cells.\n */\n private _onEdgeRequest(\n editor: CodeEditor.IEditor,\n location: CodeEditor.EdgeLocation\n ): void {\n let prev = this.activeCellIndex;\n if (location === 'top') {\n this.activeCellIndex--;\n // Move the cursor to the first position on the last line.\n if (this.activeCellIndex < prev) {\n let editor = this.activeCell.editor;\n let lastLine = editor.lineCount - 1;\n editor.setCursorPosition({ line: lastLine, column: 0 });\n }\n } else {\n this.activeCellIndex++;\n // Move the cursor to the first character.\n if (this.activeCellIndex > prev) {\n let editor = this.activeCell.editor;\n editor.setCursorPosition({ line: 0, column: 0 });\n }\n }\n this.mode = 'edit';\n }\n\n /**\n * Ensure that the notebook has proper focus.\n */\n private _ensureFocus(force = false): void {\n let activeCell = this.activeCell;\n if (this.mode === 'edit' && activeCell) {\n if (!activeCell.editor.hasFocus()) {\n activeCell.editor.focus();\n }\n }\n if (force && !this.node.contains(document.activeElement)) {\n this.node.focus();\n }\n }\n\n /**\n * Find the cell index containing the target html element.\n *\n * #### Notes\n * Returns -1 if the cell is not found.\n */\n private _findCell(node: HTMLElement): number {\n // Trace up the DOM hierarchy to find the root cell node.\n // Then find the corresponding child and select it.\n while (node && node !== this.node) {\n if (node.classList.contains(NB_CELL_CLASS)) {\n let i = ArrayExt.findFirstIndex(\n this.widgets,\n widget => widget.node === node\n );\n if (i !== -1) {\n return i;\n }\n break;\n }\n node = node.parentElement;\n }\n return -1;\n }\n\n /**\n * Handle `contextmenu` event.\n */\n private _evtContextMenuCapture(event: PointerEvent): void {\n // Allow the event to propagate un-modified if the user\n // is holding the shift-key (and probably requesting\n // the native context menu).\n if (event.shiftKey) {\n return;\n }\n // `event.target` sometimes gives an orphaned node in Firefox 57, which\n // can have `null` anywhere in its parent tree. If we fail to find a\n // cell using `event.target`, try again using a target reconstructed from\n // the position of the click event.\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n target = document.elementFromPoint(\n event.clientX,\n event.clientY\n ) as HTMLElement;\n index = this._findCell(target);\n }\n let widget = this.widgets[index];\n\n if (widget && widget.editorWidget.node.contains(target)) {\n // Prevent CodeMirror from focusing the editor.\n // TODO: find an editor-agnostic solution.\n event.preventDefault();\n }\n }\n\n /**\n * Handle `mousedown` event in the capture phase for the widget.\n */\n private _evtMouseDownCapture(event: MouseEvent): void {\n const { button, shiftKey } = event;\n\n // `event.target` sometimes gives an orphaned node in Firefox 57, which\n // can have `null` anywhere in its parent tree. If we fail to find a\n // cell using `event.target`, try again using a target reconstructed from\n // the position of the click event.\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n target = document.elementFromPoint(\n event.clientX,\n event.clientY\n ) as HTMLElement;\n index = this._findCell(target);\n }\n let widget = this.widgets[index];\n\n // On OS X, the context menu may be triggered with ctrl-left-click. In\n // Firefox, ctrl-left-click gives an event with button 2, but in Chrome,\n // ctrl-left-click gives an event with button 0 with the ctrl modifier.\n if (\n button === 2 &&\n !shiftKey &&\n widget &&\n widget.editorWidget.node.contains(target)\n ) {\n this.mode = 'command';\n\n // Prevent CodeMirror from focusing the editor.\n // TODO: find an editor-agnostic solution.\n event.preventDefault();\n }\n }\n\n /**\n * Handle `mousedown` events for the widget.\n */\n private _evtMouseDown(event: MouseEvent): void {\n const { button, shiftKey } = event;\n\n // We only handle main or secondary button actions.\n if (!(button === 0 || button === 2)) {\n return;\n }\n\n // Shift right-click gives the browser default behavior.\n if (shiftKey && button === 2) {\n return;\n }\n\n // Find the target cell.\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n // `event.target` sometimes gives an orphaned node in\n // Firefox 57, which can have `null` anywhere in its parent line. If we fail\n // to find a cell using `event.target`, try again using a target\n // reconstructed from the position of the click event.\n target = document.elementFromPoint(\n event.clientX,\n event.clientY\n ) as HTMLElement;\n index = this._findCell(target);\n }\n let widget = this.widgets[index];\n\n let targetArea: 'input' | 'prompt' | 'cell' | 'notebook';\n if (widget) {\n if (widget.editorWidget.node.contains(target)) {\n targetArea = 'input';\n } else if (widget.promptNode.contains(target)) {\n targetArea = 'prompt';\n } else {\n targetArea = 'cell';\n }\n } else {\n targetArea = 'notebook';\n }\n\n // Make sure we go to command mode if the click isn't in the cell editor If\n // we do click in the cell editor, the editor handles the focus event to\n // switch to edit mode.\n if (targetArea !== 'input') {\n this.mode = 'command';\n }\n\n if (targetArea === 'notebook') {\n this.deselectAll();\n } else if (targetArea === 'prompt' || targetArea === 'cell') {\n if (button === 0 && shiftKey) {\n // Prevent browser selecting text in prompt or output\n event.preventDefault();\n\n // Shift-click - extend selection\n try {\n this.extendContiguousSelectionTo(index);\n } catch (e) {\n console.error(e);\n this.deselectAll();\n return;\n }\n // Enter selecting mode\n this._mouseMode = 'select';\n document.addEventListener('mouseup', this, true);\n document.addEventListener('mousemove', this, true);\n } else if (button === 0 && !shiftKey) {\n // Prepare to start a drag if we are on the drag region. TODO: If there is no drag, we'll deselect on mouseup.\n if (targetArea === 'prompt' && this.isSelectedOrActive(widget)) {\n // Prepare for a drag start\n this._dragData = {\n pressX: event.clientX,\n pressY: event.clientY,\n index: index\n };\n\n // Enter possible drag mode\n this._mouseMode = 'couldDrag';\n document.addEventListener('mouseup', this, true);\n document.addEventListener('mousemove', this, true);\n event.preventDefault();\n } else {\n this.deselectAll();\n this.activeCellIndex = index;\n }\n } else if (button === 2) {\n if (!this.isSelectedOrActive(widget)) {\n this.deselectAll();\n this.activeCellIndex = index;\n }\n event.preventDefault();\n }\n } else if (targetArea === 'input') {\n if (button === 2 && !this.isSelectedOrActive(widget)) {\n this.deselectAll();\n this.activeCellIndex = index;\n }\n }\n\n // If we didn't set focus above, make sure we get focus now.\n this._ensureFocus(true);\n }\n\n /**\n * Handle the `'mouseup'` event on the document.\n */\n private _evtDocumentMouseup(event: MouseEvent): void {\n // Remove the event listeners we put on the document\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n\n if (this._mouseMode === 'couldDrag') {\n // We didn't end up dragging if we are here, so treat it as a click event.\n\n // Find the target cell.\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n // `event.target` sometimes gives an orphaned node in\n // Firefox 57, which can have `null` anywhere in its parent line. If we fail\n // to find a cell using `event.target`, try again using a target\n // reconstructed from the position of the click event.\n target = document.elementFromPoint(\n event.clientX,\n event.clientY\n ) as HTMLElement;\n index = this._findCell(target);\n }\n\n this.deselectAll();\n this.activeCellIndex = index;\n }\n\n this._mouseMode = null;\n event.preventDefault();\n event.stopPropagation();\n }\n\n /**\n * Handle the `'mousemove'` event for the widget.\n */\n private _evtDocumentMousemove(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n\n // If in select mode, update the selection\n switch (this._mouseMode) {\n case 'select':\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index !== -1) {\n this.extendContiguousSelectionTo(index);\n }\n break;\n case 'couldDrag':\n // Check for a drag initialization.\n let data = this._dragData;\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n if (dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD) {\n this._mouseMode = null;\n this._startDrag(data.index, event.clientX, event.clientY);\n }\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle the `'p-dragenter'` event for the widget.\n */\n private _evtDragEnter(event: IDragEvent): void {\n if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n return;\n }\n\n let widget = (this.layout as PanelLayout).widgets[index];\n widget.node.classList.add(DROP_TARGET_CLASS);\n }\n\n /**\n * Handle the `'p-dragleave'` event for the widget.\n */\n private _evtDragLeave(event: IDragEvent): void {\n if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n let elements = this.node.getElementsByClassName(DROP_TARGET_CLASS);\n if (elements.length) {\n (elements[0] as HTMLElement).classList.remove(DROP_TARGET_CLASS);\n }\n }\n\n /**\n * Handle the `'p-dragover'` event for the widget.\n */\n private _evtDragOver(event: IDragEvent): void {\n if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n let elements = this.node.getElementsByClassName(DROP_TARGET_CLASS);\n if (elements.length) {\n (elements[0] as HTMLElement).classList.remove(DROP_TARGET_CLASS);\n }\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n return;\n }\n let widget = (this.layout as PanelLayout).widgets[index];\n widget.node.classList.add(DROP_TARGET_CLASS);\n }\n\n /**\n * Handle the `'p-drop'` event for the widget.\n */\n private _evtDrop(event: IDragEvent): void {\n if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n let target = event.target as HTMLElement;\n while (target && target.parentElement) {\n if (target.classList.contains(DROP_TARGET_CLASS)) {\n target.classList.remove(DROP_TARGET_CLASS);\n break;\n }\n target = target.parentElement;\n }\n\n let source: Notebook = event.source;\n if (source === this) {\n // Handle the case where we are moving cells within\n // the same notebook.\n event.dropAction = 'move';\n let toMove: Cell[] = event.mimeData.getData('internal:cells');\n\n // Compute the to/from indices for the move.\n let fromIndex = ArrayExt.firstIndexOf(this.widgets, toMove[0]);\n let toIndex = this._findCell(target);\n // This check is needed for consistency with the view.\n if (toIndex !== -1 && toIndex > fromIndex) {\n toIndex -= 1;\n } else if (toIndex === -1) {\n // If the drop is within the notebook but not on any cell,\n // most often this means it is past the cell areas, so\n // set it to move the cells to the end of the notebook.\n toIndex = this.widgets.length - 1;\n }\n // Don't move if we are within the block of selected cells.\n if (toIndex >= fromIndex && toIndex < fromIndex + toMove.length) {\n return;\n }\n\n // Move the cells one by one\n this.model.cells.beginCompoundOperation();\n if (fromIndex < toIndex) {\n each(toMove, cellWidget => {\n this.model.cells.move(fromIndex, toIndex);\n });\n } else if (fromIndex > toIndex) {\n each(toMove, cellWidget => {\n this.model.cells.move(fromIndex++, toIndex++);\n });\n }\n this.model.cells.endCompoundOperation();\n } else {\n // Handle the case where we are copying cells between\n // notebooks.\n event.dropAction = 'copy';\n // Find the target cell and insert the copied cells.\n let index = this._findCell(target);\n if (index === -1) {\n index = this.widgets.length;\n }\n let start = index;\n let model = this.model;\n let values = event.mimeData.getData(JUPYTER_CELL_MIME);\n let factory = model.contentFactory;\n\n // Insert the copies of the original cells.\n model.cells.beginCompoundOperation();\n each(values, (cell: nbformat.ICell) => {\n let value: ICellModel;\n switch (cell.cell_type) {\n case 'code':\n value = factory.createCodeCell({ cell });\n break;\n case 'markdown':\n value = factory.createMarkdownCell({ cell });\n break;\n default:\n value = factory.createRawCell({ cell });\n break;\n }\n model.cells.insert(index++, value);\n });\n model.cells.endCompoundOperation();\n // Select the inserted cells.\n this.deselectAll();\n this.activeCellIndex = start;\n this.extendContiguousSelectionTo(index - 1);\n }\n }\n\n /**\n * Start a drag event.\n */\n private _startDrag(index: number, clientX: number, clientY: number): void {\n let cells = this.model.cells;\n let selected: nbformat.ICell[] = [];\n let toMove: Cell[] = [];\n\n each(this.widgets, (widget, i) => {\n let cell = cells.get(i);\n if (this.isSelectedOrActive(widget)) {\n widget.addClass(DROP_SOURCE_CLASS);\n selected.push(cell.toJSON());\n toMove.push(widget);\n }\n });\n let activeCell = this.activeCell;\n let dragImage: HTMLElement = null;\n let countString: string;\n if (activeCell.model.type === 'code') {\n let executionCount = (activeCell.model as ICodeCellModel).executionCount;\n countString = ' ';\n if (executionCount) {\n countString = executionCount.toString();\n }\n } else {\n countString = '';\n }\n\n // Create the drag image.\n dragImage = Private.createDragImage(\n selected.length,\n countString,\n activeCell.model.value.text.split('\\n')[0].slice(0, 26)\n );\n\n // Set up the drag event.\n this._drag = new Drag({\n mimeData: new MimeData(),\n dragImage,\n supportedActions: 'copy-move',\n proposedAction: 'copy',\n source: this\n });\n this._drag.mimeData.setData(JUPYTER_CELL_MIME, selected);\n // Add mimeData for the fully reified cell widgets, for the\n // case where the target is in the same notebook and we\n // can just move the cells.\n this._drag.mimeData.setData('internal:cells', toMove);\n\n // Remove mousemove and mouseup listeners and start the drag.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n this._mouseMode = null;\n this._drag.start(clientX, clientY).then(action => {\n if (this.isDisposed) {\n return;\n }\n this._drag = null;\n each(toMove, widget => {\n widget.removeClass(DROP_SOURCE_CLASS);\n });\n });\n }\n\n /**\n * Handle `focus` events for the widget.\n */\n private _evtFocusIn(event: MouseEvent): void {\n let target = event.target as HTMLElement;\n\n let i = this._findCell(target);\n if (i !== -1) {\n let widget = this.widgets[i];\n // If the editor itself does not have focus, ensure command mode.\n if (!widget.editorWidget.node.contains(target)) {\n this.mode = 'command';\n }\n this.activeCellIndex = i;\n // If the editor has focus, ensure edit mode.\n let node = widget.editorWidget.node;\n if (node.contains(target)) {\n this.mode = 'edit';\n }\n } else {\n // No cell has focus, ensure command mode.\n this.mode = 'command';\n }\n if (this.mode === 'command' && target !== this.node) {\n delete this.node.dataset[CODE_RUNNER];\n } else {\n this.node.dataset[CODE_RUNNER] = 'true';\n }\n }\n\n /**\n * Handle `focusout` events for the notebook.\n */\n private _evtFocusOut(event: MouseEvent): void {\n let relatedTarget = event.relatedTarget as HTMLElement;\n\n // Bail if the window is losing focus, to preserve edit mode. This test\n // assumes that we explicitly focus things rather than calling blur()\n if (!relatedTarget) {\n return;\n }\n\n // Bail if the item gaining focus is another cell,\n // and we should not be entering command mode.\n const i = this._findCell(relatedTarget);\n if (i !== -1) {\n const widget = this.widgets[i];\n if (widget.editorWidget.node.contains(relatedTarget)) {\n return;\n }\n }\n\n // Otherwise enter command mode.\n this.mode = 'command';\n }\n\n /**\n * Handle `dblclick` events for the widget.\n */\n private _evtDblClick(event: MouseEvent): void {\n let model = this.model;\n if (!model) {\n return;\n }\n this.deselectAll();\n\n // `event.target` sometimes gives an orphaned node in Firefox 57, which\n // can have `null` anywhere in its parent tree. If we fail to find a\n // cell using `event.target`, try again using a target reconstructed from\n // the position of the click event.\n let target = event.target as HTMLElement;\n let i = this._findCell(target);\n if (i === -1) {\n target = document.elementFromPoint(\n event.clientX,\n event.clientY\n ) as HTMLElement;\n i = this._findCell(target);\n }\n\n if (i === -1) {\n return;\n }\n this.activeCellIndex = i;\n if (model.cells.get(i).type === 'markdown') {\n let widget = this.widgets[i] as MarkdownCell;\n widget.rendered = false;\n } else if (target.localName === 'img') {\n target.classList.toggle(UNCONFINED_CLASS);\n }\n }\n\n /**\n * Remove selections from inactive cells to avoid\n * spurious cursors.\n */\n private _trimSelections(): void {\n for (let i = 0; i < this.widgets.length; i++) {\n if (i !== this._activeCellIndex) {\n let cell = this.widgets[i];\n cell.model.selections.delete(cell.editor.uuid);\n }\n }\n }\n\n private _activeCellIndex = -1;\n private _activeCell: Cell | undefined = undefined;\n private _mode: NotebookMode = 'command';\n private _drag: Drag = null;\n private _dragData: { pressX: number; pressY: number; index: number } = null;\n private _mouseMode: 'select' | 'couldDrag' | null = null;\n private _activeCellChanged = new Signal<this, Cell>(this);\n private _stateChanged = new Signal<this, IChangedArgs<any>>(this);\n private _selectionChanged = new Signal<this, void>(this);\n}\n\n/**\n * The namespace for the `Notebook` class statics.\n */\nexport namespace Notebook {\n /**\n * An options object for initializing a notebook widget.\n */\n export interface IOptions extends StaticNotebook.IOptions {}\n\n /**\n * The content factory for the notebook widget.\n */\n export interface IContentFactory extends StaticNotebook.IContentFactory {}\n\n /**\n * The default implementation of a notebook content factory..\n *\n * #### Notes\n * Override methods on this class to customize the default notebook factory\n * methods that create notebook content.\n */\n export class ContentFactory extends StaticNotebook.ContentFactory {}\n\n /**\n * A namespace for the notebook content factory.\n */\n export namespace ContentFactory {\n /**\n * An options object for initializing a notebook content factory.\n */\n export interface IOptions extends StaticNotebook.ContentFactory.IOptions {}\n }\n\n export const defaultContentFactory: IContentFactory = new ContentFactory();\n}\n\n/**\n * A namespace for private data.\n */\nnamespace Private {\n /**\n * An attached property for the selected state of a cell.\n */\n export const selectedProperty = new AttachedProperty<Cell, boolean>({\n name: 'selected',\n create: () => false\n });\n\n /**\n * A custom panel layout for the notebook.\n */\n export class NotebookPanelLayout extends PanelLayout {\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * This is a reimplementation of the base class method,\n * and is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {\n // This is a no-op.\n }\n }\n\n /**\n * Create a cell drag image.\n */\n export function createDragImage(\n count: number,\n promptNumber: string,\n cellContent: string\n ): HTMLElement {\n if (count > 1) {\n if (promptNumber !== '') {\n return VirtualDOM.realize(\n h.div(\n h.div(\n { className: DRAG_IMAGE_CLASS },\n h.span(\n { className: CELL_DRAG_PROMPT_CLASS },\n 'In [' + promptNumber + ']:'\n ),\n h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent)\n ),\n h.div({ className: CELL_DRAG_MULTIPLE_BACK }, '')\n )\n );\n } else {\n return VirtualDOM.realize(\n h.div(\n h.div(\n { className: DRAG_IMAGE_CLASS },\n h.span({ className: CELL_DRAG_PROMPT_CLASS }),\n h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent)\n ),\n h.div({ className: CELL_DRAG_MULTIPLE_BACK }, '')\n )\n );\n }\n } else {\n if (promptNumber !== '') {\n return VirtualDOM.realize(\n h.div(\n h.div(\n { className: `${DRAG_IMAGE_CLASS} ${SINGLE_DRAG_IMAGE_CLASS}` },\n h.span(\n { className: CELL_DRAG_PROMPT_CLASS },\n 'In [' + promptNumber + ']:'\n ),\n h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent)\n )\n )\n );\n } else {\n return VirtualDOM.realize(\n h.div(\n h.div(\n { className: `${DRAG_IMAGE_CLASS} ${SINGLE_DRAG_IMAGE_CLASS}` },\n h.span({ className: CELL_DRAG_PROMPT_CLASS }),\n h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent)\n )\n )\n );\n }\n }\n }\n\n /**\n * Process the `IOptions` passed to the notebook widget.\n *\n * #### Notes\n * This defaults the content factory to that in the `Notebook` namespace.\n */\n export function processNotebookOptions(options: Notebook.IOptions) {\n if (options.contentFactory) {\n return options;\n } else {\n return {\n rendermime: options.rendermime,\n languagePreference: options.languagePreference,\n contentFactory: Notebook.defaultContentFactory,\n mimeTypeService: options.mimeTypeService\n };\n }\n }\n}\n"]}
1
+ {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../../notebook/src/widget.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D,mDAAqD;AAMrD,mDAA+C;AAE/C,qDAAwD;AAExD,mDAAsD;AAEtD,iDAAsD;AAEtD,+CAAwD;AAExD,qDAAqD;AAErD,6CAS2B;AAE3B,uDAA4E;AAU5E;;GAEG;AACH,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,GAAG,UAAU,CAAC;AAE1B;;GAEG;AACH,MAAM,QAAQ,GAAG,aAAa,CAAC;AAE/B;;GAEG;AACH,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAEzC;;GAEG;AACH,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAErC;;GAEG;AACH,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE3C;;GAEG;AACH,MAAM,YAAY,GAAG,eAAe,CAAC;AAErC;;GAEG;AACH,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAEzC;;GAEG;AACH,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAEpD;;GAEG;AACH,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAE7C;;GAEG;AACH,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;GAEG;AACH,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;GAEG;AACH,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AAE5D;;GAEG;AACH,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAEvD;;GAEG;AACH,MAAM,sBAAsB,GAAG,q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,EAAE,WAAW,CAAC,CAC5D,CACF,CACF,CAAC;aACH;iBAAM;gBACL,OAAO,uBAAU,CAAC,OAAO,CACvB,cAAC,CAAC,GAAG,CACH,cAAC,CAAC,GAAG,CACH,EAAE,SAAS,EAAE,GAAG,gBAAgB,IAAI,uBAAuB,EAAE,EAAE,EAC/D,cAAC,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,CAAC,EAC7C,cAAC,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,EAAE,WAAW,CAAC,CAC5D,CACF,CACF,CAAC;aACH;SACF;IACH,CAAC;IA1De,uBAAe,kBA0D9B,CAAA;IAED;;;;;OAKG;IACH,gCAAuC,OAA0B;QAC/D,IAAI,OAAO,CAAC,cAAc,EAAE;YAC1B,OAAO,OAAO,CAAC;SAChB;aAAM;YACL,OAAO;gBACL,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;gBAC9C,cAAc,EAAE,QAAQ,CAAC,qBAAqB;gBAC9C,eAAe,EAAE,OAAO,CAAC,eAAe;aACzC,CAAC;SACH;IACH,CAAC;IAXe,8BAAsB,yBAWrC,CAAA;AACH,CAAC,EA1GS,OAAO,KAAP,OAAO,QA0GhB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt, each } from '@phosphor/algorithm';\n\nimport { JSONValue } from '@phosphor/coreutils';\n\nimport { Message } from '@phosphor/messaging';\n\nimport { MimeData } from '@phosphor/coreutils';\n\nimport { AttachedProperty } from '@phosphor/properties';\n\nimport { ISignal, Signal } from '@phosphor/signaling';\n\nimport { Drag, IDragEvent } from '@phosphor/dragdrop';\n\nimport { PanelLayout, Widget } from '@phosphor/widgets';\n\nimport { h, VirtualDOM } from '@phosphor/virtualdom';\n\nimport {\n ICellModel,\n Cell,\n IMarkdownCellModel,\n CodeCell,\n MarkdownCell,\n ICodeCellModel,\n RawCell,\n IRawCellModel\n} from '@jupyterlab/cells';\n\nimport { IEditorMimeTypeService, CodeEditor } from '@jupyterlab/codeeditor';\n\nimport { IChangedArgs, nbformat } from '@jupyterlab/coreutils';\n\nimport { IObservableMap, IObservableList } from '@jupyterlab/observables';\n\nimport { RenderMimeRegistry } from '@jupyterlab/rendermime';\n\nimport { INotebookModel } from './model';\n\n/**\n * The data attribute added to a widget that has an active kernel.\n */\nconst KERNEL_USER = 'jpKernelUser';\n\n/**\n * The data attribute added to a widget that can run code.\n */\nconst CODE_RUNNER = 'jpCodeRunner';\n\n/**\n * The data attribute added to a widget that can undo.\n */\nconst UNDOER = 'jpUndoer';\n\n/**\n * The class name added to notebook widgets.\n */\nconst NB_CLASS = 'jp-Notebook';\n\n/**\n * The class name added to notebook widget cells.\n */\nconst NB_CELL_CLASS = 'jp-Notebook-cell';\n\n/**\n * The class name added to a notebook in edit mode.\n */\nconst EDIT_CLASS = 'jp-mod-editMode';\n\n/**\n * The class name added to a notebook in command mode.\n */\nconst COMMAND_CLASS = 'jp-mod-commandMode';\n\n/**\n * The class name added to the active cell.\n */\nconst ACTIVE_CLASS = 'jp-mod-active';\n\n/**\n * The class name added to selected cells.\n */\nconst SELECTED_CLASS = 'jp-mod-selected';\n\n/**\n * The class name added to an active cell when there are other selected cells.\n */\nconst OTHER_SELECTED_CLASS = 'jp-mod-multiSelected';\n\n/**\n * The class name added to unconfined images.\n */\nconst UNCONFINED_CLASS = 'jp-mod-unconfined';\n\n/**\n * The class name added to a drop target.\n */\nconst DROP_TARGET_CLASS = 'jp-mod-dropTarget';\n\n/**\n * The class name added to a drop source.\n */\nconst DROP_SOURCE_CLASS = 'jp-mod-dropSource';\n\n/**\n * The class name added to drag images.\n */\nconst DRAG_IMAGE_CLASS = 'jp-dragImage';\n\n/**\n * The class name added to singular drag images\n */\nconst SINGLE_DRAG_IMAGE_CLASS = 'jp-dragImage-singlePrompt';\n\n/**\n * The class name added to the drag image cell content.\n */\nconst CELL_DRAG_CONTENT_CLASS = 'jp-dragImage-content';\n\n/**\n * The class name added to the drag image cell content.\n */\nconst CELL_DRAG_PROMPT_CLASS = 'jp-dragImage-prompt';\n\n/**\n * The class name added to the drag image cell content.\n */\nconst CELL_DRAG_MULTIPLE_BACK = 'jp-dragImage-multipleBack';\n\n/**\n * The mimetype used for Jupyter cell data.\n */\nconst JUPYTER_CELL_MIME = 'application/vnd.jupyter.cells';\n\n/**\n * The threshold in pixels to start a drag event.\n */\nconst DRAG_THRESHOLD = 5;\n\n/**\n * The interactivity modes for the notebook.\n */\nexport type NotebookMode = 'command' | 'edit';\n\n/**\n * A widget which renders static non-interactive notebooks.\n *\n * #### Notes\n * The widget model must be set separately and can be changed\n * at any time. Consumers of the widget must account for a\n * `null` model, and may want to listen to the `modelChanged`\n * signal.\n */\nexport class StaticNotebook extends Widget {\n /**\n * Construct a notebook widget.\n */\n constructor(options: StaticNotebook.IOptions) {\n super();\n this.addClass(NB_CLASS);\n this.node.dataset[KERNEL_USER] = 'true';\n this.node.dataset[UNDOER] = 'true';\n this.rendermime = options.rendermime;\n this.layout = new Private.NotebookPanelLayout();\n this.contentFactory =\n options.contentFactory || StaticNotebook.defaultContentFactory;\n this.editorConfig =\n options.editorConfig || StaticNotebook.defaultEditorConfig;\n this._mimetypeService = options.mimeTypeService;\n }\n\n /**\n * A signal emitted when the model of the notebook changes.\n */\n get modelChanged(): ISignal<this, void> {\n return this._modelChanged;\n }\n\n /**\n * A signal emitted when the model content changes.\n *\n * #### Notes\n * This is a convenience signal that follows the current model.\n */\n get modelContentChanged(): ISignal<this, void> {\n return this._modelContentChanged;\n }\n\n /**\n * The cell factory used by the widget.\n */\n readonly contentFactory: StaticNotebook.IContentFactory;\n\n /**\n * The Rendermime instance used by the widget.\n */\n readonly rendermime: RenderMimeRegistry;\n\n /**\n * The model for the widget.\n */\n get model(): INotebookModel {\n return this._model;\n }\n set model(newValue: INotebookModel) {\n newValue = newValue || null;\n if (this._model === newValue) {\n return;\n }\n let oldValue = this._model;\n this._model = newValue;\n\n if (oldValue && oldValue.modelDB.isCollaborative) {\n oldValue.modelDB.connected.then(() => {\n oldValue.modelDB.collaborators.changed.disconnect(\n this._onCollaboratorsChanged,\n this\n );\n });\n }\n if (newValue && newValue.modelDB.isCollaborative) {\n newValue.modelDB.connected.then(() => {\n newValue.modelDB.collaborators.changed.connect(\n this._onCollaboratorsChanged,\n this\n );\n });\n }\n\n // Trigger private, protected, and public changes.\n this._onModelChanged(oldValue, newValue);\n this.onModelChanged(oldValue, newValue);\n this._modelChanged.emit(void 0);\n }\n\n /**\n * Get the mimetype for code cells.\n */\n get codeMimetype(): string {\n return this._mimetype;\n }\n\n /**\n * A read-only sequence of the widgets in the notebook.\n */\n get widgets(): ReadonlyArray<Cell> {\n return (this.layout as PanelLayout).widgets as ReadonlyArray<Cell>;\n }\n\n /**\n * A configuration object for cell editor settings.\n */\n get editorConfig(): StaticNotebook.IEditorConfig {\n return this._editorConfig;\n }\n set editorConfig(value: StaticNotebook.IEditorConfig) {\n this._editorConfig = value;\n this._updateEditorConfig();\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose() {\n // Do nothing if already disposed.\n if (this.isDisposed) {\n return;\n }\n this._model = null;\n super.dispose();\n }\n\n /**\n * Handle a new model.\n *\n * #### Notes\n * This method is called after the model change has been handled\n * internally and before the `modelChanged` signal is emitted.\n * The default implementation is a no-op.\n */\n protected onModelChanged(\n oldValue: INotebookModel,\n newValue: INotebookModel\n ): void {\n // No-op.\n }\n\n /**\n * Handle changes to the notebook model content.\n *\n * #### Notes\n * The default implementation emits the `modelContentChanged` signal.\n */\n protected onModelContentChanged(model: INotebookModel, args: void): void {\n this._modelContentChanged.emit(void 0);\n }\n\n /**\n * Handle changes to the notebook model metadata.\n *\n * #### Notes\n * The default implementation updates the mimetypes of the code cells\n * when the `language_info` metadata changes.\n */\n protected onMetadataChanged(\n sender: IObservableMap<JSONValue>,\n args: IObservableMap.IChangedArgs<JSONValue>\n ): void {\n switch (args.key) {\n case 'language_info':\n this._updateMimetype();\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle a cell being inserted.\n *\n * The default implementation is a no-op\n */\n protected onCellInserted(index: number, cell: Cell): void {\n // This is a no-op.\n }\n\n /**\n * Handle a cell being moved.\n *\n * The default implementation is a no-op\n */\n protected onCellMoved(fromIndex: number, toIndex: number): void {\n // This is a no-op.\n }\n\n /**\n * Handle a cell being removed.\n *\n * The default implementation is a no-op\n */\n protected onCellRemoved(index: number, cell: Cell): void {\n // This is a no-op.\n }\n\n /**\n * Handle a new model on the widget.\n */\n private _onModelChanged(\n oldValue: INotebookModel,\n newValue: INotebookModel\n ): void {\n let layout = this.layout as PanelLayout;\n if (oldValue) {\n oldValue.cells.changed.disconnect(this._onCellsChanged, this);\n oldValue.metadata.changed.disconnect(this.onMetadataChanged, this);\n oldValue.contentChanged.disconnect(this.onModelContentChanged, this);\n // TODO: reuse existing cell widgets if possible. Remember to initially\n // clear the history of each cell if we do this.\n while (layout.widgets.length) {\n this._removeCell(0);\n }\n }\n if (!newValue) {\n this._mimetype = 'text/plain';\n return;\n }\n this._updateMimetype();\n let cells = newValue.cells;\n each(cells, (cell: ICellModel, i: number) => {\n this._insertCell(i, cell);\n });\n cells.changed.connect(this._onCellsChanged, this);\n newValue.contentChanged.connect(this.onModelContentChanged, this);\n newValue.metadata.changed.connect(this.onMetadataChanged, this);\n }\n\n /**\n * Handle a change cells event.\n */\n private _onCellsChanged(\n sender: IObservableList<ICellModel>,\n args: IObservableList.IChangedArgs<ICellModel>\n ) {\n let index = 0;\n switch (args.type) {\n case 'add':\n index = args.newIndex;\n each(args.newValues, value => {\n this._insertCell(index++, value);\n });\n break;\n case 'move':\n this._moveCell(args.oldIndex, args.newIndex);\n break;\n case 'remove':\n each(args.oldValues, value => {\n this._removeCell(args.oldIndex);\n });\n break;\n case 'set':\n // TODO: reuse existing widgets if possible.\n index = args.newIndex;\n each(args.newValues, value => {\n // Note: this ordering (insert then remove)\n // is important for getting the active cell\n // index for the editable notebook correct.\n this._insertCell(index, value);\n this._removeCell(index + 1);\n index++;\n });\n break;\n default:\n return;\n }\n }\n\n /**\n * Create a cell widget and insert into the notebook.\n */\n private _insertCell(index: number, cell: ICellModel): void {\n let widget: Cell;\n switch (cell.type) {\n case 'code':\n widget = this._createCodeCell(cell as ICodeCellModel);\n widget.model.mimeType = this._mimetype;\n break;\n case 'markdown':\n widget = this._createMarkdownCell(cell as IMarkdownCellModel);\n break;\n default:\n widget = this._createRawCell(cell as IRawCellModel);\n }\n widget.addClass(NB_CELL_CLASS);\n let layout = this.layout as PanelLayout;\n layout.insertWidget(index, widget);\n this.onCellInserted(index, widget);\n }\n\n /**\n * Create a code cell widget from a code cell model.\n */\n private _createCodeCell(model: ICodeCellModel): CodeCell {\n let rendermime = this.rendermime;\n let contentFactory = this.contentFactory;\n const editorConfig = this.editorConfig.code;\n let options = { editorConfig, model, rendermime, contentFactory };\n return this.contentFactory.createCodeCell(options, this);\n }\n\n /**\n * Create a markdown cell widget from a markdown cell model.\n */\n private _createMarkdownCell(model: IMarkdownCellModel): MarkdownCell {\n let rendermime = this.rendermime;\n let contentFactory = this.contentFactory;\n const editorConfig = this.editorConfig.markdown;\n let options = { editorConfig, model, rendermime, contentFactory };\n return this.contentFactory.createMarkdownCell(options, this);\n }\n\n /**\n * Create a raw cell widget from a raw cell model.\n */\n private _createRawCell(model: IRawCellModel): RawCell {\n let contentFactory = this.contentFactory;\n const editorConfig = this.editorConfig.raw;\n let options = { editorConfig, model, contentFactory };\n return this.contentFactory.createRawCell(options, this);\n }\n\n /**\n * Move a cell widget.\n */\n private _moveCell(fromIndex: number, toIndex: number): void {\n let layout = this.layout as PanelLayout;\n layout.insertWidget(toIndex, layout.widgets[fromIndex]);\n this.onCellMoved(fromIndex, toIndex);\n }\n\n /**\n * Remove a cell widget.\n */\n private _removeCell(index: number): void {\n let layout = this.layout as PanelLayout;\n let widget = layout.widgets[index] as Cell;\n widget.parent = null;\n this.onCellRemoved(index, widget);\n widget.dispose();\n }\n\n /**\n * Update the mimetype of the notebook.\n */\n private _updateMimetype(): void {\n let info = this._model.metadata.get(\n 'language_info'\n ) as nbformat.ILanguageInfoMetadata;\n if (!info) {\n return;\n }\n this._mimetype = this._mimetypeService.getMimeTypeByLanguage(info);\n each(this.widgets, widget => {\n if (widget.model.type === 'code') {\n widget.model.mimeType = this._mimetype;\n }\n });\n }\n\n /**\n * Handle an update to the collaborators.\n */\n private _onCollaboratorsChanged(): void {\n // If there are selections corresponding to non-collaborators,\n // they are stale and should be removed.\n for (let i = 0; i < this.widgets.length; i++) {\n let cell = this.widgets[i];\n for (let key of cell.model.selections.keys()) {\n if (!this._model.modelDB.collaborators.has(key)) {\n cell.model.selections.delete(key);\n }\n }\n }\n }\n\n /**\n * Update editor settings for notebook cells.\n */\n private _updateEditorConfig() {\n for (let i = 0; i < this.widgets.length; i++) {\n const cell = this.widgets[i];\n let config: Partial<CodeEditor.IConfig>;\n switch (cell.model.type) {\n case 'code':\n config = this._editorConfig.code;\n break;\n case 'markdown':\n config = this._editorConfig.markdown;\n break;\n default:\n config = this._editorConfig.raw;\n break;\n }\n Object.keys(config).forEach((key: keyof CodeEditor.IConfig) => {\n cell.editor.setOption(key, config[key]);\n });\n }\n }\n\n private _editorConfig = StaticNotebook.defaultEditorConfig;\n private _mimetype = 'text/plain';\n private _model: INotebookModel = null;\n private _mimetypeService: IEditorMimeTypeService;\n private _modelChanged = new Signal<this, void>(this);\n private _modelContentChanged = new Signal<this, void>(this);\n}\n\n/**\n * The namespace for the `StaticNotebook` class statics.\n */\nexport namespace StaticNotebook {\n /**\n * An options object for initializing a static notebook.\n */\n export interface IOptions {\n /**\n * The rendermime instance used by the widget.\n */\n rendermime: RenderMimeRegistry;\n\n /**\n * The language preference for the model.\n */\n languagePreference?: string;\n\n /**\n * A factory for creating content.\n */\n contentFactory?: IContentFactory;\n\n /**\n * A configuration object for the cell editor settings.\n */\n editorConfig?: IEditorConfig;\n\n /**\n * The service used to look up mime types.\n */\n mimeTypeService: IEditorMimeTypeService;\n }\n\n /**\n * A factory for creating notebook content.\n *\n * #### Notes\n * This extends the content factory of the cell itself, which extends the content\n * factory of the output area and input area. The result is that there is a single\n * factory for creating all child content of a notebook.\n */\n export interface IContentFactory extends Cell.IContentFactory {\n /**\n * Create a new code cell widget.\n */\n createCodeCell(\n options: CodeCell.IOptions,\n parent: StaticNotebook\n ): CodeCell;\n\n /**\n * Create a new markdown cell widget.\n */\n createMarkdownCell(\n options: MarkdownCell.IOptions,\n parent: StaticNotebook\n ): MarkdownCell;\n\n /**\n * Create a new raw cell widget.\n */\n createRawCell(options: RawCell.IOptions, parent: StaticNotebook): RawCell;\n }\n\n /**\n * A config object for the cell editors.\n */\n export interface IEditorConfig {\n /**\n * Config options for code cells.\n */\n readonly code: Partial<CodeEditor.IConfig>;\n /**\n * Config options for markdown cells.\n */\n readonly markdown: Partial<CodeEditor.IConfig>;\n /**\n * Config options for raw cells.\n */\n readonly raw: Partial<CodeEditor.IConfig>;\n }\n\n /**\n * Default configuration options for cell editors.\n */\n export const defaultEditorConfig: IEditorConfig = {\n code: {\n ...CodeEditor.defaultConfig,\n lineWrap: 'off',\n matchBrackets: true,\n autoClosingBrackets: true\n },\n markdown: {\n ...CodeEditor.defaultConfig,\n lineWrap: 'on',\n matchBrackets: false,\n autoClosingBrackets: false\n },\n raw: {\n ...CodeEditor.defaultConfig,\n lineWrap: 'on',\n matchBrackets: false,\n autoClosingBrackets: false\n }\n };\n\n /**\n * The default implementation of an `IContentFactory`.\n */\n export class ContentFactory extends Cell.ContentFactory\n implements IContentFactory {\n /**\n * Create a new code cell widget.\n *\n * #### Notes\n * If no cell content factory is passed in with the options, the one on the\n * notebook content factory is used.\n */\n createCodeCell(\n options: CodeCell.IOptions,\n parent: StaticNotebook\n ): CodeCell {\n if (!options.contentFactory) {\n options.contentFactory = this;\n }\n return new CodeCell(options);\n }\n\n /**\n * Create a new markdown cell widget.\n *\n * #### Notes\n * If no cell content factory is passed in with the options, the one on the\n * notebook content factory is used.\n */\n createMarkdownCell(\n options: MarkdownCell.IOptions,\n parent: StaticNotebook\n ): MarkdownCell {\n if (!options.contentFactory) {\n options.contentFactory = this;\n }\n return new MarkdownCell(options);\n }\n\n /**\n * Create a new raw cell widget.\n *\n * #### Notes\n * If no cell content factory is passed in with the options, the one on the\n * notebook content factory is used.\n */\n createRawCell(options: RawCell.IOptions, parent: StaticNotebook): RawCell {\n if (!options.contentFactory) {\n options.contentFactory = this;\n }\n return new RawCell(options);\n }\n }\n\n /**\n * A namespace for the staic notebook content factory.\n */\n export namespace ContentFactory {\n /**\n * Options for the content factory.\n */\n export interface IOptions extends Cell.ContentFactory.IOptions {}\n }\n\n /**\n * Default content factory for the static notebook widget.\n */\n export const defaultContentFactory: IContentFactory = new ContentFactory();\n}\n\n/**\n * A notebook widget that supports interactivity.\n */\nexport class Notebook extends StaticNotebook {\n /**\n * Construct a notebook widget.\n */\n constructor(options: Notebook.IOptions) {\n super(Private.processNotebookOptions(options));\n this.node.tabIndex = -1; // Allow the widget to take focus.\n // Allow the node to scroll while dragging items.\n this.node.setAttribute('data-p-dragscroll', 'true');\n }\n\n /**\n * A signal emitted when the active cell changes.\n *\n * #### Notes\n * This can be due to the active index changing or the\n * cell at the active index changing.\n */\n get activeCellChanged(): ISignal<this, Cell> {\n return this._activeCellChanged;\n }\n\n /**\n * A signal emitted when the state of the notebook changes.\n */\n get stateChanged(): ISignal<this, IChangedArgs<any>> {\n return this._stateChanged;\n }\n\n /**\n * A signal emitted when the selection state of the notebook changes.\n */\n get selectionChanged(): ISignal<this, void> {\n return this._selectionChanged;\n }\n\n /**\n * The interactivity mode of the notebook.\n */\n get mode(): NotebookMode {\n return this._mode;\n }\n set mode(newValue: NotebookMode) {\n let activeCell = this.activeCell;\n if (!activeCell) {\n newValue = 'command';\n }\n if (newValue === this._mode) {\n this._ensureFocus();\n return;\n }\n // Post an update request.\n this.update();\n let oldValue = this._mode;\n this._mode = newValue;\n\n if (newValue === 'edit') {\n // Edit mode deselects all cells.\n each(this.widgets, widget => {\n this.deselect(widget);\n });\n // Edit mode unrenders an active markdown widget.\n if (activeCell instanceof MarkdownCell) {\n activeCell.rendered = false;\n }\n activeCell.inputHidden = false;\n } else {\n // Focus on the notebook document, which blurs the active cell.\n this.node.focus();\n }\n this._stateChanged.emit({ name: 'mode', oldValue, newValue });\n this._ensureFocus();\n }\n\n /**\n * The active cell index of the notebook.\n *\n * #### Notes\n * The index will be clamped to the bounds of the notebook cells.\n */\n get activeCellIndex(): number {\n if (!this.model) {\n return -1;\n }\n return this.model.cells.length ? this._activeCellIndex : -1;\n }\n set activeCellIndex(newValue: number) {\n let oldValue = this._activeCellIndex;\n if (!this.model || !this.model.cells.length) {\n newValue = -1;\n } else {\n newValue = Math.max(newValue, 0);\n newValue = Math.min(newValue, this.model.cells.length - 1);\n }\n\n this._activeCellIndex = newValue;\n let cell = this.widgets[newValue];\n if (cell !== this._activeCell) {\n // Post an update request.\n this.update();\n this._activeCell = cell;\n this._activeCellChanged.emit(cell);\n }\n if (this.mode === 'edit' && cell instanceof MarkdownCell) {\n cell.rendered = false;\n }\n this._ensureFocus();\n if (newValue === oldValue) {\n return;\n }\n this._trimSelections();\n this._stateChanged.emit({ name: 'activeCellIndex', oldValue, newValue });\n }\n\n /**\n * Get the active cell widget.\n *\n * #### Notes\n * This is a cell or `null` if there is no active cell.\n */\n get activeCell(): Cell | null {\n return this._activeCell;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._activeCell = null;\n super.dispose();\n }\n\n /**\n * Select a cell widget.\n *\n * #### Notes\n * It is a no-op if the value does not change.\n * It will emit the `selectionChanged` signal.\n */\n select(widget: Cell): void {\n if (Private.selectedProperty.get(widget)) {\n return;\n }\n Private.selectedProperty.set(widget, true);\n this._selectionChanged.emit(void 0);\n this.update();\n }\n\n /**\n * Deselect a cell widget.\n *\n * #### Notes\n * It is a no-op if the value does not change.\n * It will emit the `selectionChanged` signal.\n */\n deselect(widget: Cell): void {\n if (!Private.selectedProperty.get(widget)) {\n return;\n }\n Private.selectedProperty.set(widget, false);\n this._selectionChanged.emit(void 0);\n this.update();\n }\n\n /**\n * Whether a cell is selected.\n */\n isSelected(widget: Cell): boolean {\n return Private.selectedProperty.get(widget);\n }\n\n /**\n * Whether a cell is selected or is the active cell.\n */\n isSelectedOrActive(widget: Cell): boolean {\n if (widget === this._activeCell) {\n return true;\n }\n return Private.selectedProperty.get(widget);\n }\n\n /**\n * Deselect all of the cells.\n */\n deselectAll(): void {\n let changed = false;\n each(this.widgets, widget => {\n if (Private.selectedProperty.get(widget)) {\n changed = true;\n }\n Private.selectedProperty.set(widget, false);\n });\n if (changed) {\n this._selectionChanged.emit(void 0);\n }\n // Make sure we have a valid active cell.\n this.activeCellIndex = this.activeCellIndex;\n this.update();\n }\n\n /**\n * Move the head of an existing contiguous selection to extend the selection.\n *\n * @param index - The new head of the existing selection.\n *\n * #### Notes\n * If there is no existing selection, the active cell is considered an\n * existing one-cell selection.\n *\n * If the new selection is a single cell, that cell becomes the active cell\n * and all cells are deselected.\n *\n * There is no change if there are no cells (i.e., activeCellIndex is -1).\n */\n extendContiguousSelectionTo(index: number): void {\n let { head, anchor } = this.getContiguousSelection();\n let i: number;\n\n // Handle the case of no current selection.\n if (anchor === null) {\n if (index === this.activeCellIndex) {\n // Already collapsed selection, nothing more to do.\n return;\n }\n\n // We will start a new selection below.\n head = this.activeCellIndex;\n anchor = this.activeCellIndex;\n }\n\n // Move the active cell. We do this before the collapsing shortcut below.\n this.activeCellIndex = index;\n\n // Make sure the index is valid, according to the rules for setting and clipping the\n // active cell index. This may change the index.\n index = this.activeCellIndex;\n\n // Collapse the selection if it is only the active cell.\n if (index === anchor) {\n this.deselectAll();\n return;\n }\n\n let selectionChanged = false;\n\n if (head < index) {\n if (head < anchor) {\n Private.selectedProperty.set(this.widgets[head], false);\n selectionChanged = true;\n }\n\n // Toggle everything strictly between head and index except anchor.\n for (i = head + 1; i < index; i++) {\n if (i !== anchor) {\n Private.selectedProperty.set(\n this.widgets[i],\n !Private.selectedProperty.get(this.widgets[i])\n );\n selectionChanged = true;\n }\n }\n } else if (index < head) {\n if (anchor < head) {\n Private.selectedProperty.set(this.widgets[head], false);\n selectionChanged = true;\n }\n\n // Toggle everything strictly between index and head except anchor.\n for (i = index + 1; i < head; i++) {\n if (i !== anchor) {\n Private.selectedProperty.set(\n this.widgets[i],\n !Private.selectedProperty.get(this.widgets[i])\n );\n selectionChanged = true;\n }\n }\n }\n\n // Anchor and index should *always* be selected.\n if (!Private.selectedProperty.get(this.widgets[anchor])) {\n selectionChanged = true;\n }\n Private.selectedProperty.set(this.widgets[anchor], true);\n\n if (!Private.selectedProperty.get(this.widgets[index])) {\n selectionChanged = true;\n }\n Private.selectedProperty.set(this.widgets[index], true);\n\n if (selectionChanged) {\n this._selectionChanged.emit(void 0);\n }\n }\n\n /**\n * Get the head and anchor of a contiguous cell selection.\n *\n * The head of a contiguous selection is always the active cell.\n *\n * If there are no cells selected, `{head: null, anchor: null}` is returned.\n *\n * Throws an error if the currently selected cells do not form a contiguous\n * selection.\n */\n getContiguousSelection(): { head: number | null; anchor: number | null } {\n let cells = this.widgets;\n let first = ArrayExt.findFirstIndex(cells, c => this.isSelected(c));\n\n // Return early if no cells are selected.\n if (first === -1) {\n return { head: null, anchor: null };\n }\n\n let last = ArrayExt.findLastIndex(\n cells,\n c => this.isSelected(c),\n -1,\n first\n );\n\n // Check that the selection is contiguous.\n for (let i = first; i <= last; i++) {\n if (!this.isSelected(cells[i])) {\n throw new Error('Selection not contiguous');\n }\n }\n\n // Check that the active cell is one of the endpoints of the selection.\n let activeIndex = this.activeCellIndex;\n if (first !== activeIndex && last !== activeIndex) {\n throw new Error('Active cell not at endpoint of selection');\n }\n\n // Determine the head and anchor of the selection.\n if (first === activeIndex) {\n return { head: first, anchor: last };\n } else {\n return { head: last, anchor: first };\n }\n }\n\n /**\n * Scroll so that the given position is centered.\n *\n * @param position - The vertical position in the notebook widget.\n *\n * @param threshold - An optional threshold for the scroll (0-50, defaults to\n * 25).\n *\n * #### Notes\n * If the position is within the threshold percentage of the widget height,\n * measured from the center of the widget, the scroll position will not be\n * changed. A threshold of 0 means we will always scroll so the position is\n * centered, and a threshold of 50 means scrolling only happens if position is\n * outside the current window.\n */\n scrollToPosition(position: number, threshold = 25): void {\n let node = this.node;\n let ar = node.getBoundingClientRect();\n let delta = position - ar.top - ar.height / 2;\n if (Math.abs(delta) > ar.height * threshold / 100) {\n node.scrollTop += delta;\n }\n }\n\n /**\n * Handle the DOM events for the widget.\n *\n * @param event - The DOM event sent to the widget.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the notebook panel's node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n if (!this.model) {\n return;\n }\n\n switch (event.type) {\n case 'contextmenu':\n if (event.eventPhase === Event.CAPTURING_PHASE) {\n this._evtContextMenuCapture(event as PointerEvent);\n }\n break;\n case 'mousedown':\n if (event.eventPhase === Event.CAPTURING_PHASE) {\n this._evtMouseDownCapture(event as MouseEvent);\n } else {\n this._evtMouseDown(event as MouseEvent);\n }\n break;\n case 'mouseup':\n if (event.currentTarget === document) {\n this._evtDocumentMouseup(event as MouseEvent);\n }\n break;\n case 'mousemove':\n if (event.currentTarget === document) {\n this._evtDocumentMousemove(event as MouseEvent);\n }\n break;\n case 'keydown':\n this._ensureFocus(true);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'focusin':\n this._evtFocusIn(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as MouseEvent);\n break;\n case 'p-dragenter':\n this._evtDragEnter(event as IDragEvent);\n break;\n case 'p-dragleave':\n this._evtDragLeave(event as IDragEvent);\n break;\n case 'p-dragover':\n this._evtDragOver(event as IDragEvent);\n break;\n case 'p-drop':\n this._evtDrop(event as IDragEvent);\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle `after-attach` messages for the widget.\n */\n protected onAfterAttach(msg: Message): void {\n super.onAfterAttach(msg);\n let node = this.node;\n node.addEventListener('contextmenu', this, true);\n node.addEventListener('mousedown', this, true);\n node.addEventListener('mousedown', this);\n node.addEventListener('keydown', this);\n node.addEventListener('dblclick', this);\n node.addEventListener('focusin', this);\n node.addEventListener('focusout', this);\n node.addEventListener('p-dragenter', this);\n node.addEventListener('p-dragleave', this);\n node.addEventListener('p-dragover', this);\n node.addEventListener('p-drop', this);\n }\n\n /**\n * Handle `before-detach` messages for the widget.\n */\n protected onBeforeDetach(msg: Message): void {\n let node = this.node;\n node.removeEventListener('contextmenu', this, true);\n node.removeEventListener('mousedown', this, true);\n node.removeEventListener('mousedown', this);\n node.removeEventListener('keydown', this);\n node.removeEventListener('dblclick', this);\n node.removeEventListener('focusin', this);\n node.removeEventListener('focusout', this);\n node.removeEventListener('p-dragenter', this);\n node.removeEventListener('p-dragleave', this);\n node.removeEventListener('p-dragover', this);\n node.removeEventListener('p-drop', this);\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n }\n\n /**\n * Handle `'activate-request'` messages.\n */\n protected onActivateRequest(msg: Message): void {\n this._ensureFocus(true);\n }\n\n /**\n * Handle `update-request` messages sent to the widget.\n */\n protected onUpdateRequest(msg: Message): void {\n let activeCell = this.activeCell;\n\n // Set the appropriate classes on the cells.\n if (this.mode === 'edit') {\n this.addClass(EDIT_CLASS);\n this.removeClass(COMMAND_CLASS);\n } else {\n this.addClass(COMMAND_CLASS);\n this.removeClass(EDIT_CLASS);\n }\n if (activeCell) {\n activeCell.addClass(ACTIVE_CLASS);\n }\n\n let count = 0;\n each(this.widgets, widget => {\n if (widget !== activeCell) {\n widget.removeClass(ACTIVE_CLASS);\n }\n widget.removeClass(OTHER_SELECTED_CLASS);\n if (this.isSelectedOrActive(widget)) {\n widget.addClass(SELECTED_CLASS);\n count++;\n } else {\n widget.removeClass(SELECTED_CLASS);\n }\n });\n if (count > 1) {\n activeCell.addClass(OTHER_SELECTED_CLASS);\n }\n }\n\n /**\n * Handle a cell being inserted.\n */\n protected onCellInserted(index: number, cell: Cell): void {\n if (this.model && this.model.modelDB.isCollaborative) {\n let modelDB = this.model.modelDB;\n modelDB.connected.then(() => {\n if (!cell.isDisposed) {\n // Setup the selection style for collaborators.\n let localCollaborator = modelDB.collaborators.localCollaborator;\n cell.editor.uuid = localCollaborator.sessionId;\n cell.editor.selectionStyle = {\n ...CodeEditor.defaultSelectionStyle,\n color: localCollaborator.color\n };\n }\n });\n }\n cell.editor.edgeRequested.connect(this._onEdgeRequest, this);\n // If the insertion happened above, increment the active cell\n // index, otherwise it stays the same.\n this.activeCellIndex =\n index <= this.activeCellIndex\n ? this.activeCellIndex + 1\n : this.activeCellIndex;\n }\n\n /**\n * Handle a cell being moved.\n */\n protected onCellMoved(fromIndex: number, toIndex: number): void {\n let i = this.activeCellIndex;\n if (fromIndex === i) {\n this.activeCellIndex = toIndex;\n } else if (fromIndex < i && i <= toIndex) {\n this.activeCellIndex--;\n } else if (toIndex <= i && i < fromIndex) {\n this.activeCellIndex++;\n }\n }\n\n /**\n * Handle a cell being removed.\n */\n protected onCellRemoved(index: number, cell: Cell): void {\n // If the removal happened above, decrement the active\n // cell index, otherwise it stays the same.\n this.activeCellIndex =\n index <= this.activeCellIndex\n ? this.activeCellIndex - 1\n : this.activeCellIndex;\n if (this.isSelected(cell)) {\n this._selectionChanged.emit(void 0);\n }\n }\n\n /**\n * Handle a new model.\n */\n protected onModelChanged(\n oldValue: INotebookModel,\n newValue: INotebookModel\n ): void {\n super.onModelChanged(oldValue, newValue);\n\n // Try to set the active cell index to 0.\n // It will be set to `-1` if there is no new model or the model is empty.\n this.activeCellIndex = 0;\n }\n\n /**\n * Handle edge request signals from cells.\n */\n private _onEdgeRequest(\n editor: CodeEditor.IEditor,\n location: CodeEditor.EdgeLocation\n ): void {\n let prev = this.activeCellIndex;\n if (location === 'top') {\n this.activeCellIndex--;\n // Move the cursor to the first position on the last line.\n if (this.activeCellIndex < prev) {\n let editor = this.activeCell.editor;\n let lastLine = editor.lineCount - 1;\n editor.setCursorPosition({ line: lastLine, column: 0 });\n }\n } else {\n this.activeCellIndex++;\n // Move the cursor to the first character.\n if (this.activeCellIndex > prev) {\n let editor = this.activeCell.editor;\n editor.setCursorPosition({ line: 0, column: 0 });\n }\n }\n this.mode = 'edit';\n }\n\n /**\n * Ensure that the notebook has proper focus.\n */\n private _ensureFocus(force = false): void {\n let activeCell = this.activeCell;\n if (this.mode === 'edit' && activeCell) {\n if (!activeCell.editor.hasFocus()) {\n activeCell.editor.focus();\n }\n }\n if (force && !this.node.contains(document.activeElement)) {\n this.node.focus();\n }\n }\n\n /**\n * Find the cell index containing the target html element.\n *\n * #### Notes\n * Returns -1 if the cell is not found.\n */\n private _findCell(node: HTMLElement): number {\n // Trace up the DOM hierarchy to find the root cell node.\n // Then find the corresponding child and select it.\n while (node && node !== this.node) {\n if (node.classList.contains(NB_CELL_CLASS)) {\n let i = ArrayExt.findFirstIndex(\n this.widgets,\n widget => widget.node === node\n );\n if (i !== -1) {\n return i;\n }\n break;\n }\n node = node.parentElement;\n }\n return -1;\n }\n\n /**\n * Handle `contextmenu` event.\n */\n private _evtContextMenuCapture(event: PointerEvent): void {\n // Allow the event to propagate un-modified if the user\n // is holding the shift-key (and probably requesting\n // the native context menu).\n if (event.shiftKey) {\n return;\n }\n // `event.target` sometimes gives an orphaned node in Firefox 57, which\n // can have `null` anywhere in its parent tree. If we fail to find a\n // cell using `event.target`, try again using a target reconstructed from\n // the position of the click event.\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n target = document.elementFromPoint(\n event.clientX,\n event.clientY\n ) as HTMLElement;\n index = this._findCell(target);\n }\n let widget = this.widgets[index];\n\n if (widget && widget.editorWidget.node.contains(target)) {\n // Prevent CodeMirror from focusing the editor.\n // TODO: find an editor-agnostic solution.\n event.preventDefault();\n }\n }\n\n /**\n * Handle `mousedown` event in the capture phase for the widget.\n */\n private _evtMouseDownCapture(event: MouseEvent): void {\n const { button, shiftKey } = event;\n\n // `event.target` sometimes gives an orphaned node in Firefox 57, which\n // can have `null` anywhere in its parent tree. If we fail to find a\n // cell using `event.target`, try again using a target reconstructed from\n // the position of the click event.\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n target = document.elementFromPoint(\n event.clientX,\n event.clientY\n ) as HTMLElement;\n index = this._findCell(target);\n }\n let widget = this.widgets[index];\n\n // On OS X, the context menu may be triggered with ctrl-left-click. In\n // Firefox, ctrl-left-click gives an event with button 2, but in Chrome,\n // ctrl-left-click gives an event with button 0 with the ctrl modifier.\n if (\n button === 2 &&\n !shiftKey &&\n widget &&\n widget.editorWidget.node.contains(target)\n ) {\n this.mode = 'command';\n\n // Prevent CodeMirror from focusing the editor.\n // TODO: find an editor-agnostic solution.\n event.preventDefault();\n }\n }\n\n /**\n * Handle `mousedown` events for the widget.\n */\n private _evtMouseDown(event: MouseEvent): void {\n const { button, shiftKey } = event;\n\n // We only handle main or secondary button actions.\n if (!(button === 0 || button === 2)) {\n return;\n }\n\n // Shift right-click gives the browser default behavior.\n if (shiftKey && button === 2) {\n return;\n }\n\n // Find the target cell.\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n // `event.target` sometimes gives an orphaned node in\n // Firefox 57, which can have `null` anywhere in its parent line. If we fail\n // to find a cell using `event.target`, try again using a target\n // reconstructed from the position of the click event.\n target = document.elementFromPoint(\n event.clientX,\n event.clientY\n ) as HTMLElement;\n index = this._findCell(target);\n }\n let widget = this.widgets[index];\n\n let targetArea: 'input' | 'prompt' | 'cell' | 'notebook';\n if (widget) {\n if (widget.editorWidget.node.contains(target)) {\n targetArea = 'input';\n } else if (widget.promptNode.contains(target)) {\n targetArea = 'prompt';\n } else {\n targetArea = 'cell';\n }\n } else {\n targetArea = 'notebook';\n }\n\n // Make sure we go to command mode if the click isn't in the cell editor If\n // we do click in the cell editor, the editor handles the focus event to\n // switch to edit mode.\n if (targetArea !== 'input') {\n this.mode = 'command';\n }\n\n if (targetArea === 'notebook') {\n this.deselectAll();\n } else if (targetArea === 'prompt' || targetArea === 'cell') {\n if (button === 0 && shiftKey) {\n // Prevent browser selecting text in prompt or output\n event.preventDefault();\n\n // Shift-click - extend selection\n try {\n this.extendContiguousSelectionTo(index);\n } catch (e) {\n console.error(e);\n this.deselectAll();\n return;\n }\n // Enter selecting mode\n this._mouseMode = 'select';\n document.addEventListener('mouseup', this, true);\n document.addEventListener('mousemove', this, true);\n } else if (button === 0 && !shiftKey) {\n // Prepare to start a drag if we are on the drag region. TODO: If there is no drag, we'll deselect on mouseup.\n if (targetArea === 'prompt' && this.isSelectedOrActive(widget)) {\n // Prepare for a drag start\n this._dragData = {\n pressX: event.clientX,\n pressY: event.clientY,\n index: index\n };\n\n // Enter possible drag mode\n this._mouseMode = 'couldDrag';\n document.addEventListener('mouseup', this, true);\n document.addEventListener('mousemove', this, true);\n event.preventDefault();\n } else {\n this.deselectAll();\n this.activeCellIndex = index;\n }\n } else if (button === 2) {\n if (!this.isSelectedOrActive(widget)) {\n this.deselectAll();\n this.activeCellIndex = index;\n }\n event.preventDefault();\n }\n } else if (targetArea === 'input') {\n if (button === 2 && !this.isSelectedOrActive(widget)) {\n this.deselectAll();\n this.activeCellIndex = index;\n }\n }\n\n // If we didn't set focus above, make sure we get focus now.\n this._ensureFocus(true);\n }\n\n /**\n * Handle the `'mouseup'` event on the document.\n */\n private _evtDocumentMouseup(event: MouseEvent): void {\n // Remove the event listeners we put on the document\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n\n if (this._mouseMode === 'couldDrag') {\n // We didn't end up dragging if we are here, so treat it as a click event.\n\n // Find the target cell.\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n // `event.target` sometimes gives an orphaned node in\n // Firefox 57, which can have `null` anywhere in its parent line. If we fail\n // to find a cell using `event.target`, try again using a target\n // reconstructed from the position of the click event.\n target = document.elementFromPoint(\n event.clientX,\n event.clientY\n ) as HTMLElement;\n index = this._findCell(target);\n }\n\n this.deselectAll();\n this.activeCellIndex = index;\n }\n\n this._mouseMode = null;\n event.preventDefault();\n event.stopPropagation();\n }\n\n /**\n * Handle the `'mousemove'` event for the widget.\n */\n private _evtDocumentMousemove(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n\n // If in select mode, update the selection\n switch (this._mouseMode) {\n case 'select':\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index !== -1) {\n this.extendContiguousSelectionTo(index);\n }\n break;\n case 'couldDrag':\n // Check for a drag initialization.\n let data = this._dragData;\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n if (dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD) {\n this._mouseMode = null;\n this._startDrag(data.index, event.clientX, event.clientY);\n }\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle the `'p-dragenter'` event for the widget.\n */\n private _evtDragEnter(event: IDragEvent): void {\n if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n return;\n }\n\n let widget = (this.layout as PanelLayout).widgets[index];\n widget.node.classList.add(DROP_TARGET_CLASS);\n }\n\n /**\n * Handle the `'p-dragleave'` event for the widget.\n */\n private _evtDragLeave(event: IDragEvent): void {\n if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n let elements = this.node.getElementsByClassName(DROP_TARGET_CLASS);\n if (elements.length) {\n (elements[0] as HTMLElement).classList.remove(DROP_TARGET_CLASS);\n }\n }\n\n /**\n * Handle the `'p-dragover'` event for the widget.\n */\n private _evtDragOver(event: IDragEvent): void {\n if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n let elements = this.node.getElementsByClassName(DROP_TARGET_CLASS);\n if (elements.length) {\n (elements[0] as HTMLElement).classList.remove(DROP_TARGET_CLASS);\n }\n let target = event.target as HTMLElement;\n let index = this._findCell(target);\n if (index === -1) {\n return;\n }\n let widget = (this.layout as PanelLayout).widgets[index];\n widget.node.classList.add(DROP_TARGET_CLASS);\n }\n\n /**\n * Handle the `'p-drop'` event for the widget.\n */\n private _evtDrop(event: IDragEvent): void {\n if (!event.mimeData.hasData(JUPYTER_CELL_MIME)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n let target = event.target as HTMLElement;\n while (target && target.parentElement) {\n if (target.classList.contains(DROP_TARGET_CLASS)) {\n target.classList.remove(DROP_TARGET_CLASS);\n break;\n }\n target = target.parentElement;\n }\n\n let source: Notebook = event.source;\n if (source === this) {\n // Handle the case where we are moving cells within\n // the same notebook.\n event.dropAction = 'move';\n let toMove: Cell[] = event.mimeData.getData('internal:cells');\n\n // Compute the to/from indices for the move.\n let fromIndex = ArrayExt.firstIndexOf(this.widgets, toMove[0]);\n let toIndex = this._findCell(target);\n // This check is needed for consistency with the view.\n if (toIndex !== -1 && toIndex > fromIndex) {\n toIndex -= 1;\n } else if (toIndex === -1) {\n // If the drop is within the notebook but not on any cell,\n // most often this means it is past the cell areas, so\n // set it to move the cells to the end of the notebook.\n toIndex = this.widgets.length - 1;\n }\n // Don't move if we are within the block of selected cells.\n if (toIndex >= fromIndex && toIndex < fromIndex + toMove.length) {\n return;\n }\n\n // Move the cells one by one\n this.model.cells.beginCompoundOperation();\n if (fromIndex < toIndex) {\n each(toMove, cellWidget => {\n this.model.cells.move(fromIndex, toIndex);\n });\n } else if (fromIndex > toIndex) {\n each(toMove, cellWidget => {\n this.model.cells.move(fromIndex++, toIndex++);\n });\n }\n this.model.cells.endCompoundOperation();\n } else {\n // Handle the case where we are copying cells between\n // notebooks.\n event.dropAction = 'copy';\n // Find the target cell and insert the copied cells.\n let index = this._findCell(target);\n if (index === -1) {\n index = this.widgets.length;\n }\n let start = index;\n let model = this.model;\n let values = event.mimeData.getData(JUPYTER_CELL_MIME);\n let factory = model.contentFactory;\n\n // Insert the copies of the original cells.\n model.cells.beginCompoundOperation();\n each(values, (cell: nbformat.ICell) => {\n let value: ICellModel;\n switch (cell.cell_type) {\n case 'code':\n value = factory.createCodeCell({ cell });\n break;\n case 'markdown':\n value = factory.createMarkdownCell({ cell });\n break;\n default:\n value = factory.createRawCell({ cell });\n break;\n }\n model.cells.insert(index++, value);\n });\n model.cells.endCompoundOperation();\n // Select the inserted cells.\n this.deselectAll();\n this.activeCellIndex = start;\n this.extendContiguousSelectionTo(index - 1);\n }\n }\n\n /**\n * Start a drag event.\n */\n private _startDrag(index: number, clientX: number, clientY: number): void {\n let cells = this.model.cells;\n let selected: nbformat.ICell[] = [];\n let toMove: Cell[] = [];\n\n each(this.widgets, (widget, i) => {\n let cell = cells.get(i);\n if (this.isSelectedOrActive(widget)) {\n widget.addClass(DROP_SOURCE_CLASS);\n selected.push(cell.toJSON());\n toMove.push(widget);\n }\n });\n let activeCell = this.activeCell;\n let dragImage: HTMLElement = null;\n let countString: string;\n if (activeCell.model.type === 'code') {\n let executionCount = (activeCell.model as ICodeCellModel).executionCount;\n countString = ' ';\n if (executionCount) {\n countString = executionCount.toString();\n }\n } else {\n countString = '';\n }\n\n // Create the drag image.\n dragImage = Private.createDragImage(\n selected.length,\n countString,\n activeCell.model.value.text.split('\\n')[0].slice(0, 26)\n );\n\n // Set up the drag event.\n this._drag = new Drag({\n mimeData: new MimeData(),\n dragImage,\n supportedActions: 'copy-move',\n proposedAction: 'copy',\n source: this\n });\n this._drag.mimeData.setData(JUPYTER_CELL_MIME, selected);\n // Add mimeData for the fully reified cell widgets, for the\n // case where the target is in the same notebook and we\n // can just move the cells.\n this._drag.mimeData.setData('internal:cells', toMove);\n\n // Remove mousemove and mouseup listeners and start the drag.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n this._mouseMode = null;\n this._drag.start(clientX, clientY).then(action => {\n if (this.isDisposed) {\n return;\n }\n this._drag = null;\n each(toMove, widget => {\n widget.removeClass(DROP_SOURCE_CLASS);\n });\n });\n }\n\n /**\n * Handle `focus` events for the widget.\n */\n private _evtFocusIn(event: MouseEvent): void {\n let target = event.target as HTMLElement;\n\n let i = this._findCell(target);\n if (i !== -1) {\n let widget = this.widgets[i];\n // If the editor itself does not have focus, ensure command mode.\n if (!widget.editorWidget.node.contains(target)) {\n this.mode = 'command';\n }\n this.activeCellIndex = i;\n // If the editor has focus, ensure edit mode.\n let node = widget.editorWidget.node;\n if (node.contains(target)) {\n this.mode = 'edit';\n }\n } else {\n // No cell has focus, ensure command mode.\n this.mode = 'command';\n }\n if (this.mode === 'command' && target !== this.node) {\n delete this.node.dataset[CODE_RUNNER];\n } else {\n this.node.dataset[CODE_RUNNER] = 'true';\n }\n }\n\n /**\n * Handle `focusout` events for the notebook.\n */\n private _evtFocusOut(event: MouseEvent): void {\n let relatedTarget = event.relatedTarget as HTMLElement;\n\n // Bail if the window is losing focus, to preserve edit mode. This test\n // assumes that we explicitly focus things rather than calling blur()\n if (!relatedTarget) {\n return;\n }\n\n // Bail if the item gaining focus is another cell,\n // and we should not be entering command mode.\n const i = this._findCell(relatedTarget);\n if (i !== -1) {\n const widget = this.widgets[i];\n if (widget.editorWidget.node.contains(relatedTarget)) {\n return;\n }\n }\n\n // Otherwise enter command mode.\n this.mode = 'command';\n }\n\n /**\n * Handle `dblclick` events for the widget.\n */\n private _evtDblClick(event: MouseEvent): void {\n let model = this.model;\n if (!model) {\n return;\n }\n this.deselectAll();\n\n // `event.target` sometimes gives an orphaned node in Firefox 57, which\n // can have `null` anywhere in its parent tree. If we fail to find a\n // cell using `event.target`, try again using a target reconstructed from\n // the position of the click event.\n let target = event.target as HTMLElement;\n let i = this._findCell(target);\n if (i === -1) {\n target = document.elementFromPoint(\n event.clientX,\n event.clientY\n ) as HTMLElement;\n i = this._findCell(target);\n }\n\n if (i === -1) {\n return;\n }\n this.activeCellIndex = i;\n if (model.cells.get(i).type === 'markdown') {\n let widget = this.widgets[i] as MarkdownCell;\n widget.rendered = false;\n } else if (target.localName === 'img') {\n target.classList.toggle(UNCONFINED_CLASS);\n }\n }\n\n /**\n * Remove selections from inactive cells to avoid\n * spurious cursors.\n */\n private _trimSelections(): void {\n for (let i = 0; i < this.widgets.length; i++) {\n if (i !== this._activeCellIndex) {\n let cell = this.widgets[i];\n cell.model.selections.delete(cell.editor.uuid);\n }\n }\n }\n\n private _activeCellIndex = -1;\n private _activeCell: Cell | null = null;\n private _mode: NotebookMode = 'command';\n private _drag: Drag = null;\n private _dragData: { pressX: number; pressY: number; index: number } = null;\n private _mouseMode: 'select' | 'couldDrag' | null = null;\n private _activeCellChanged = new Signal<this, Cell>(this);\n private _stateChanged = new Signal<this, IChangedArgs<any>>(this);\n private _selectionChanged = new Signal<this, void>(this);\n}\n\n/**\n * The namespace for the `Notebook` class statics.\n */\nexport namespace Notebook {\n /**\n * An options object for initializing a notebook widget.\n */\n export interface IOptions extends StaticNotebook.IOptions {}\n\n /**\n * The content factory for the notebook widget.\n */\n export interface IContentFactory extends StaticNotebook.IContentFactory {}\n\n /**\n * The default implementation of a notebook content factory..\n *\n * #### Notes\n * Override methods on this class to customize the default notebook factory\n * methods that create notebook content.\n */\n export class ContentFactory extends StaticNotebook.ContentFactory {}\n\n /**\n * A namespace for the notebook content factory.\n */\n export namespace ContentFactory {\n /**\n * An options object for initializing a notebook content factory.\n */\n export interface IOptions extends StaticNotebook.ContentFactory.IOptions {}\n }\n\n export const defaultContentFactory: IContentFactory = new ContentFactory();\n}\n\n/**\n * A namespace for private data.\n */\nnamespace Private {\n /**\n * An attached property for the selected state of a cell.\n */\n export const selectedProperty = new AttachedProperty<Cell, boolean>({\n name: 'selected',\n create: () => false\n });\n\n /**\n * A custom panel layout for the notebook.\n */\n export class NotebookPanelLayout extends PanelLayout {\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * This is a reimplementation of the base class method,\n * and is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {\n // This is a no-op.\n }\n }\n\n /**\n * Create a cell drag image.\n */\n export function createDragImage(\n count: number,\n promptNumber: string,\n cellContent: string\n ): HTMLElement {\n if (count > 1) {\n if (promptNumber !== '') {\n return VirtualDOM.realize(\n h.div(\n h.div(\n { className: DRAG_IMAGE_CLASS },\n h.span(\n { className: CELL_DRAG_PROMPT_CLASS },\n '[' + promptNumber + ']:'\n ),\n h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent)\n ),\n h.div({ className: CELL_DRAG_MULTIPLE_BACK }, '')\n )\n );\n } else {\n return VirtualDOM.realize(\n h.div(\n h.div(\n { className: DRAG_IMAGE_CLASS },\n h.span({ className: CELL_DRAG_PROMPT_CLASS }),\n h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent)\n ),\n h.div({ className: CELL_DRAG_MULTIPLE_BACK }, '')\n )\n );\n }\n } else {\n if (promptNumber !== '') {\n return VirtualDOM.realize(\n h.div(\n h.div(\n { className: `${DRAG_IMAGE_CLASS} ${SINGLE_DRAG_IMAGE_CLASS}` },\n h.span(\n { className: CELL_DRAG_PROMPT_CLASS },\n '[' + promptNumber + ']:'\n ),\n h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent)\n )\n )\n );\n } else {\n return VirtualDOM.realize(\n h.div(\n h.div(\n { className: `${DRAG_IMAGE_CLASS} ${SINGLE_DRAG_IMAGE_CLASS}` },\n h.span({ className: CELL_DRAG_PROMPT_CLASS }),\n h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent)\n )\n )\n );\n }\n }\n }\n\n /**\n * Process the `IOptions` passed to the notebook widget.\n *\n * #### Notes\n * This defaults the content factory to that in the `Notebook` namespace.\n */\n export function processNotebookOptions(options: Notebook.IOptions) {\n if (options.contentFactory) {\n return options;\n } else {\n return {\n rendermime: options.rendermime,\n languagePreference: options.languagePreference,\n contentFactory: Notebook.defaultContentFactory,\n mimeTypeService: options.mimeTypeService\n };\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/notebook",
3
- "version": "0.17.2",
3
+ "version": "0.18.4",
4
4
  "description": "JupyterLab - Notebook",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -30,14 +30,14 @@
30
30
  "watch": "tsc -w --listEmittedFiles"
31
31
  },
32
32
  "dependencies": {
33
- "@jupyterlab/apputils": "^0.17.2",
34
- "@jupyterlab/cells": "^0.17.2",
35
- "@jupyterlab/codeeditor": "^0.17.2",
36
- "@jupyterlab/coreutils": "^2.0.2",
37
- "@jupyterlab/docregistry": "^0.17.2",
38
- "@jupyterlab/observables": "^2.0.2",
39
- "@jupyterlab/rendermime": "^0.17.2",
40
- "@jupyterlab/services": "^3.0.3",
33
+ "@jupyterlab/apputils": "^0.18.4",
34
+ "@jupyterlab/cells": "^0.18.4",
35
+ "@jupyterlab/codeeditor": "^0.18.4",
36
+ "@jupyterlab/coreutils": "^2.1.4",
37
+ "@jupyterlab/docregistry": "^0.18.4",
38
+ "@jupyterlab/observables": "^2.0.7",
39
+ "@jupyterlab/rendermime": "^0.18.4",
40
+ "@jupyterlab/services": "^3.1.4",
41
41
  "@phosphor/algorithm": "^1.1.2",
42
42
  "@phosphor/coreutils": "^1.3.0",
43
43
  "@phosphor/domutils": "^1.1.2",
package/style/index.css CHANGED
@@ -206,9 +206,7 @@
206
206
 
207
207
  .jp-ActiveCellTool {
208
208
  padding: 12px;
209
- border-bottom: 1px solid var(--jp-border-color1);
210
- background-color: var(--jp-layout-color2);
211
- box-shadow: var(--jp-toolbar-box-shadow);
209
+ background-color: var(--jp-layout-color1);
212
210
  border-top: none !important;
213
211
  }
214
212
 
@@ -219,9 +217,12 @@
219
217
 
220
218
  .jp-ActiveCellTool .jp-InputArea-editor {
221
219
  flex: 1 1 auto;
222
- background-color: var(--jp-cell-editor-active-background);
223
- border-color: var(--jp-cell-editor-active-border-color);
224
- box-shadow: var(--jp-cell-editor-box-shadow);
220
+ background: var(--jp-cell-editor-background);
221
+ border-color: var(--jp-cell-editor-border-color);
222
+ }
223
+
224
+ .jp-ActiveCellTool .jp-InputArea-editor .CodeMirror {
225
+ background: transparent;
225
226
  }
226
227
 
227
228
  .jp-CellTools-tool:not(:nth-child(2)) {