Merge pull request #6377 from jtpio/checkboxes
Show file checkboxes by default in the file browser
@ -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<void> = {
|
||||
app: JupyterFrontEnd,
|
||||
factory: IFileBrowserFactory,
|
||||
translator: ITranslator,
|
||||
settings: ISettingRegistry,
|
||||
settingRegistry: ISettingRegistry,
|
||||
toolbarRegistry: IToolbarWidgetRegistry,
|
||||
manager: IRunningSessionManagers | null
|
||||
): void => {
|
||||
@ -135,7 +143,7 @@ const browserWidget: JupyterFrontEndPlugin<void> = {
|
||||
browser,
|
||||
createToolbarFactory(
|
||||
toolbarRegistry,
|
||||
settings,
|
||||
settingRegistry,
|
||||
FILE_BROWSER_FACTORY,
|
||||
browserWidget.id,
|
||||
translator
|
||||
@ -151,6 +159,19 @@ const browserWidget: JupyterFrontEndPlugin<void> = {
|
||||
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 });
|
||||
}
|
||||
};
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |