@univerjs/ui v0.4.2 • Docs
Interface: IShortcutItem<P>
A shortcut item that could be registered to the IShortcutService.
Type Parameters
Type Parameter | Default type |
---|---|
P extends object | object |
Properties
Property | Type | Description | Defined in |
---|---|---|---|
binding | number | The binding of the shortcut. It should be a combination of KeyCode and MetaKeys. A command can be bound to several bindings, with different static parameters perhaps. Example `{ binding: KeyCode.ENTER | MetaKeys.ALT }` |
description? | string | Description of the shortcut. | packages/ui/src/services/shortcut/shortcut.service.ts:36 (opens in a new tab) |
group? | string | The group of the menu item should belong to. The shortcut item would be rendered in the panel if this is set. Example { group: '10_global-shortcut' } | packages/ui/src/services/shortcut/shortcut.service.ts:74 (opens in a new tab) |
id | string | Id of the shortcut item. It should reuse the corresponding ICommand's id. | packages/ui/src/services/shortcut/shortcut.service.ts:33 (opens in a new tab) |
linux? | number | The binding of the shortcut for Linux. If the property is not specified, the default binding would be used. | packages/ui/src/services/shortcut/shortcut.service.ts:66 (opens in a new tab) |
mac? | number | The binding of the shortcut for macOS. If the property is not specified, the default binding would be used. | packages/ui/src/services/shortcut/shortcut.service.ts:58 (opens in a new tab) |
preconditions? | (contextService : IContextService ) => boolean | A callback that will be triggered to examine if the shortcut should be invoked. The {@link IContextService} would be passed to the callback. | packages/ui/src/services/shortcut/shortcut.service.ts:45 (opens in a new tab) |
priority? | number | If two shortcuts have the same binding, the one with higher priority would be check first. | packages/ui/src/services/shortcut/shortcut.service.ts:39 (opens in a new tab) |
staticParameters? | P | Static parameters of this shortcut. Would be send to ICommandService.executeCommand as the second parameter when the corresponding command is executed. You can define multi shortcuts with the same command id but different static parameters. | packages/ui/src/services/shortcut/shortcut.service.ts:82 (opens in a new tab) |
win? | number | The binding of the shortcut for Windows. If the property is not specified, the default binding would be used. | packages/ui/src/services/shortcut/shortcut.service.ts:62 (opens in a new tab) |