-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow a custom label for menu items, overriding the command name #570
Comments
Thank you for opening this. It looks like a reasonable additive change, I do not see any downsides.
This is currently accomplished by functional labels, e.g. for command palette we use longer label by checking for
The first problem is a design question - should menus be:
(b) would imply small changes to where localisation of label would need to happen (in package with command or package with menu, only of practical significance when reusing command in third-party package), but I think it is reasonable. |
Some thoughts, if we want to improve application performance, we should move towards having a no-code description of entry points such as commands in menus or toolbars. This means that we indeed have two paths for customization, allow the command consumer (i.e. menus or toolbars) to override the default command attribute (low code approach) or we go with a code approach like the one suggested by Mike above. But this definitely converge to design questions raised above (and not only for menus):
The second one is easier and more customizable (you may not have the power to customize the label of command from an external source). The first one ease code understanding by having a single source of truth.
|
Problem
Found while working on a fix for jupyter/notebook#6806.
When I create a menu item based on a command, the command's
label
is the only possible label for the menu item:lumino/packages/widgets/src/menu.ts
Line 1770 in f3ca270
I would like to override this
label
to, for example, use a shorter one for a compact menu.Proposed Solution
Add an optional property called
label
toMenu.IItemOptions
. If present, thelabel
inIItemOptions
takes precedence over thelabel
for the command.The text was updated successfully, but these errors were encountered: