@univerjs/ui v0.5.0-beta.1 • 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. | submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:35 |
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' } | submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:73 |
id | string | Id of the shortcut item. It should reuse the corresponding ICommand’s id. | submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:32 |
linux? | number | The binding of the shortcut for Linux. If the property is not specified, the default binding would be used. | submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:65 |
mac? | number | The binding of the shortcut for macOS. If the property is not specified, the default binding would be used. | submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:57 |
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. | submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:44 |
priority? | number | If two shortcuts have the same binding, the one with higher priority would be check first. | submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:38 |
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. | submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:81 |
win? | number | The binding of the shortcut for Windows. If the property is not specified, the default binding would be used. | submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:61 |