Skip to main content

Class: KeyboardCommandsModal

keyboard/KeyboardCommandsModal.KeyboardCommandsModal

Defines a mode to use with a modal version of Cursorless keyboard.

Constructors

constructor

new KeyboardCommandsModal(graph)

Parameters

NameType
graphGraph

Defined in

keyboard/KeyboardCommandsModal.ts:38

Properties

inputDisposable

Private inputDisposable: undefined | Disposable

This disposable is returned by KeyboardHandler.pushListener, and is used to relinquich control of the keyboard. If this disposable is non-null, then our mode is active.

Defined in

keyboard/KeyboardCommandsModal.ts:30


mergedKeymap

Private mergedKeymap: Record<string, KeyHandler<any>>

Merged map from all the different sections of the key map (eg actions, colors, etc).

Defined in

keyboard/KeyboardCommandsModal.ts:36

Methods

constructMergedKeymap

Private constructMergedKeymap(): void

Returns

void

Defined in

keyboard/KeyboardCommandsModal.ts:72


getConflictingKeyMapEntry

getConflictingKeyMapEntry(text): undefined | KeyHandler<any>

This function can be used to deterct if a proposed map entry conflicts with one in the map. Used to detect if the user tries to use two map entries, one of which is a prefix of the other.

Parameters

NameTypeDescription
textstringThe proposed new map entry

Returns

undefined | KeyHandler<any>

The first map entry that conflicts with {@link text}, if one exists

Defined in

keyboard/KeyboardCommandsModal.ts:223


handleInput

handleInput(text): Promise<void>

Parameters

NameType
textstring

Returns

Promise<void>

Defined in

keyboard/KeyboardCommandsModal.ts:180


handleSection

Private handleSection<T>(sectionName, defaultKeyMap, handleValue): void

Adds a section (eg actions, scopes, etc) to the merged keymap.

Type parameters

Name
T

Parameters

NameTypeDescription
sectionNameSectionNameThe name of the section (eg "actions", "scopes", etc)
defaultKeyMapKeymap<T>The default values for this keymap
handleValue(value: T) => Promise<unknown>The function to call when the user presses the given key

Returns

void

Defined in

keyboard/KeyboardCommandsModal.ts:102


init

init(): void

Returns

void

Defined in

keyboard/KeyboardCommandsModal.ts:46


isModeOn

Private isModeOn(): boolean

Returns

boolean

Defined in

keyboard/KeyboardCommandsModal.ts:176


isPrefixOfKey

isPrefixOfKey(text): boolean

Parameters

NameType
textstring

Returns

boolean

Defined in

keyboard/KeyboardCommandsModal.ts:211


modeOff

modeOff(): Promise<void>

Returns

Promise<void>

Defined in

keyboard/KeyboardCommandsModal.ts:156


modeOn

modeOn(): Promise<void>

Returns

Promise<void>

Defined in

keyboard/KeyboardCommandsModal.ts:136


modeToggle

modeToggle(): void

Returns

void

Defined in

keyboard/KeyboardCommandsModal.ts:168