Improve handling of optional notebook tracker (#7581)

dependabot/npm_and_yarn/ui-tests/vega-5.31.0
Jeremy Tuloup 1 year ago committed by GitHub
parent 3c4b8b59ba
commit 48e52c759f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -69,8 +69,9 @@ const interfaceSwitcher: JupyterFrontEndPlugin<void> = {
id: '@jupyter-notebook/lab-extension:interface-switcher',
description: 'A plugin to add custom toolbar items to the notebook page.',
autoStart: true,
requires: [ITranslator, INotebookTracker],
requires: [ITranslator],
optional: [
INotebookTracker,
ICommandPalette,
INotebookPathOpener,
INotebookShell,
@ -80,13 +81,18 @@ const interfaceSwitcher: JupyterFrontEndPlugin<void> = {
activate: (
app: JupyterFrontEnd,
translator: ITranslator,
notebookTracker: INotebookTracker,
notebookTracker: INotebookTracker | null,
palette: ICommandPalette | null,
notebookPathOpener: INotebookPathOpener | null,
notebookShell: INotebookShell | null,
labShell: ILabShell | null,
toolbarRegistry: IToolbarWidgetRegistry | null
) => {
if (!notebookTracker) {
// bail if trying to use this plugin without a notebook tracker
return;
}
const { commands, shell } = app;
const baseUrl = PageConfig.getBaseUrl();
const trans = translator.load('notebook');

Loading…
Cancel
Save