@univerjs/ui v0.4.2 • Docs
Interface: IShortcutService
The interface of the shortcut service.
Properties
Property | Type | Description | Defined in |
---|---|---|---|
shortcutChanged$ | Observable <void > | An observable that emits when the shortcuts are changed. | packages/ui/src/services/shortcut/shortcut.service.ts:96 (opens in a new tab) |
Methods
forceEscape()
forceEscape(): IDisposable
Make the shortcut service ignore all keyboard events.
Returns
a disposable that could be used to cancel the force escaping.
Defined in
packages/ui/src/services/shortcut/shortcut.service.ts:102 (opens in a new tab)
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
packages/ui/src/services/shortcut/shortcut.service.ts:126 (opens in a new tab)
getShortcutDisplay()
getShortcutDisplay(shortcut): string
Get the display string of the shortcut item.
Parameters
Parameter | Type | Description |
---|---|---|
shortcut | IShortcutItem <object > | the shortcut item to get the display string. |
Returns
string
the display string of the shortcut. For example Ctrl+Enter
.
Defined in
packages/ui/src/services/shortcut/shortcut.service.ts:115 (opens in a new tab)
getShortcutDisplayOfCommand()
getShortcutDisplayOfCommand(id): null | string
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
.
Defined in
packages/ui/src/services/shortcut/shortcut.service.ts:121 (opens in a new tab)
registerShortcut()
registerShortcut(shortcut): IDisposable
Register a shortcut item to the shortcut service.
Parameters
Parameter | Type | Description |
---|---|---|
shortcut | IShortcutItem <object > | the shortcut item to be registered. |
Returns
a disposable that could be used to unregister the shortcut.
Defined in
packages/ui/src/services/shortcut/shortcut.service.ts:109 (opens in a new tab)