@univerjs/ui v0.5.0-beta.1Docs


Interface: IShortcutItem<P>

A shortcut item that could be registered to the IShortcutService.

Type Parameters

Type ParameterDefault type
P extends objectobject

Properties

PropertyTypeDescriptionDefined in
bindingnumberThe 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.ENTERMetaKeys.ALT }`
description?stringDescription of the shortcut.submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:35
group?stringThe 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
idstringId of the shortcut item. It should reuse the corresponding ICommand’s id.submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:32
linux?numberThe 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?numberThe 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) => booleanA 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?numberIf 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?PStatic 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?numberThe 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