Class: FShortcut
The Facade API object to handle shortcuts in Univer
Extends
FBase
Methods
disableShortcut()
disableShortcut(): this
Disable shortcuts of Univer.
Returns
this
The Facade API instance itself for chaining.
dispatchShortcutEvent()
dispatchShortcutEvent(e): any
Dispatch a KeyboardEvent to the shortcut service and return the matched shortcut item.
Parameters
Parameter | Type | Description |
---|---|---|
e | KeyboardEvent | The KeyboardEvent to dispatch. |
Returns
any
The matched shortcut item.
Example
const fShortcut = univerAPI.getShortcut();
const pseudoEvent = new KeyboardEvent('keydown', { key: 's', ctrlKey: true });
const ifShortcutItem = fShortcut.dispatchShortcutEvent(pseudoEvent);
if (ifShortcutItem) {
const commandId = ifShortcutItem.id;
// Do something with the commandId.
}
enableShortcut()
enableShortcut(): this
Enable shortcuts of Univer.
Returns
this
The Facade API instance itself for chaining.