Skip to content

Commands

Properties

app

app: App

Reference to App


commands

commands: CommandsCommandsRecord

Commands without editor callback, will always be available in the command palette

Example

`app:open-vault` or `app:reload`

editorCommands

editorCommands: CommandsEditorCommandsRecord

Commands with editor callback, will only be available when editor is active and callback returns true

Example

`editor:fold-all` or `command-palette:open`

Methods

addCommand()

addCommand(command): void

Add a command to the command registry

Parameters

command: Command

Command to add

Returns

void


executeCommand()

executeCommand(command): boolean

Execute a command by reference

Parameters

command: Command

Command to execute

Returns

boolean


executeCommandById()

executeCommandById(commandId): boolean

Execute a command by ID

Parameters

commandId: string

ID of command to execute

Returns

boolean


findCommand()

findCommand(commandId): undefined | Command

Find a command by ID

Parameters

commandId: string

ID of command to find

Returns

undefined | Command


listCommands()

listCommands(): Command[]

Lists all commands, both with and without editor callback

Returns

Command[]


removeCommand()

removeCommand(commandId): void

Remove a command from the command registry

Parameters

commandId: string

ID of command to remove

Returns

void