Skip to content

Class: Prompt

Defined in: src/managers/prompt.ts:14

Prompt for setting up or executing some commands quickly.

Shift + P can show/hide its UI anywhere after registering commands.

Constructors

Constructor

ts
new Prompt(): Prompt;

Defined in: src/managers/prompt.ts:54

Initialize Prompt but do not create UI.

Returns

Prompt

Properties

commands

ts
commands: Command[] = [];

Defined in: src/managers/prompt.ts:50

Save all commands registered by all addons.


inputNode

ts
inputNode: HTMLInputElement;

Defined in: src/managers/prompt.ts:46

The HTML input node of Prompt.


promptNode

ts
promptNode: HTMLDivElement;

Defined in: src/managers/prompt.ts:42

The top-level HTML div node of Prompt

Accessors

document

Get Signature

ts
get document(): Document;

Defined in: src/managers/prompt.ts:17

Returns

Document

Methods

createCommandNode()

ts
createCommandNode(command): HTMLElement;

Defined in: src/managers/prompt.ts:261

Create a command item for Prompt UI.

Parameters

command

Command

Returns

HTMLElement


createCommandsContainer()

ts
createCommandsContainer(): HTMLDivElement;

Defined in: src/managers/prompt.ts:228

Create a commandsContainer div element, append to commandsContainer and hide others.

Returns

HTMLDivElement

commandsNode


initializeUI()

ts
initializeUI(): void;

Defined in: src/managers/prompt.ts:62

Initialize Prompt UI and then bind events on it.

Returns

void


selectItem()

ts
selectItem(item): void;

Defined in: src/managers/prompt.ts:608

Mark the selected item with class selected.

Parameters

item

HTMLDivElement

HTMLDivElement

Returns

void


showCommands()

ts
showCommands(commands, clear): void;

Defined in: src/managers/prompt.ts:201

Show commands in a new commandsContainer All other commandsContainer is hidden

Parameters

commands

Command[]

Command[]

clear

boolean = false

remove all commandsContainer if true

Returns

void


showTip()

ts
showTip(text): HTMLDivElement;

Defined in: src/managers/prompt.ts:591

Create a commandsContainer and display a text

Parameters

text

string

Returns

HTMLDivElement