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


Interface: IShortcutService

The interface of the shortcut service.

Properties

PropertyTypeDescriptionDefined in
shortcutChanged$Observable<void>An observable that emits when the shortcuts are changed.submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:95

Methods

forceEscape()

forceEscape(): IDisposable

Make the shortcut service ignore all keyboard events.

Returns

IDisposable

a disposable that could be used to cancel the force escaping.

Defined in

submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:101


getAllShortcuts()

getAllShortcuts(): IShortcutItem<object>[]

Get all the shortcuts registered in the shortcut service.

Returns

IShortcutItem<object>[]

all the shortcuts registered in the shortcut service.

Defined in

submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:125


getShortcutDisplay()

getShortcutDisplay(shortcut): string

Get the display string of the shortcut item.

Parameters

ParameterTypeDescription
shortcutIShortcutItem<object>the shortcut item to get the display string.

Returns

string

the display string of the shortcut. For example Ctrl+Enter.

Defined in

submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:114


getShortcutDisplayOfCommand()

getShortcutDisplayOfCommand(id): null | string

Get the display string of the shortcut of the command.

Parameters

ParameterTypeDescription
idstringthe id of the command to get the shortcut display.

Returns

null | string

the display string of the shortcut. For example Ctrl+Enter.

Defined in

submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:120


registerShortcut()

registerShortcut(shortcut): IDisposable

Register a shortcut item to the shortcut service.

Parameters

ParameterTypeDescription
shortcutIShortcutItem<object>the shortcut item to be registered.

Returns

IDisposable

a disposable that could be used to unregister the shortcut.

Defined in

submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:108