diff --git a/packages/tree-extension/src/index.ts b/packages/tree-extension/src/index.ts index 045e79bdb..359e3bc40 100644 --- a/packages/tree-extension/src/index.ts +++ b/packages/tree-extension/src/index.ts @@ -32,8 +32,16 @@ import { import { Menu, MenuBar, TabPanel } from '@lumino/widgets'; +/** + * The file browser factory. + */ const FILE_BROWSER_FACTORY = 'FileBrowser'; +/** + * The file browser plugin id. + */ +const FILE_BROWSER_PLUGIN_ID = '@jupyterlab/filebrowser-extension:browser'; + /** * Plugin to add extra commands to the file browser to create * new notebooks, files, consoles and terminals @@ -101,7 +109,7 @@ const browserWidget: JupyterFrontEndPlugin = { app: JupyterFrontEnd, factory: IFileBrowserFactory, translator: ITranslator, - settings: ISettingRegistry, + settingRegistry: ISettingRegistry, toolbarRegistry: IToolbarWidgetRegistry, manager: IRunningSessionManagers | null ): void => { @@ -135,7 +143,7 @@ const browserWidget: JupyterFrontEndPlugin = { browser, createToolbarFactory( toolbarRegistry, - settings, + settingRegistry, FILE_BROWSER_FACTORY, browserWidget.id, translator @@ -151,6 +159,19 @@ const browserWidget: JupyterFrontEndPlugin = { tabPanel.tabBar.addTab(running.title); } + // show checkboxes by default if there is no user setting override + const settings = settingRegistry.load(FILE_BROWSER_PLUGIN_ID); + Promise.all([settings, app.restored]) + .then(([settings]) => { + if (settings.user.showFileCheckboxes !== undefined) { + return; + } + void settings.set('showFileCheckboxes', true); + }) + .catch((reason: Error) => { + console.error(reason.message); + }); + app.shell.add(tabPanel, 'main', { rank: 100 }); } }; diff --git a/ui-tests/test/mobile.spec.ts-snapshots/tree-chromium-linux.png b/ui-tests/test/mobile.spec.ts-snapshots/tree-chromium-linux.png index 0a0d2151d..7bee71a56 100644 Binary files a/ui-tests/test/mobile.spec.ts-snapshots/tree-chromium-linux.png and b/ui-tests/test/mobile.spec.ts-snapshots/tree-chromium-linux.png differ diff --git a/ui-tests/test/mobile.spec.ts-snapshots/tree-firefox-linux.png b/ui-tests/test/mobile.spec.ts-snapshots/tree-firefox-linux.png index 7f0e20256..15c4741a1 100644 Binary files a/ui-tests/test/mobile.spec.ts-snapshots/tree-firefox-linux.png and b/ui-tests/test/mobile.spec.ts-snapshots/tree-firefox-linux.png differ diff --git a/ui-tests/test/settings.spec.ts-snapshots/top-hidden-chromium-linux.png b/ui-tests/test/settings.spec.ts-snapshots/top-hidden-chromium-linux.png index 06a75207c..7599338fa 100644 Binary files a/ui-tests/test/settings.spec.ts-snapshots/top-hidden-chromium-linux.png and b/ui-tests/test/settings.spec.ts-snapshots/top-hidden-chromium-linux.png differ diff --git a/ui-tests/test/settings.spec.ts-snapshots/top-hidden-firefox-linux.png b/ui-tests/test/settings.spec.ts-snapshots/top-hidden-firefox-linux.png index a5533f544..e3f9f4621 100644 Binary files a/ui-tests/test/settings.spec.ts-snapshots/top-hidden-firefox-linux.png and b/ui-tests/test/settings.spec.ts-snapshots/top-hidden-firefox-linux.png differ diff --git a/ui-tests/test/settings.spec.ts-snapshots/top-visible-chromium-linux.png b/ui-tests/test/settings.spec.ts-snapshots/top-visible-chromium-linux.png index f4d7b1cde..384881c83 100644 Binary files a/ui-tests/test/settings.spec.ts-snapshots/top-visible-chromium-linux.png and b/ui-tests/test/settings.spec.ts-snapshots/top-visible-chromium-linux.png differ diff --git a/ui-tests/test/settings.spec.ts-snapshots/top-visible-firefox-linux.png b/ui-tests/test/settings.spec.ts-snapshots/top-visible-firefox-linux.png index 0f68636d7..bdcbea587 100644 Binary files a/ui-tests/test/settings.spec.ts-snapshots/top-visible-firefox-linux.png and b/ui-tests/test/settings.spec.ts-snapshots/top-visible-firefox-linux.png differ