Skip to Content
ClassesFShortcut

类: FShortcut

The Facade API object to handle shortcuts in Univer

继承

  • FBase

方法

disableShortcut()

disableShortcut(): this

Disable shortcuts of Univer.

返回

this

The Facade API instance itself for chaining.

示例

const fShortcut = univerAPI.getShortcut(); fShortcut.disableShortcut();

dispatchShortcutEvent()

dispatchShortcutEvent(e): any

Dispatch a KeyboardEvent to the shortcut service and return the matched shortcut item.

参数

参数类型描述
eKeyboardEventThe KeyboardEvent to dispatch.

返回

any

The matched shortcut item.

示例

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.

返回

this

The Facade API instance itself for chaining.

示例

fShortcut.enableShortcut(); // Use the FShortcut instance used by disableShortcut before, do not create a new instance