Skip to content

Commit 9541ee4

Browse files
authored
Merge pull request #28 from QuantStack/updateFilebrowser
Update Drive Browser
2 parents 039210a + 6d7d894 commit 9541ee4

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace CommandIDs {
3939
export const openSwitchDrive = 'drives:open-switch-drive-dialog';
4040
export const copyToAnotherBucket = 'drives:copy-to-another-bucket';
4141
export const toggleBucketSwitching = 'drives:toggle-bucket-switching-ui';
42+
export const toggleBrowser = 'filebrowser:toggle-main';
4243
}
4344

4445
const FILE_BROWSER_FACTORY = 'DriveBrowser';
@@ -159,6 +160,28 @@ const defaultFileBrowser: JupyterFrontEndPlugin<IDefaultFileBrowser> = {
159160
return bucketSwitching;
160161
}
161162

163+
// Set attributes when adding the browser to the UI
164+
defaultBrowser.node.setAttribute('role', 'region');
165+
defaultBrowser.node.setAttribute('aria-label', 'Drive Browser Section');
166+
defaultBrowser.title.icon = DriveIcon;
167+
168+
// Show the current file browser shortcut in its title.
169+
const updateBrowserTitle = () => {
170+
const binding = app.commands.keyBindings.find(
171+
b => b.command === CommandIDs.toggleBrowser
172+
);
173+
if (binding) {
174+
const ks = binding.keys.map(CommandRegistry.formatKeystroke).join(', ');
175+
defaultBrowser.title.caption = 'Drive Browser (' + ks + ')';
176+
} else {
177+
defaultBrowser.title.caption = 'Drive Browser';
178+
}
179+
};
180+
updateBrowserTitle();
181+
app.commands.keyBindingChanged.connect(() => {
182+
updateBrowserTitle();
183+
});
184+
162185
// Wait for the application to be restored and for the
163186
// settings and persistent state database to be loaded
164187
app.restored

0 commit comments

Comments
 (0)