Skip to content

Commit

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

* Adapted review comments.

* Adapting review comments.
  • Loading branch information
itsmevichu committed Apr 21, 2024
1 parent ab7e1a1 commit 8819549
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 8819549

Please sign in to comment.