@@ -47,6 +47,7 @@ import { Menu, MenuBar } from '@lumino/widgets';
47
47
import { NotebookTreeWidget , INotebookTree } from '@jupyter-notebook/tree' ;
48
48
49
49
import { FilesActionButtons } from './fileactions' ;
50
+ import { INotebookShell } from '@jupyter-notebook/application' ;
50
51
51
52
/**
52
53
* The file browser factory.
@@ -265,6 +266,7 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
265
266
ISettingRegistry ,
266
267
IToolbarWidgetRegistry ,
267
268
IFileBrowserFactory ,
269
+ INotebookShell ,
268
270
] ,
269
271
optional : [
270
272
IRunningSessionManagers ,
@@ -280,13 +282,16 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
280
282
settingRegistry : ISettingRegistry ,
281
283
toolbarRegistry : IToolbarWidgetRegistry ,
282
284
factory : IFileBrowserFactory ,
285
+ notebookShell : INotebookShell ,
283
286
manager : IRunningSessionManagers | null ,
284
287
settingEditorTracker : ISettingEditorTracker | null ,
285
288
jsonSettingEditorTracker : IJSONSettingEditorTracker | null
286
289
) : INotebookTree => {
287
290
const nbTreeWidget = new NotebookTreeWidget ( ) ;
291
+ nbTreeWidget . tabsMovable = false ;
288
292
289
293
const trans = translator . load ( 'notebook' ) ;
294
+ const { tracker } = factory ;
290
295
291
296
browser . title . label = trans . __ ( 'Files' ) ;
292
297
browser . node . setAttribute ( 'role' , 'region' ) ;
@@ -295,7 +300,6 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
295
300
296
301
nbTreeWidget . addWidget ( browser ) ;
297
302
nbTreeWidget . tabBar . addTab ( browser . title ) ;
298
- nbTreeWidget . tabsMovable = false ;
299
303
300
304
toolbarRegistry . addFactory (
301
305
FILE_BROWSER_FACTORY ,
@@ -376,17 +380,30 @@ const notebookTreeWidget: JupyterFrontEndPlugin<INotebookTree> = {
376
380
( editorTracker ) => {
377
381
if ( editorTracker ) {
378
382
editorTracker . widgetAdded . connect ( ( _ , editor ) => {
379
- nbTreeWidget . addWidget ( editor ) ;
383
+ nbTreeWidget . adWidget ( editor ) ;
380
384
nbTreeWidget . tabBar . addTab ( editor . title ) ;
381
385
nbTreeWidget . currentWidget = editor ;
382
386
} ) ;
383
387
}
384
388
}
385
389
) ;
386
390
387
- // workaround for https://github.com/jupyter/notebook/issues/7210
388
- const { tracker } = factory ;
391
+ // add drives to the notebook tree widget
392
+ tracker . forEach ( ( widget ) => {
393
+ // move the additional drives to the notebook tree widget
394
+ if ( widget . model . driveName ) {
395
+ const parent = widget . parent ;
396
+ widget . parent = null ;
397
+ nbTreeWidget . addWidget ( widget ) ;
398
+ widget . title . label = widget . model . driveName ;
399
+ nbTreeWidget . tabBar . addTab ( widget . title ) ;
400
+ parent ?. dispose ( ) ;
401
+ }
402
+ } ) ;
389
403
404
+ // TODO: remove
405
+ // Workaround to force the focus on the default file browser
406
+ // See https://github.com/jupyterlab/jupyterlab/issues/15629 for more info
390
407
const setCurrentToDefaultBrower = ( ) => {
391
408
tracker [ '_pool' ] . current = browser ;
392
409
} ;
0 commit comments