feat: add MenuItem.userAccelerator property (#26682)
* feat: add MenuItem.userAccelerator property This allows folks to read the user-assigned accelerator that macOS users can provide in system preferences. Useful for showing in-app shortcut help dialogs, you need to know if the accelerator you provided is not being used in favor of a user assigned one. * chore: update syntax * chore: add safety check for command index being -1
This commit is contained in:
parent
3e69985b76
commit
da9261497e
7 changed files with 85 additions and 9 deletions
|
@ -159,7 +159,13 @@ A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`,
|
|||
|
||||
#### `menuItem.accelerator`
|
||||
|
||||
A `Accelerator` (optional) indicating the item's accelerator, if set.
|
||||
An `Accelerator` (optional) indicating the item's accelerator, if set.
|
||||
|
||||
#### `menuItem.userAccelerator` _Readonly_ _macOS_
|
||||
|
||||
An `Accelerator | null` indicating the item's [user-assigned accelerator](https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc) for the menu item.
|
||||
|
||||
**Note:** This property is only initialized after the `MenuItem` has been added to a `Menu`. Either via `Menu.buildFromTemplate` or via `Menu.append()/insert()`. Accessing before initialization will just return `null`.
|
||||
|
||||
#### `menuItem.icon`
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue