Skip to content

Commit

Permalink
Merge pull request #28 from QuantStack/updateFilebrowser
Browse files Browse the repository at this point in the history
Update Drive Browser
  • Loading branch information
DenisaCG authored Oct 14, 2024
2 parents 039210a + 6d7d894 commit 9541ee4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace CommandIDs {
export const openSwitchDrive = 'drives:open-switch-drive-dialog';
export const copyToAnotherBucket = 'drives:copy-to-another-bucket';
export const toggleBucketSwitching = 'drives:toggle-bucket-switching-ui';
export const toggleBrowser = 'filebrowser:toggle-main';
}

const FILE_BROWSER_FACTORY = 'DriveBrowser';
Expand Down Expand Up @@ -159,6 +160,28 @@ const defaultFileBrowser: JupyterFrontEndPlugin<IDefaultFileBrowser> = {
return bucketSwitching;
}

// Set attributes when adding the browser to the UI
defaultBrowser.node.setAttribute('role', 'region');
defaultBrowser.node.setAttribute('aria-label', 'Drive Browser Section');
defaultBrowser.title.icon = DriveIcon;

// Show the current file browser shortcut in its title.
const updateBrowserTitle = () => {
const binding = app.commands.keyBindings.find(
b => b.command === CommandIDs.toggleBrowser
);
if (binding) {
const ks = binding.keys.map(CommandRegistry.formatKeystroke).join(', ');
defaultBrowser.title.caption = 'Drive Browser (' + ks + ')';
} else {
defaultBrowser.title.caption = 'Drive Browser';
}
};
updateBrowserTitle();
app.commands.keyBindingChanged.connect(() => {
updateBrowserTitle();
});

// Wait for the application to be restored and for the
// settings and persistent state database to be loaded
app.restored
Expand Down

0 comments on commit 9541ee4

Please sign in to comment.