|
@@ -2,262 +2,199 @@
|
|
|
// Distributed under the terms of the Modified BSD License.
|
|
|
|
|
|
import {
|
|
|
- ILayoutRestorer, JupyterLab, JupyterLabPlugin
|
|
|
+ ILayoutRestorer,
|
|
|
+ JupyterLab,
|
|
|
+ JupyterLabPlugin
|
|
|
} from '@jupyterlab/application';
|
|
|
|
|
|
import {
|
|
|
- Dialog, ICommandPalette, MainAreaWidget, showDialog
|
|
|
+ Dialog,
|
|
|
+ ICommandPalette,
|
|
|
+ MainAreaWidget,
|
|
|
+ showDialog
|
|
|
} from '@jupyterlab/apputils';
|
|
|
|
|
|
-import {
|
|
|
- CodeCell
|
|
|
-} from '@jupyterlab/cells';
|
|
|
+import { CodeCell } from '@jupyterlab/cells';
|
|
|
|
|
|
-import {
|
|
|
- CodeEditor, IEditorServices
|
|
|
-} from '@jupyterlab/codeeditor';
|
|
|
+import { CodeEditor, IEditorServices } from '@jupyterlab/codeeditor';
|
|
|
|
|
|
import {
|
|
|
- ISettingRegistry, IStateDB, PageConfig, URLExt, uuid
|
|
|
+ ISettingRegistry,
|
|
|
+ IStateDB,
|
|
|
+ PageConfig,
|
|
|
+ URLExt,
|
|
|
+ uuid
|
|
|
} from '@jupyterlab/coreutils';
|
|
|
|
|
|
-import {
|
|
|
- IFileBrowserFactory
|
|
|
-} from '@jupyterlab/filebrowser';
|
|
|
+import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
|
|
|
|
|
|
-import {
|
|
|
- ILauncher
|
|
|
-} from '@jupyterlab/launcher';
|
|
|
+import { ILauncher } from '@jupyterlab/launcher';
|
|
|
|
|
|
import {
|
|
|
- IMainMenu, IEditMenu, IFileMenu, IHelpMenu, IKernelMenu, IRunMenu, IViewMenu
|
|
|
+ IMainMenu,
|
|
|
+ IEditMenu,
|
|
|
+ IFileMenu,
|
|
|
+ IHelpMenu,
|
|
|
+ IKernelMenu,
|
|
|
+ IRunMenu,
|
|
|
+ IViewMenu
|
|
|
} from '@jupyterlab/mainmenu';
|
|
|
|
|
|
import {
|
|
|
- CellTools, ICellTools, INotebookTracker, NotebookActions,
|
|
|
- NotebookModelFactory, NotebookPanel, NotebookTracker, NotebookWidgetFactory,
|
|
|
+ CellTools,
|
|
|
+ ICellTools,
|
|
|
+ INotebookTracker,
|
|
|
+ NotebookActions,
|
|
|
+ NotebookModelFactory,
|
|
|
+ NotebookPanel,
|
|
|
+ NotebookTracker,
|
|
|
+ NotebookWidgetFactory,
|
|
|
StaticNotebook
|
|
|
} from '@jupyterlab/notebook';
|
|
|
|
|
|
-import {
|
|
|
- IRenderMimeRegistry
|
|
|
-} from '@jupyterlab/rendermime';
|
|
|
-
|
|
|
-import {
|
|
|
- ServiceManager
|
|
|
-} from '@jupyterlab/services';
|
|
|
+import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
|
|
|
|
-import {
|
|
|
- ReadonlyJSONObject
|
|
|
-} from '@phosphor/coreutils';
|
|
|
+import { ServiceManager } from '@jupyterlab/services';
|
|
|
|
|
|
-import {
|
|
|
- Message, MessageLoop
|
|
|
-} from '@phosphor/messaging';
|
|
|
+import { ReadonlyJSONObject } from '@phosphor/coreutils';
|
|
|
|
|
|
-import {
|
|
|
- Menu
|
|
|
-} from '@phosphor/widgets';
|
|
|
+import { Message, MessageLoop } from '@phosphor/messaging';
|
|
|
|
|
|
+import { Menu } from '@phosphor/widgets';
|
|
|
|
|
|
/**
|
|
|
* The command IDs used by the notebook plugin.
|
|
|
*/
|
|
|
namespace CommandIDs {
|
|
|
- export
|
|
|
- const createNew = 'notebook:create-new';
|
|
|
+ export const createNew = 'notebook:create-new';
|
|
|
|
|
|
- export
|
|
|
- const interrupt = 'notebook:interrupt-kernel';
|
|
|
+ export const interrupt = 'notebook:interrupt-kernel';
|
|
|
|
|
|
- export
|
|
|
- const restart = 'notebook:restart-kernel';
|
|
|
+ export const restart = 'notebook:restart-kernel';
|
|
|
|
|
|
- export
|
|
|
- const restartClear = 'notebook:restart-clear-output';
|
|
|
+ export const restartClear = 'notebook:restart-clear-output';
|
|
|
|
|
|
- export
|
|
|
- const restartRunAll = 'notebook:restart-run-all';
|
|
|
+ export const restartRunAll = 'notebook:restart-run-all';
|
|
|
|
|
|
- export
|
|
|
- const reconnectToKernel = 'notebook:reconnect-to-kernel';
|
|
|
+ export const reconnectToKernel = 'notebook:reconnect-to-kernel';
|
|
|
|
|
|
- export
|
|
|
- const changeKernel = 'notebook:change-kernel';
|
|
|
+ export const changeKernel = 'notebook:change-kernel';
|
|
|
|
|
|
- export
|
|
|
- const createConsole = 'notebook:create-console';
|
|
|
+ export const createConsole = 'notebook:create-console';
|
|
|
|
|
|
- export
|
|
|
- const createOutputView = 'notebook:create-output-view';
|
|
|
+ export const createOutputView = 'notebook:create-output-view';
|
|
|
|
|
|
- export
|
|
|
- const clearAllOutputs = 'notebook:clear-all-cell-outputs';
|
|
|
+ export const clearAllOutputs = 'notebook:clear-all-cell-outputs';
|
|
|
|
|
|
- export
|
|
|
- const closeAndShutdown = 'notebook:close-and-shutdown';
|
|
|
+ export const closeAndShutdown = 'notebook:close-and-shutdown';
|
|
|
|
|
|
- export
|
|
|
- const trust = 'notebook:trust';
|
|
|
+ export const trust = 'notebook:trust';
|
|
|
|
|
|
- export
|
|
|
- const exportToFormat = 'notebook:export-to-format';
|
|
|
+ export const exportToFormat = 'notebook:export-to-format';
|
|
|
|
|
|
- export
|
|
|
- const run = 'notebook:run-cell';
|
|
|
+ export const run = 'notebook:run-cell';
|
|
|
|
|
|
- export
|
|
|
- const runAndAdvance = 'notebook:run-cell-and-select-next';
|
|
|
+ export const runAndAdvance = 'notebook:run-cell-and-select-next';
|
|
|
|
|
|
- export
|
|
|
- const runAndInsert = 'notebook:run-cell-and-insert-below';
|
|
|
+ export const runAndInsert = 'notebook:run-cell-and-insert-below';
|
|
|
|
|
|
- export
|
|
|
- const runInConsole = 'notebook:run-in-console';
|
|
|
+ export const runInConsole = 'notebook:run-in-console';
|
|
|
|
|
|
- export
|
|
|
- const runAll = 'notebook:run-all-cells';
|
|
|
+ export const runAll = 'notebook:run-all-cells';
|
|
|
|
|
|
- export
|
|
|
- const runAllAbove = 'notebook:run-all-above';
|
|
|
+ export const runAllAbove = 'notebook:run-all-above';
|
|
|
|
|
|
- export
|
|
|
- const runAllBelow = 'notebook:run-all-below';
|
|
|
+ export const runAllBelow = 'notebook:run-all-below';
|
|
|
|
|
|
- export
|
|
|
- const toCode = 'notebook:change-cell-to-code';
|
|
|
+ export const toCode = 'notebook:change-cell-to-code';
|
|
|
|
|
|
- export
|
|
|
- const toMarkdown = 'notebook:change-cell-to-markdown';
|
|
|
+ export const toMarkdown = 'notebook:change-cell-to-markdown';
|
|
|
|
|
|
- export
|
|
|
- const toRaw = 'notebook:change-cell-to-raw';
|
|
|
+ export const toRaw = 'notebook:change-cell-to-raw';
|
|
|
|
|
|
- export
|
|
|
- const cut = 'notebook:cut-cell';
|
|
|
+ export const cut = 'notebook:cut-cell';
|
|
|
|
|
|
- export
|
|
|
- const copy = 'notebook:copy-cell';
|
|
|
+ export const copy = 'notebook:copy-cell';
|
|
|
|
|
|
- export
|
|
|
- const pasteAbove = 'notebook:paste-cell-above';
|
|
|
+ export const pasteAbove = 'notebook:paste-cell-above';
|
|
|
|
|
|
- export
|
|
|
- const pasteBelow = 'notebook:paste-cell-below';
|
|
|
+ export const pasteBelow = 'notebook:paste-cell-below';
|
|
|
|
|
|
- export
|
|
|
- const pasteAndReplace = 'notebook:paste-and-replace-cell';
|
|
|
+ export const pasteAndReplace = 'notebook:paste-and-replace-cell';
|
|
|
|
|
|
- export
|
|
|
- const moveUp = 'notebook:move-cell-up';
|
|
|
+ export const moveUp = 'notebook:move-cell-up';
|
|
|
|
|
|
- export
|
|
|
- const moveDown = 'notebook:move-cell-down';
|
|
|
+ export const moveDown = 'notebook:move-cell-down';
|
|
|
|
|
|
- export
|
|
|
- const clearOutputs = 'notebook:clear-cell-output';
|
|
|
+ export const clearOutputs = 'notebook:clear-cell-output';
|
|
|
|
|
|
- export
|
|
|
- const deleteCell = 'notebook:delete-cell';
|
|
|
+ export const deleteCell = 'notebook:delete-cell';
|
|
|
|
|
|
- export
|
|
|
- const insertAbove = 'notebook:insert-cell-above';
|
|
|
+ export const insertAbove = 'notebook:insert-cell-above';
|
|
|
|
|
|
- export
|
|
|
- const insertBelow = 'notebook:insert-cell-below';
|
|
|
+ export const insertBelow = 'notebook:insert-cell-below';
|
|
|
|
|
|
- export
|
|
|
- const selectAbove = 'notebook:move-cursor-up';
|
|
|
+ export const selectAbove = 'notebook:move-cursor-up';
|
|
|
|
|
|
- export
|
|
|
- const selectBelow = 'notebook:move-cursor-down';
|
|
|
+ export const selectBelow = 'notebook:move-cursor-down';
|
|
|
|
|
|
- export
|
|
|
- const extendAbove = 'notebook:extend-marked-cells-above';
|
|
|
+ export const extendAbove = 'notebook:extend-marked-cells-above';
|
|
|
|
|
|
- export
|
|
|
- const extendBelow = 'notebook:extend-marked-cells-below';
|
|
|
+ export const extendBelow = 'notebook:extend-marked-cells-below';
|
|
|
|
|
|
- export
|
|
|
- const selectAll = 'notebook:select-all';
|
|
|
+ export const selectAll = 'notebook:select-all';
|
|
|
|
|
|
- export
|
|
|
- const deselectAll = 'notebook:deselect-all';
|
|
|
+ export const deselectAll = 'notebook:deselect-all';
|
|
|
|
|
|
- export
|
|
|
- const editMode = 'notebook:enter-edit-mode';
|
|
|
+ export const editMode = 'notebook:enter-edit-mode';
|
|
|
|
|
|
- export
|
|
|
- const merge = 'notebook:merge-cells';
|
|
|
+ export const merge = 'notebook:merge-cells';
|
|
|
|
|
|
- export
|
|
|
- const split = 'notebook:split-cell-at-cursor';
|
|
|
+ export const split = 'notebook:split-cell-at-cursor';
|
|
|
|
|
|
- export
|
|
|
- const commandMode = 'notebook:enter-command-mode';
|
|
|
+ export const commandMode = 'notebook:enter-command-mode';
|
|
|
|
|
|
- export
|
|
|
- const toggleAllLines = 'notebook:toggle-all-cell-line-numbers';
|
|
|
+ export const toggleAllLines = 'notebook:toggle-all-cell-line-numbers';
|
|
|
|
|
|
- export
|
|
|
- const undoCellAction = 'notebook:undo-cell-action';
|
|
|
+ export const undoCellAction = 'notebook:undo-cell-action';
|
|
|
|
|
|
- export
|
|
|
- const redoCellAction = 'notebook:redo-cell-action';
|
|
|
+ export const redoCellAction = 'notebook:redo-cell-action';
|
|
|
|
|
|
- export
|
|
|
- const markdown1 = 'notebook:change-cell-to-heading-1';
|
|
|
+ export const markdown1 = 'notebook:change-cell-to-heading-1';
|
|
|
|
|
|
- export
|
|
|
- const markdown2 = 'notebook:change-cell-to-heading-2';
|
|
|
+ export const markdown2 = 'notebook:change-cell-to-heading-2';
|
|
|
|
|
|
- export
|
|
|
- const markdown3 = 'notebook:change-cell-to-heading-3';
|
|
|
+ export const markdown3 = 'notebook:change-cell-to-heading-3';
|
|
|
|
|
|
- export
|
|
|
- const markdown4 = 'notebook:change-cell-to-heading-4';
|
|
|
+ export const markdown4 = 'notebook:change-cell-to-heading-4';
|
|
|
|
|
|
- export
|
|
|
- const markdown5 = 'notebook:change-cell-to-heading-5';
|
|
|
+ export const markdown5 = 'notebook:change-cell-to-heading-5';
|
|
|
|
|
|
- export
|
|
|
- const markdown6 = 'notebook:change-cell-to-heading-6';
|
|
|
+ export const markdown6 = 'notebook:change-cell-to-heading-6';
|
|
|
|
|
|
- export
|
|
|
- const hideCode = 'notebook:hide-cell-code';
|
|
|
+ export const hideCode = 'notebook:hide-cell-code';
|
|
|
|
|
|
- export
|
|
|
- const showCode = 'notebook:show-cell-code';
|
|
|
+ export const showCode = 'notebook:show-cell-code';
|
|
|
|
|
|
- export
|
|
|
- const hideAllCode = 'notebook:hide-all-cell-code';
|
|
|
+ export const hideAllCode = 'notebook:hide-all-cell-code';
|
|
|
|
|
|
- export
|
|
|
- const showAllCode = 'notebook:show-all-cell-code';
|
|
|
+ export const showAllCode = 'notebook:show-all-cell-code';
|
|
|
|
|
|
- export
|
|
|
- const hideOutput = 'notebook:hide-cell-outputs';
|
|
|
+ export const hideOutput = 'notebook:hide-cell-outputs';
|
|
|
|
|
|
- export
|
|
|
- const showOutput = 'notebook:show-cell-outputs';
|
|
|
+ export const showOutput = 'notebook:show-cell-outputs';
|
|
|
|
|
|
- export
|
|
|
- const hideAllOutputs = 'notebook:hide-all-cell-outputs';
|
|
|
+ export const hideAllOutputs = 'notebook:hide-all-cell-outputs';
|
|
|
|
|
|
- export
|
|
|
- const showAllOutputs = 'notebook:show-all-cell-outputs';
|
|
|
+ export const showAllOutputs = 'notebook:show-all-cell-outputs';
|
|
|
|
|
|
- export
|
|
|
- const enableOutputScrolling = 'notebook:enable-output-scrolling';
|
|
|
+ export const enableOutputScrolling = 'notebook:enable-output-scrolling';
|
|
|
|
|
|
- export
|
|
|
- const disableOutputScrolling = 'notebook:disable-output-scrolling';
|
|
|
+ export const disableOutputScrolling = 'notebook:disable-output-scrolling';
|
|
|
|
|
|
- export
|
|
|
- const saveWithView = 'notebook:save-with-view';
|
|
|
+ export const saveWithView = 'notebook:save-with-view';
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* The class name for the notebook icon from the default theme.
|
|
|
*/
|
|
@@ -272,16 +209,15 @@ const FACTORY = 'Notebook';
|
|
|
* The allowed Export To ... formats and their human readable labels.
|
|
|
*/
|
|
|
const EXPORT_TO_FORMATS = [
|
|
|
- { 'format': 'html', 'label': 'HTML' },
|
|
|
- { 'format': 'latex', 'label': 'LaTeX' },
|
|
|
- { 'format': 'markdown', 'label': 'Markdown' },
|
|
|
- { 'format': 'pdf', 'label': 'PDF' },
|
|
|
- { 'format': 'rst', 'label': 'ReStructured Text' },
|
|
|
- { 'format': 'script', 'label': 'Executable Script' },
|
|
|
- { 'format': 'slides', 'label': 'Reveal.js Slides' }
|
|
|
+ { format: 'html', label: 'HTML' },
|
|
|
+ { format: 'latex', label: 'LaTeX' },
|
|
|
+ { format: 'markdown', label: 'Markdown' },
|
|
|
+ { format: 'pdf', label: 'PDF' },
|
|
|
+ { format: 'rst', label: 'ReStructured Text' },
|
|
|
+ { format: 'script', label: 'Executable Script' },
|
|
|
+ { format: 'slides', label: 'Reveal.js Slides' }
|
|
|
];
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* The notebook widget tracker provider.
|
|
|
*/
|
|
@@ -302,7 +238,6 @@ const trackerPlugin: JupyterLabPlugin<INotebookTracker> = {
|
|
|
autoStart: true
|
|
|
};
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* The notebook cell factory provider.
|
|
|
*/
|
|
@@ -328,18 +263,21 @@ const tools: JupyterLabPlugin<ICellTools> = {
|
|
|
requires: [INotebookTracker, IEditorServices, IStateDB]
|
|
|
};
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* Export the plugins as default.
|
|
|
*/
|
|
|
const plugins: JupyterLabPlugin<any>[] = [factory, trackerPlugin, tools];
|
|
|
export default plugins;
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* Activate the cell tools extension.
|
|
|
*/
|
|
|
-function activateCellTools(app: JupyterLab, tracker: INotebookTracker, editorServices: IEditorServices, state: IStateDB): Promise<ICellTools> {
|
|
|
+function activateCellTools(
|
|
|
+ app: JupyterLab,
|
|
|
+ tracker: INotebookTracker,
|
|
|
+ editorServices: IEditorServices,
|
|
|
+ state: IStateDB
|
|
|
+): Promise<ICellTools> {
|
|
|
const id = 'cell-tools';
|
|
|
const celltools = new CellTools({ tracker });
|
|
|
const activeCellTool = new CellTools.ActiveCellTool();
|
|
@@ -374,7 +312,7 @@ function activateCellTools(app: JupyterLab, tracker: INotebookTracker, editorSer
|
|
|
|
|
|
// Wait until the application has finished restoring before rendering.
|
|
|
Promise.all([state.fetch(id), app.restored]).then(([args]) => {
|
|
|
- const open = !!(args && (args as ReadonlyJSONObject)['open'] as boolean);
|
|
|
+ const open = !!(args && ((args as ReadonlyJSONObject)['open'] as boolean));
|
|
|
|
|
|
// After initial restoration, check if the cell tools should render.
|
|
|
if (tracker.size) {
|
|
@@ -402,11 +340,21 @@ function activateCellTools(app: JupyterLab, tracker: INotebookTracker, editorSer
|
|
|
return Promise.resolve(celltools);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* Activate the notebook handler extension.
|
|
|
*/
|
|
|
-function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette: ICommandPalette, contentFactory: NotebookPanel.IContentFactory, editorServices: IEditorServices, restorer: ILayoutRestorer, rendermime: IRenderMimeRegistry, settingRegistry: ISettingRegistry, browserFactory: IFileBrowserFactory | null, launcher: ILauncher | null): INotebookTracker {
|
|
|
+function activateNotebookHandler(
|
|
|
+ app: JupyterLab,
|
|
|
+ mainMenu: IMainMenu,
|
|
|
+ palette: ICommandPalette,
|
|
|
+ contentFactory: NotebookPanel.IContentFactory,
|
|
|
+ editorServices: IEditorServices,
|
|
|
+ restorer: ILayoutRestorer,
|
|
|
+ rendermime: IRenderMimeRegistry,
|
|
|
+ settingRegistry: ISettingRegistry,
|
|
|
+ browserFactory: IFileBrowserFactory | null,
|
|
|
+ launcher: ILauncher | null
|
|
|
+): INotebookTracker {
|
|
|
const services = app.serviceManager;
|
|
|
// An object for tracking the current notebook settings.
|
|
|
let editorConfig = StaticNotebook.defaultEditorConfig;
|
|
@@ -447,7 +395,9 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
|
|
|
widget.id = widget.id || `notebook-${++id}`;
|
|
|
widget.title.icon = NOTEBOOK_ICON_CLASS;
|
|
|
// Notify the instance tracker if restore data needs to update.
|
|
|
- widget.context.pathChanged.connect(() => { tracker.save(widget); });
|
|
|
+ widget.context.pathChanged.connect(() => {
|
|
|
+ tracker.save(widget);
|
|
|
+ });
|
|
|
// Add the notebook panel to the tracker.
|
|
|
tracker.add(widget);
|
|
|
});
|
|
@@ -456,29 +406,35 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
|
|
|
* Update the setting values.
|
|
|
*/
|
|
|
function updateConfig(settings: ISettingRegistry.ISettings): void {
|
|
|
- let cached =
|
|
|
- settings.get('codeCellConfig').composite as Partial<CodeEditor.IConfig>;
|
|
|
+ let cached = settings.get('codeCellConfig').composite as Partial<
|
|
|
+ CodeEditor.IConfig
|
|
|
+ >;
|
|
|
let code = { ...StaticNotebook.defaultEditorConfig.code };
|
|
|
Object.keys(code).forEach((key: keyof CodeEditor.IConfig) => {
|
|
|
- code[key] = (cached[key] === null || cached[key] === undefined)
|
|
|
- ? code[key]
|
|
|
- : cached[key];
|
|
|
+ code[key] =
|
|
|
+ cached[key] === null || cached[key] === undefined
|
|
|
+ ? code[key]
|
|
|
+ : cached[key];
|
|
|
});
|
|
|
- cached =
|
|
|
- settings.get('markdownCellConfig').composite as Partial<CodeEditor.IConfig>;
|
|
|
+ cached = settings.get('markdownCellConfig').composite as Partial<
|
|
|
+ CodeEditor.IConfig
|
|
|
+ >;
|
|
|
let markdown = { ...StaticNotebook.defaultEditorConfig.markdown };
|
|
|
Object.keys(markdown).forEach((key: keyof CodeEditor.IConfig) => {
|
|
|
- markdown[key] = (cached[key] === null || cached[key] === undefined)
|
|
|
- ? markdown[key]
|
|
|
- : cached[key];
|
|
|
+ markdown[key] =
|
|
|
+ cached[key] === null || cached[key] === undefined
|
|
|
+ ? markdown[key]
|
|
|
+ : cached[key];
|
|
|
});
|
|
|
- cached =
|
|
|
- settings.get('rawCellConfig').composite as Partial<CodeEditor.IConfig>;
|
|
|
+ cached = settings.get('rawCellConfig').composite as Partial<
|
|
|
+ CodeEditor.IConfig
|
|
|
+ >;
|
|
|
let raw = { ...StaticNotebook.defaultEditorConfig.raw };
|
|
|
Object.keys(raw).forEach((key: keyof CodeEditor.IConfig) => {
|
|
|
- raw[key] = (cached[key] === null || cached[key] === undefined)
|
|
|
- ? raw[key]
|
|
|
- : cached[key];
|
|
|
+ raw[key] =
|
|
|
+ cached[key] === null || cached[key] === undefined
|
|
|
+ ? raw[key]
|
|
|
+ : cached[key];
|
|
|
});
|
|
|
factory.editorConfig = editorConfig = { code, markdown, raw };
|
|
|
}
|
|
@@ -487,57 +443,63 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
|
|
|
* Update the settings of the current tracker instances.
|
|
|
*/
|
|
|
function updateTracker(): void {
|
|
|
- tracker.forEach(widget => { widget.content.editorConfig = editorConfig; });
|
|
|
+ tracker.forEach(widget => {
|
|
|
+ widget.content.editorConfig = editorConfig;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
// Fetch the initial state of the settings.
|
|
|
- Promise.all([settingRegistry.load(trackerPlugin.id), restored]).then(([settings]) => {
|
|
|
- updateConfig(settings);
|
|
|
- updateTracker();
|
|
|
- settings.changed.connect(() => {
|
|
|
+ Promise.all([settingRegistry.load(trackerPlugin.id), restored])
|
|
|
+ .then(([settings]) => {
|
|
|
updateConfig(settings);
|
|
|
updateTracker();
|
|
|
+ settings.changed.connect(() => {
|
|
|
+ updateConfig(settings);
|
|
|
+ updateTracker();
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch((reason: Error) => {
|
|
|
+ console.error(reason.message);
|
|
|
+ updateTracker();
|
|
|
});
|
|
|
- }).catch((reason: Error) => {
|
|
|
- console.error(reason.message);
|
|
|
- updateTracker();
|
|
|
- });
|
|
|
|
|
|
// Add main menu notebook menu.
|
|
|
populateMenus(app, mainMenu, tracker);
|
|
|
|
|
|
// Utility function to create a new notebook.
|
|
|
const createNew = (cwd: string, kernelName?: string) => {
|
|
|
- return commands.execute(
|
|
|
- 'docmanager:new-untitled', { path: cwd, type: 'notebook' }
|
|
|
- ).then(model => {
|
|
|
- return commands.execute('docmanager:open', {
|
|
|
- path: model.path, factory: FACTORY,
|
|
|
- kernel: { name: kernelName }
|
|
|
+ return commands
|
|
|
+ .execute('docmanager:new-untitled', { path: cwd, type: 'notebook' })
|
|
|
+ .then(model => {
|
|
|
+ return commands.execute('docmanager:open', {
|
|
|
+ path: model.path,
|
|
|
+ factory: FACTORY,
|
|
|
+ kernel: { name: kernelName }
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
};
|
|
|
|
|
|
// Add a command for creating a new notebook.
|
|
|
commands.addCommand(CommandIDs.createNew, {
|
|
|
label: args => {
|
|
|
- const kernelName = args['kernelName'] as string || '';
|
|
|
+ const kernelName = (args['kernelName'] as string) || '';
|
|
|
if (args['isLauncher'] && args['kernelName']) {
|
|
|
return services.specs.kernelspecs[kernelName].display_name;
|
|
|
}
|
|
|
return 'Notebook';
|
|
|
},
|
|
|
caption: 'Create a new notebook',
|
|
|
- iconClass: args => args['isLauncher'] ? '' : 'jp-NotebookIcon',
|
|
|
+ iconClass: args => (args['isLauncher'] ? '' : 'jp-NotebookIcon'),
|
|
|
execute: args => {
|
|
|
- const cwd = args['cwd'] || browserFactory ?
|
|
|
- browserFactory.defaultBrowser.model.path : '';
|
|
|
- const kernelName = args['kernelName'] as string || '';
|
|
|
+ const cwd =
|
|
|
+ args['cwd'] || browserFactory
|
|
|
+ ? browserFactory.defaultBrowser.model.path
|
|
|
+ : '';
|
|
|
+ const kernelName = (args['kernelName'] as string) || '';
|
|
|
return createNew(cwd, kernelName);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-
|
|
|
// Add a launcher item if the launcher is available.
|
|
|
if (launcher) {
|
|
|
services.ready.then(() => {
|
|
@@ -626,7 +588,6 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
|
|
|
rank: 11
|
|
|
});
|
|
|
|
|
|
-
|
|
|
// Notebook context menu groups
|
|
|
app.contextMenu.addItem({
|
|
|
command: CommandIDs.clearAllOutputs,
|
|
@@ -682,12 +643,14 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
|
|
|
return tracker;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* Add the notebook commands to the application's command registry.
|
|
|
*/
|
|
|
-function addCommands(app: JupyterLab, services: ServiceManager, tracker: NotebookTracker): void {
|
|
|
+function addCommands(
|
|
|
+ app: JupyterLab,
|
|
|
+ services: ServiceManager,
|
|
|
+ tracker: NotebookTracker
|
|
|
+): void {
|
|
|
const { commands, shell } = app;
|
|
|
|
|
|
// Get the current widget and activate unless the args specify otherwise.
|
|
@@ -706,15 +669,19 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
* Whether there is an active notebook.
|
|
|
*/
|
|
|
function isEnabled(): boolean {
|
|
|
- return tracker.currentWidget !== null &&
|
|
|
- tracker.currentWidget === app.shell.currentWidget;
|
|
|
+ return (
|
|
|
+ tracker.currentWidget !== null &&
|
|
|
+ tracker.currentWidget === app.shell.currentWidget
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Whether there is an notebook active, with a single selected cell.
|
|
|
*/
|
|
|
function isEnabledAndSingleSelected(): boolean {
|
|
|
- if (!isEnabled()) { return false; }
|
|
|
+ if (!isEnabled()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
const { content } = tracker.currentWidget;
|
|
|
const index = content.activeCellIndex;
|
|
|
// If there are selections that are not the active cell,
|
|
@@ -741,7 +708,7 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
isEnabled
|
|
|
});
|
|
|
commands.addCommand(CommandIDs.run, {
|
|
|
- label: 'Run Selected Cells and Don\'t Advance',
|
|
|
+ label: "Run Selected Cells and Don't Advance",
|
|
|
execute: args => {
|
|
|
const current = getCurrent(args);
|
|
|
|
|
@@ -771,7 +738,7 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
execute: args => {
|
|
|
// Default to not activating the notebook (thereby putting the notebook
|
|
|
// into command mode)
|
|
|
- const current = getCurrent({activate: false, ...args});
|
|
|
+ const current = getCurrent({ activate: false, ...args });
|
|
|
|
|
|
if (current) {
|
|
|
const { context, content } = current;
|
|
@@ -780,7 +747,7 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
let path = context.path;
|
|
|
// ignore action in non-code cell
|
|
|
if (!cell || cell.model.type !== 'code') {
|
|
|
- return Promise.resolve(void 0);
|
|
|
+ return Promise.resolve(void 0);
|
|
|
}
|
|
|
|
|
|
let code = '';
|
|
@@ -799,17 +766,26 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
code = editor.getLine(selection.start.line);
|
|
|
const cursor = editor.getCursorPosition();
|
|
|
if (cursor.line + 1 !== editor.lineCount) {
|
|
|
- editor.setCursorPosition({ line: cursor.line + 1, column: cursor.column });
|
|
|
+ editor.setCursorPosition({
|
|
|
+ line: cursor.line + 1,
|
|
|
+ column: cursor.column
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
// open a console, create if needed
|
|
|
if (code) {
|
|
|
- return commands.execute('console:open', {
|
|
|
+ return commands
|
|
|
+ .execute('console:open', {
|
|
|
path,
|
|
|
insertMode: 'split-bottom',
|
|
|
activate: false
|
|
|
- }).then((panel) => {
|
|
|
- commands.execute('console:inject', { activate: false, code, path });
|
|
|
+ })
|
|
|
+ .then(panel => {
|
|
|
+ commands.execute('console:inject', {
|
|
|
+ activate: false,
|
|
|
+ code,
|
|
|
+ path
|
|
|
+ });
|
|
|
});
|
|
|
} else {
|
|
|
return Promise.resolve(void 0);
|
|
@@ -845,8 +821,10 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
isEnabled: () => {
|
|
|
// Can't run above if there are multiple cells selected,
|
|
|
// or if we are at the top of the notebook.
|
|
|
- return isEnabledAndSingleSelected() &&
|
|
|
- tracker.currentWidget.content.activeCellIndex !== 0;
|
|
|
+ return (
|
|
|
+ isEnabledAndSingleSelected() &&
|
|
|
+ tracker.currentWidget.content.activeCellIndex !== 0
|
|
|
+ );
|
|
|
}
|
|
|
});
|
|
|
commands.addCommand(CommandIDs.runAllBelow, {
|
|
@@ -863,9 +841,11 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
isEnabled: () => {
|
|
|
// Can't run below if there are multiple cells selected,
|
|
|
// or if we are at the bottom of the notebook.
|
|
|
- return isEnabledAndSingleSelected() &&
|
|
|
- tracker.currentWidget.content.activeCellIndex !==
|
|
|
- tracker.currentWidget.content.widgets.length - 1;
|
|
|
+ return (
|
|
|
+ isEnabledAndSingleSelected() &&
|
|
|
+ tracker.currentWidget.content.activeCellIndex !==
|
|
|
+ tracker.currentWidget.content.widgets.length - 1
|
|
|
+ );
|
|
|
}
|
|
|
});
|
|
|
commands.addCommand(CommandIDs.restart, {
|
|
@@ -896,8 +876,9 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
buttons: [Dialog.cancelButton(), Dialog.warnButton()]
|
|
|
}).then(result => {
|
|
|
if (result.button.accept) {
|
|
|
- return current.context.session.shutdown()
|
|
|
- .then(() => { current.dispose(); });
|
|
|
+ return current.context.session.shutdown().then(() => {
|
|
|
+ current.dispose();
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -918,9 +899,9 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
});
|
|
|
commands.addCommand(CommandIDs.exportToFormat, {
|
|
|
label: args => {
|
|
|
- const formatLabel = (args['label']) as string;
|
|
|
+ const formatLabel = args['label'] as string;
|
|
|
|
|
|
- return (args['isPalette'] ? 'Export Notebook to ' : '') + formatLabel;
|
|
|
+ return (args['isPalette'] ? 'Export Notebook to ' : '') + formatLabel;
|
|
|
},
|
|
|
execute: args => {
|
|
|
const current = getCurrent(args);
|
|
@@ -930,20 +911,23 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
}
|
|
|
|
|
|
const notebookPath = URLExt.encodeParts(current.context.path);
|
|
|
- const url = URLExt.join(
|
|
|
- services.serverSettings.baseUrl,
|
|
|
- 'nbconvert',
|
|
|
- (args['format']) as string,
|
|
|
- notebookPath
|
|
|
- ) + '?download=true';
|
|
|
+ const url =
|
|
|
+ URLExt.join(
|
|
|
+ services.serverSettings.baseUrl,
|
|
|
+ 'nbconvert',
|
|
|
+ args['format'] as string,
|
|
|
+ notebookPath
|
|
|
+ ) + '?download=true';
|
|
|
const child = window.open('', '_blank');
|
|
|
const { context } = current;
|
|
|
|
|
|
if (context.model.dirty && !context.model.readOnly) {
|
|
|
- return context.save().then(() => { child.location.assign(url); });
|
|
|
+ return context.save().then(() => {
|
|
|
+ child.location.assign(url);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- return new Promise<void>((resolve) => {
|
|
|
+ return new Promise<void>(resolve => {
|
|
|
child.location.assign(url);
|
|
|
resolve(undefined);
|
|
|
});
|
|
@@ -958,8 +942,9 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
if (current) {
|
|
|
const { content, session } = current;
|
|
|
|
|
|
- return session.restart()
|
|
|
- .then(() => { NotebookActions.clearAllOutputs(content); });
|
|
|
+ return session.restart().then(() => {
|
|
|
+ NotebookActions.clearAllOutputs(content);
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
isEnabled
|
|
@@ -1347,11 +1332,14 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
widget.id = `LinkedOutputView-${uuid()}`;
|
|
|
widget.title.label = 'Output View';
|
|
|
widget.title.icon = NOTEBOOK_ICON_CLASS;
|
|
|
- widget.title.caption = current.title.label ? `For Notebook: ${current.title.label}` : 'For Notebook:';
|
|
|
+ widget.title.caption = current.title.label
|
|
|
+ ? `For Notebook: ${current.title.label}`
|
|
|
+ : 'For Notebook:';
|
|
|
widget.addClass('jp-LinkedOutputView');
|
|
|
- current.context.addSibling(
|
|
|
- widget, { ref: current.id, mode: 'split-bottom' }
|
|
|
- );
|
|
|
+ current.context.addSibling(widget, {
|
|
|
+ ref: current.id,
|
|
|
+ mode: 'split-bottom'
|
|
|
+ });
|
|
|
|
|
|
// Remove the output view if the parent notebook is closed.
|
|
|
nb.disposed.connect(widget.dispose);
|
|
@@ -1570,7 +1558,6 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* Populate the application's command palette with notebook commands.
|
|
|
*/
|
|
@@ -1597,13 +1584,15 @@ function populatePalette(palette: ICommandPalette): void {
|
|
|
CommandIDs.closeAndShutdown,
|
|
|
CommandIDs.trust,
|
|
|
CommandIDs.saveWithView
|
|
|
- ].forEach(command => { palette.addItem({ command, category }); });
|
|
|
+ ].forEach(command => {
|
|
|
+ palette.addItem({ command, category });
|
|
|
+ });
|
|
|
|
|
|
EXPORT_TO_FORMATS.forEach(exportToFormat => {
|
|
|
let args = {
|
|
|
- 'format': exportToFormat['format'],
|
|
|
- 'label': exportToFormat['label'],
|
|
|
- 'isPalette': true
|
|
|
+ format: exportToFormat['format'],
|
|
|
+ label: exportToFormat['label'],
|
|
|
+ isPalette: true
|
|
|
};
|
|
|
palette.addItem({ command: CommandIDs.exportToFormat, category, args });
|
|
|
});
|
|
@@ -1652,21 +1641,30 @@ function populatePalette(palette: ICommandPalette): void {
|
|
|
CommandIDs.showAllOutputs,
|
|
|
CommandIDs.enableOutputScrolling,
|
|
|
CommandIDs.disableOutputScrolling
|
|
|
- ].forEach(command => { palette.addItem({ command, category }); });
|
|
|
+ ].forEach(command => {
|
|
|
+ palette.addItem({ command, category });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* Populates the application menus for the notebook.
|
|
|
*/
|
|
|
-function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookTracker): void {
|
|
|
+function populateMenus(
|
|
|
+ app: JupyterLab,
|
|
|
+ mainMenu: IMainMenu,
|
|
|
+ tracker: INotebookTracker
|
|
|
+): void {
|
|
|
let { commands } = app;
|
|
|
|
|
|
// Add undo/redo hooks to the edit menu.
|
|
|
mainMenu.editMenu.undoers.add({
|
|
|
tracker,
|
|
|
- undo: widget => { widget.content.activeCell.editor.undo(); },
|
|
|
- redo: widget => { widget.content.activeCell.editor.redo(); }
|
|
|
+ undo: widget => {
|
|
|
+ widget.content.activeCell.editor.undo();
|
|
|
+ },
|
|
|
+ redo: widget => {
|
|
|
+ widget.content.activeCell.editor.redo();
|
|
|
+ }
|
|
|
} as IEditMenu.IUndoer<NotebookPanel>);
|
|
|
|
|
|
// Add a clearer to the edit menu
|
|
@@ -1698,8 +1696,9 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
|
|
|
buttons: [Dialog.cancelButton(), Dialog.warnButton()]
|
|
|
}).then(result => {
|
|
|
if (result.button.accept) {
|
|
|
- return current.context.session.shutdown()
|
|
|
- .then(() => { current.dispose(); });
|
|
|
+ return current.context.session.shutdown().then(() => {
|
|
|
+ current.dispose();
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -1717,10 +1716,13 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
|
|
|
} as IFileMenu.IPersistAndSave<NotebookPanel>);
|
|
|
|
|
|
// Add a notebook group to the File menu.
|
|
|
- let exportTo = new Menu({ commands } );
|
|
|
+ let exportTo = new Menu({ commands });
|
|
|
exportTo.title.label = 'Export Notebook As…';
|
|
|
EXPORT_TO_FORMATS.forEach(exportToFormat => {
|
|
|
- exportTo.addItem({ command: CommandIDs.exportToFormat, args: exportToFormat });
|
|
|
+ exportTo.addItem({
|
|
|
+ command: CommandIDs.exportToFormat,
|
|
|
+ args: exportToFormat
|
|
|
+ });
|
|
|
});
|
|
|
const fileGroup = [
|
|
|
{ command: CommandIDs.trust },
|
|
@@ -1749,7 +1751,7 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
|
|
|
});
|
|
|
},
|
|
|
changeKernel: current => current.session.selectKernel(),
|
|
|
- shutdownKernel: current => current.session.shutdown(),
|
|
|
+ shutdownKernel: current => current.session.shutdown()
|
|
|
} as IKernelMenu.IKernelUser<NotebookPanel>);
|
|
|
|
|
|
// Add a console creator the the Kernel menu
|
|
@@ -1774,7 +1776,9 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
|
|
|
CommandIDs.hideOutput,
|
|
|
CommandIDs.hideAllCode,
|
|
|
CommandIDs.hideAllOutputs
|
|
|
- ].map(command => { return { command }; });
|
|
|
+ ].map(command => {
|
|
|
+ return { command };
|
|
|
+ });
|
|
|
mainMenu.viewMenu.addGroup(collapseGroup, 10);
|
|
|
|
|
|
const expandGroup = [
|
|
@@ -1782,7 +1786,9 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
|
|
|
CommandIDs.showOutput,
|
|
|
CommandIDs.showAllCode,
|
|
|
CommandIDs.showAllOutputs
|
|
|
- ].map(command => { return { command }; });
|
|
|
+ ].map(command => {
|
|
|
+ return { command };
|
|
|
+ });
|
|
|
mainMenu.viewMenu.addGroup(expandGroup, 11);
|
|
|
|
|
|
// Add an IEditorViewer to the application view menu
|
|
@@ -1793,8 +1799,11 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
|
|
|
},
|
|
|
lineNumbersToggled: widget => {
|
|
|
const config = widget.content.editorConfig;
|
|
|
- return !!(config.code.lineNumbers && config.markdown.lineNumbers &&
|
|
|
- config.raw.lineNumbers);
|
|
|
+ return !!(
|
|
|
+ config.code.lineNumbers &&
|
|
|
+ config.markdown.lineNumbers &&
|
|
|
+ config.raw.lineNumbers
|
|
|
+ );
|
|
|
}
|
|
|
} as IViewMenu.IEditorViewer<NotebookPanel>);
|
|
|
|
|
@@ -1804,18 +1813,19 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
|
|
|
noun: 'Cells',
|
|
|
run: current => {
|
|
|
const { context, content } = current;
|
|
|
- return NotebookActions.runAndAdvance(content, context.session)
|
|
|
- .then(() => void 0);
|
|
|
+ return NotebookActions.runAndAdvance(content, context.session).then(
|
|
|
+ () => void 0
|
|
|
+ );
|
|
|
},
|
|
|
runAll: current => {
|
|
|
const { context, content } = current;
|
|
|
- return NotebookActions.runAll(content, context.session)
|
|
|
- .then(() => void 0);
|
|
|
+ return NotebookActions.runAll(content, context.session).then(
|
|
|
+ () => void 0
|
|
|
+ );
|
|
|
},
|
|
|
restartAndRunAll: current => {
|
|
|
const { context, content } = current;
|
|
|
- return context.session.restart()
|
|
|
- .then(restarted => {
|
|
|
+ return context.session.restart().then(restarted => {
|
|
|
if (restarted) {
|
|
|
NotebookActions.runAll(content, context.session);
|
|
|
}
|
|
@@ -1828,44 +1838,52 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
|
|
|
const runExtras = [
|
|
|
CommandIDs.runAndInsert,
|
|
|
CommandIDs.run,
|
|
|
- CommandIDs.runInConsole,
|
|
|
- ].map(command => { return { command }; });
|
|
|
+ CommandIDs.runInConsole
|
|
|
+ ].map(command => {
|
|
|
+ return { command };
|
|
|
+ });
|
|
|
|
|
|
// Add a run all above/below group to the run menu.
|
|
|
const runAboveBelowGroup = [
|
|
|
CommandIDs.runAllAbove,
|
|
|
CommandIDs.runAllBelow
|
|
|
- ].map(command => { return { command }; });
|
|
|
+ ].map(command => {
|
|
|
+ return { command };
|
|
|
+ });
|
|
|
|
|
|
// Add commands to the application edit menu.
|
|
|
const undoCellActionGroup = [
|
|
|
CommandIDs.undoCellAction,
|
|
|
CommandIDs.redoCellAction
|
|
|
- ].map(command => { return { command }; });
|
|
|
+ ].map(command => {
|
|
|
+ return { command };
|
|
|
+ });
|
|
|
|
|
|
const copyGroup = [
|
|
|
CommandIDs.cut,
|
|
|
CommandIDs.copy,
|
|
|
CommandIDs.pasteBelow,
|
|
|
CommandIDs.pasteAbove,
|
|
|
- CommandIDs.pasteAndReplace,
|
|
|
- ].map(command => { return { command }; });
|
|
|
-
|
|
|
- const selectGroup = [
|
|
|
- CommandIDs.selectAll,
|
|
|
- CommandIDs.deselectAll,
|
|
|
- ].map(command => { return { command }; });
|
|
|
+ CommandIDs.pasteAndReplace
|
|
|
+ ].map(command => {
|
|
|
+ return { command };
|
|
|
+ });
|
|
|
|
|
|
- const splitMergeGroup = [
|
|
|
- CommandIDs.split,
|
|
|
- CommandIDs.merge
|
|
|
- ].map(command => { return { command }; });
|
|
|
+ const selectGroup = [CommandIDs.selectAll, CommandIDs.deselectAll].map(
|
|
|
+ command => {
|
|
|
+ return { command };
|
|
|
+ }
|
|
|
+ );
|
|
|
|
|
|
- const moveCellsGroup = [
|
|
|
- CommandIDs.moveUp,
|
|
|
- CommandIDs.moveDown
|
|
|
- ].map(command => { return { command }; });
|
|
|
+ const splitMergeGroup = [CommandIDs.split, CommandIDs.merge].map(command => {
|
|
|
+ return { command };
|
|
|
+ });
|
|
|
|
|
|
+ const moveCellsGroup = [CommandIDs.moveUp, CommandIDs.moveDown].map(
|
|
|
+ command => {
|
|
|
+ return { command };
|
|
|
+ }
|
|
|
+ );
|
|
|
|
|
|
mainMenu.editMenu.addGroup(undoCellActionGroup, 4);
|
|
|
mainMenu.editMenu.addGroup(copyGroup, 5);
|