mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-23 12:49:41 +08:00
Workaround for the file browser tracker focus issue (#7224)
* Workaround for the file browser tracker focus issue * fix missing default
This commit is contained in:
parent
1145745651
commit
5d265b90ed
@ -18,6 +18,7 @@ import {
|
||||
FileBrowser,
|
||||
Uploader,
|
||||
IDefaultFileBrowser,
|
||||
IFileBrowserFactory,
|
||||
} from '@jupyterlab/filebrowser';
|
||||
|
||||
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
||||
@ -263,6 +264,7 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
|
||||
ITranslator,
|
||||
ISettingRegistry,
|
||||
IToolbarWidgetRegistry,
|
||||
IFileBrowserFactory,
|
||||
],
|
||||
optional: [
|
||||
IRunningSessionManagers,
|
||||
@ -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
|
||||
@ -381,6 +384,21 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
|
||||
}
|
||||
);
|
||||
|
||||
const { tracker } = factory;
|
||||
|
||||
// TODO: remove
|
||||
// Workaround to force the focus on the default file browser
|
||||
// See https://github.com/jupyterlab/jupyterlab/issues/15629 for more info
|
||||
const setCurrentToDefaultBrower = () => {
|
||||
tracker['_pool'].current = browser;
|
||||
};
|
||||
|
||||
tracker.widgetAdded.connect((sender, widget) =>
|
||||
setCurrentToDefaultBrower()
|
||||
);
|
||||
|
||||
setCurrentToDefaultBrower();
|
||||
|
||||
return nbTreeWidget;
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user