Skip to content

Commit

Permalink
Dynamic label for toggle sidebar element in ketboard shortcuts (jupyt…
Browse files Browse the repository at this point in the history
…erlab#16218)

* Dynamic label for toggle sidebar element in ketboard shortcuts

* Adapted review comments.

* Adapting review comments.
  • Loading branch information
itsmevichu authored and gderocher committed Apr 26, 2024
1 parent 785d1b5 commit 75c6ec3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/application-extension/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,20 @@ const mainCommands: JupyterFrontEndPlugin<void> = {
});

commands.addCommand(CommandIDs.toggleSidebarWidget, {
label: trans.__('Toggle Sidebar Element'),
label: args =>
args === undefined ||
args.side === undefined ||
args.index === undefined
? trans.__('Toggle Sidebar Element')
: args.side === 'right'
? trans.__(
'Toggle Element %1 in Right Sidebar',
parseInt(args.index as string, 10) + 1
)
: trans.__(
'Toggle Element %1 in Left Sidebar',
parseInt(args.index as string, 10) + 1
),
execute: args => {
const index = parseInt(args.index as string, 10);
if (args.side != 'left' && args.side != 'right') {
Expand Down

0 comments on commit 75c6ec3

Please sign in to comment.