Skip to content

Commit

Permalink
Default current file browser track to the default file browser
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpio committed Jan 25, 2024
1 parent 1145745 commit aa7ecb1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/tree-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
FileBrowser,
Uploader,
IDefaultFileBrowser,
IFileBrowserFactory,
} from '@jupyterlab/filebrowser';

import { ISettingRegistry } from '@jupyterlab/settingregistry';
Expand Down Expand Up @@ -263,6 +264,7 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
ITranslator,
ISettingRegistry,
IToolbarWidgetRegistry,
IFileBrowserFactory,
],
optional: [
IRunningSessionManagers,
Expand All @@ -277,6 +279,7 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
translator: ITranslator,
settingRegistry: ISettingRegistry,
toolbarRegistry: IToolbarWidgetRegistry,
factory: IFileBrowserFactory,
manager: IRunningSessionManagers | null,
settingEditorTracker: ISettingEditorTracker | null,
jsonSettingEditorTracker: IJSONSettingEditorTracker | null
Expand Down Expand Up @@ -381,6 +384,16 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
}
);

// workaround for https://github.com/jupyter/notebook/issues/7210
const { tracker } = factory;

const setCurrentToDefaultBrower = () => {
tracker['_pool'].current = browser;
};

tracker.widgetAdded.connect(setCurrentToDefaultBrower);
setCurrentToDefaultBrower();

return nbTreeWidget;
},
};
Expand Down

0 comments on commit aa7ecb1

Please sign in to comment.