diff options
author | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 20:52:54 +0000 |
---|---|---|
committer | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 20:52:54 +0000 |
commit | 6a07f3f984675d252533bb108b61c1984dd0fb36 (patch) | |
tree | 4db57e180b320fc1a04fb70e023291253d17e05a /ui/webui | |
parent | 9f5d22b1eb998e6279b10efe56da0381fffa409f (diff) | |
download | chromium_src-6a07f3f984675d252533bb108b61c1984dd0fb36.zip chromium_src-6a07f3f984675d252533bb108b61c1984dd0fb36.tar.gz chromium_src-6a07f3f984675d252533bb108b61c1984dd0fb36.tar.bz2 |
Add an option to hide the shortcut label from the menu item
If the command is associated with a menu item, the shortcut text of the command is displayed at the right side of menu item. This patch adds the option not to show it.
BUG=282696
TEST=manually tested
Review URL: https://codereview.chromium.org/106053006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239840 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/webui')
-rw-r--r-- | ui/webui/resources/js/cr/ui/command.js | 11 | ||||
-rw-r--r-- | ui/webui/resources/js/cr/ui/menu_item.js | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/ui/webui/resources/js/cr/ui/command.js b/ui/webui/resources/js/cr/ui/command.js index 540db04..e06cd68 100644 --- a/ui/webui/resources/js/cr/ui/command.js +++ b/ui/webui/resources/js/cr/ui/command.js @@ -186,6 +186,17 @@ cr.define('cr.ui', function() { cr.defineProperty(Command, 'checked', cr.PropertyKind.BOOL_ATTR); /** + * The flag that prevents the shortcut text from being displayed on menu. + * + * If false, the keyboard shortcut text (eg. "Ctrl+X" for the cut command) + * is displayed in menu when the command is assosiated with a menu item. + * Otherwise, no text is displayed. + * + * @type {boolean} + */ + cr.defineProperty(Command, 'hideShortcutText', cr.PropertyKind.BOOL_ATTR); + + /** * Dispatches a canExecute event on the target. * @param {cr.ui.Command} command The command that we are testing for. * @param {Element} target The target element to dispatch the event on. diff --git a/ui/webui/resources/js/cr/ui/menu_item.js b/ui/webui/resources/js/cr/ui/menu_item.js index 89054e2..9adb83d 100644 --- a/ui/webui/resources/js/cr/ui/menu_item.js +++ b/ui/webui/resources/js/cr/ui/menu_item.js @@ -128,7 +128,9 @@ cr.define('cr.ui', function() { updateShortcut_: function() { this.removeAttribute('shortcutText'); - if (!(this.command_ && this.command_.shortcut)) + if (!this.command_ || + !this.command_.shortcut || + this.command_.hideShortcutText) return; var shortcuts = this.command_.shortcut.split(/\s+/); |