@univerjs/ui v0.5.4


Interface: IShortcutService

Defined in: submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:87

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

dispatch()

dispatch(e): undefined | IShortcutItem

Defined in: submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:107

Dispatch a keyboard event to the shortcut service and check if there is a shortcut that matches the event.

Parameters

ParameterTypeDescription
eKeyboardEventthe keyboard event to be dispatched.

Returns

undefined | IShortcutItem


forceEscape()

forceEscape(): IDisposable

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

Make the shortcut service ignore all keyboard events.

Returns

IDisposable

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


getAllShortcuts()

getAllShortcuts(): IShortcutItem[]

Defined in: submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:130

Get all the shortcuts registered in the shortcut service.

Returns

IShortcutItem[]

all the shortcuts registered in the shortcut service.


getShortcutDisplay()

getShortcutDisplay(shortcut): string

Defined in: submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:119

Get the display string of the shortcut item.

Parameters

ParameterTypeDescription
shortcutIShortcutItemthe shortcut item to get the display string.

Returns

string

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


getShortcutDisplayOfCommand()

getShortcutDisplayOfCommand(id): null | string

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

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.


registerShortcut()

registerShortcut(shortcut): IDisposable

Defined in: submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:113

Register a shortcut item to the shortcut service.

Parameters

ParameterTypeDescription
shortcutIShortcutItemthe shortcut item to be registered.

Returns

IDisposable

a disposable that could be used to unregister the shortcut.