@@ -19,7 +19,10 @@ import {
1919 Dialog
2020} from '@jupyterlab/apputils' ;
2121import { ISettingRegistry } from '@jupyterlab/settingregistry' ;
22- import { FilenameSearcher , IScore } from '@jupyterlab/ui-components' ;
22+ import {
23+ FilenameSearcher ,
24+ IScore
25+ } from '@jupyterlab/ui-components' ;
2326import { CommandRegistry } from '@lumino/commands' ;
2427import { Widget } from '@lumino/widgets' ;
2528
@@ -178,7 +181,7 @@ export const driveFileBrowser: JupyterFrontEndPlugin<void> = {
178181 setting . changed . connect ( loadSetting ) ;
179182
180183 // Add commands
181- Private . addCommands ( app , drive ) ;
184+ Private . addCommands ( app , drive , driveBrowser ) ;
182185 } )
183186 . catch ( reason => {
184187 console . error (
@@ -308,7 +311,11 @@ namespace Private {
308311 }
309312 }
310313
311- export function addCommands ( app : JupyterFrontEnd , drive : Drive ) : void {
314+ export function addCommands (
315+ app : JupyterFrontEnd ,
316+ drive : Drive ,
317+ browser : FileBrowser
318+ ) : void {
312319 app . commands . addCommand ( CommandIDs . createNewDrive , {
313320 execute : async ( ) => {
314321 return showDialog ( {
@@ -337,5 +344,19 @@ namespace Private {
337344 selector : '#drive-file-browser.jp-SidePanel .jp-DirListing-content' ,
338345 rank : 100
339346 } ) ;
347+
348+ app . commands . addCommand ( CommandIDs . toggleFileFilter , {
349+ execute : ( ) => {
350+ // Update toggled state, then let the toolbar button update
351+ browser . showFileFilter = ! browser . showFileFilter ;
352+ app . commands . notifyCommandChanged ( CommandIDs . toggleFileFilter ) ;
353+ } ,
354+ isToggled : ( ) => {
355+ const toggled = browser . showFileFilter ;
356+ return toggled ;
357+ } ,
358+ icon : driveBrowserIcon . bindprops ( { stylesheet : 'menuItem' } ) ,
359+ label : 'Toggle File Filter'
360+ } ) ;
340361 }
341362}
0 commit comments