Interface: IShortcutService
Defined in: submodules/univer/packages/ui/src/services/shortcut/shortcut.service.ts:87
The interface of the shortcut service.
Properties
Property | Type | Description | Defined 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
Parameter | Type | Description |
---|---|---|
e | KeyboardEvent | the 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
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
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
Parameter | Type | Description |
---|---|---|
shortcut | IShortcutItem | the 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
Parameter | Type | Description |
---|---|---|
id | string | the 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
Parameter | Type | Description |
---|---|---|
shortcut | IShortcutItem | the shortcut item to be registered. |
Returns
a disposable that could be used to unregister the shortcut.