API Reference
@univerjs
@univerjs/ui
interfaces
Ishortcutitem

@univerjs/ui v0.4.2Docs


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.packages/ui/src/services/shortcut/shortcut.service.ts:36 (opens in a new tab)
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' }packages/ui/src/services/shortcut/shortcut.service.ts:74 (opens in a new tab)
idstringId 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?numberThe 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?numberThe 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) => booleanA 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?numberIf 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?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.packages/ui/src/services/shortcut/shortcut.service.ts:82 (opens in a new tab)
win?numberThe 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)

Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.