Fix JSON setting editor not opening issue (#6778) (#6795)

Yanqing Dai 3 years ago committed by GitHub
parent cc454bb0cc
commit 77e591a6bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -273,9 +273,7 @@
],
"@jupyter-notebook/tree-extension": true,
"@jupyterlab/running-extension": true,
"@jupyterlab/settingeditor-extension": [
"@jupyterlab/settingeditor-extension:form-ui"
]
"@jupyterlab/settingeditor-extension": true
},
"/notebooks": {
"@jupyterlab/celltags-extension": true,

@ -24,7 +24,10 @@ import { ISettingRegistry } from '@jupyterlab/settingregistry';
import { IRunningSessionManagers, RunningSessions } from '@jupyterlab/running';
import { ISettingEditorTracker } from '@jupyterlab/settingeditor';
import {
IJSONSettingEditorTracker,
ISettingEditorTracker,
} from '@jupyterlab/settingeditor';
import { ITranslator } from '@jupyterlab/translation';
@ -205,7 +208,11 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
ISettingRegistry,
IToolbarWidgetRegistry,
],
optional: [IRunningSessionManagers, ISettingEditorTracker],
optional: [
IRunningSessionManagers,
ISettingEditorTracker,
IJSONSettingEditorTracker,
],
autoStart: true,
provides: INotebookTree,
activate: (
@ -215,7 +222,8 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
settingRegistry: ISettingRegistry,
toolbarRegistry: IToolbarWidgetRegistry,
manager: IRunningSessionManagers | null,
settingEditorTracker: ISettingEditorTracker | null
settingEditorTracker: ISettingEditorTracker | null,
jsonSettingEditorTracker: IJSONSettingEditorTracker | null
): INotebookTree => {
const nbTreeWidget = new NotebookTreeWidget();
@ -301,13 +309,18 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
app.shell.add(nbTreeWidget, 'main', { rank: 100 });
if (settingEditorTracker) {
settingEditorTracker.widgetAdded.connect((_, editor) => {
nbTreeWidget.addWidget(editor);
nbTreeWidget.tabBar.addTab(editor.title);
nbTreeWidget.currentWidget = editor;
});
}
// add a separate tab for each setting editor
[settingEditorTracker, jsonSettingEditorTracker].forEach(
(editorTracker) => {
if (editorTracker) {
editorTracker.widgetAdded.connect((_, editor) => {
nbTreeWidget.addWidget(editor);
nbTreeWidget.tabBar.addTab(editor.title);
nbTreeWidget.currentWidget = editor;
});
}
}
);
return nbTreeWidget;
},

Loading…
Cancel
Save