Options
All
  • Public
  • Public/Protected
  • All
Menu

Module docmanager-extension

Index

Variables

Const default

default: JupyterFrontEndPlugin<any>[] = [docManagerPlugin,pathStatusPlugin,savingStatusPlugin,downloadPlugin]

Export the plugins as default.

Const downloadPlugin

downloadPlugin: JupyterFrontEndPlugin<void> = {id: '@jupyterlab/docmanager-extension:download',autoStart: true,requires: [ITranslator, IDocumentManager],optional: [ICommandPalette, IMainMenu],activate: (app: JupyterFrontEnd,translator: ITranslator,docManager: IDocumentManager,palette: ICommandPalette | null,mainMenu: IMainMenu | null) => {const trans = translator.load('jupyterlab');const { commands, shell } = app;const isEnabled = () => {const { currentWidget } = shell;return !!(currentWidget && docManager.contextForWidget(currentWidget));};commands.addCommand(CommandIDs.download, {label: trans.__('Download'),caption: trans.__('Download the file to your computer'),isEnabled,execute: () => {// Checks that shell.currentWidget is valid:if (isEnabled()) {const context = docManager.contextForWidget(shell.currentWidget!);if (!context) {return showDialog({title: trans.__('Cannot Download'),body: trans.__('No context found for current widget!'),buttons: [Dialog.okButton({ label: trans.__('OK') })]});}return context.download();}}});const category = trans.__('File Operations');if (palette) {palette.addItem({ command: CommandIDs.download, category });}if (mainMenu) {mainMenu.fileMenu.addGroup([{ command: CommandIDs.download }], 6);}}}

A plugin providing download commands in the file menu and command palette.

Const pathStatusPlugin

pathStatusPlugin: JupyterFrontEndPlugin<void> = {id: '@jupyterlab/docmanager-extension:path-status',autoStart: true,requires: [IDocumentManager, ILabShell],optional: [IStatusBar],activate: (_: JupyterFrontEnd,docManager: IDocumentManager,labShell: ILabShell,statusBar: IStatusBar | null) => {if (!statusBar) {// Automatically disable if statusbar missingreturn;}const path = new PathStatus({ docManager });// Keep the file path widget up-to-date with the application active widget.path.model!.widget = labShell.currentWidget;labShell.currentChanged.connect(() => {path.model!.widget = labShell.currentWidget;});statusBar.registerStatusItem(pathStatusPlugin.id, {item: path,align: 'right',rank: 0,isActive: () => true});}}

A plugin providing a file path widget to the status bar.

Const savingStatusPlugin

savingStatusPlugin: JupyterFrontEndPlugin<void> = {id: '@jupyterlab/docmanager-extension:saving-status',autoStart: true,requires: [IDocumentManager, ILabShell, ITranslator],optional: [IStatusBar],activate: (_: JupyterFrontEnd,docManager: IDocumentManager,labShell: ILabShell,translator: ITranslator,statusBar: IStatusBar | null) => {if (!statusBar) {// Automatically disable if statusbar missingreturn;}const saving = new SavingStatus({ docManager, translator });// Keep the currently active widget synchronized.saving.model!.widget = labShell.currentWidget;labShell.currentChanged.connect(() => {saving.model!.widget = labShell.currentWidget;});statusBar.registerStatusItem(savingStatusPlugin.id, {item: saving,align: 'middle',isActive: () => true,activeStateChanged: saving.model!.stateChanged});}}

A plugin for adding a saving status item to the status bar.

Generated using TypeDoc