File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change 1111 },
1212 {
1313 "name" : " new-directory" ,
14- "command" : " filebrowser :create-new-directory" ,
14+ "command" : " drives :create-new-directory" ,
1515 "label" : " " ,
1616 "rank" : 10
1717 },
3636 }
3737 ]
3838 },
39+ "jupyter.lab.menus" : {
40+ "context" : [
41+ {
42+ "command" : " filebrowser:create-new-directory" ,
43+ "selector" : " .jp-DirListing-content" ,
44+ "rank" : 55 ,
45+ "disabled" : true
46+ },
47+ {
48+ "command" : " drives:create-new-directory" ,
49+ "selector" : " .jp-DirListing-content" ,
50+ "rank" : 55
51+ }
52+ ]
53+ },
3954 "jupyter.lab.setting-icon" : " jupyter-drives:drive-browser" ,
4055 "jupyter.lab.setting-icon-label" : " Drive Browser" ,
4156 "type" : " object" ,
Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ import { ISettingRegistry } from '@jupyterlab/settingregistry';
2222import {
2323 filterIcon ,
2424 FilenameSearcher ,
25- IScore
25+ IScore ,
26+ newFolderIcon
2627} from '@jupyterlab/ui-components' ;
2728import { CommandRegistry } from '@lumino/commands' ;
2829import { Widget } from '@lumino/widgets' ;
@@ -148,8 +149,9 @@ export const driveFileBrowser: JupyterFrontEndPlugin<void> = {
148149 ) ;
149150
150151 const updateVisibility = ( ) => {
151- // Visibility of command changed.
152+ // Visibility of context menu and toolbar commands changed.
152153 app . commands . notifyCommandChanged ( CommandIDs . createNewDrive ) ;
154+ app . commands . notifyCommandChanged ( CommandIDs . createNewDirectory ) ;
153155 } ;
154156
155157 // Listen for path changes.
@@ -370,5 +372,17 @@ namespace Private {
370372 icon : filterIcon . bindprops ( { stylesheet : 'menuItem' } ) ,
371373 label : 'Toggle File Filter'
372374 } ) ;
375+
376+ app . commands . addCommand ( CommandIDs . createNewDirectory , {
377+ isVisible : ( ) => {
378+ return browser . model . path !== 's3:' ;
379+ } ,
380+ execute : ( ) => {
381+ console . log ( 'NEW COMMAND DIR' ) ;
382+ app . commands . execute ( 'filebrowser:create-new-directory' ) ;
383+ } ,
384+ icon : newFolderIcon . bindprops ( { stylesheet : 'menuItem' } ) ,
385+ label : 'New Folder'
386+ } ) ;
373387 }
374388}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export namespace CommandIDs {
1010 export const createNewDrive = 'drives:create-new-drive' ;
1111 export const launcher = 'launcher:create' ;
1212 export const toggleFileFilter = 'drives:toggle-file-filter' ;
13+ export const createNewDirectory = 'drives:create-new-directory' ;
1314}
1415
1516/**
You can’t perform that action at this time.
0 commit comments