Command

Command interface

Signature:

export interface Command 

Properties

PropertyModifiersTypeDescription
callback?() β‡’ any(Optional) Simple callback, triggered globally.
checkCallback?(checking: boolean) β‡’ boolean | void(Optional) Complex callback, overrides the simple callback. Used to β€˜check’ whether your command can be performed in the current circumstances. For example, if your command requires the active focused pane to be a MarkdownView, then you should only return true if the condition is satisfied. Returning false or undefined causes the command to be hidden from the command palette.
editorCallback?(editor: Editor, ctx: MarkdownView | MarkdownFileInfo) β‡’ any(Optional) A command callback that is only triggered when the user is in an editor. Overrides callback and checkCallback
editorCheckCallback?(checking: boolean, editor: Editor, ctx: MarkdownView | MarkdownFileInfo) β‡’ boolean | void(Optional) A command callback that is only triggered when the user is in an editor. Overrides editorCallback, callback and checkCallback
hotkeys?Hotkey[](Optional) Sets the default hotkey. It is recommended for plugins to avoid setting default hotkeys if possible, to avoid conflicting hotkeys with one that’s set by the user, even though customized hotkeys have higher priority.
icon?IconName(Optional) Icon ID to be used in the toolbar. See https://docs.obsidian.md/Plugins/User+interface/Icons for available icons and how to add your own.
idstringGlobally unique ID to identify this command.
mobileOnly?boolean(Optional)
namestringHuman friendly name for searching.
repeatable?boolean(Optional) Whether holding the hotkey should repeatedly trigger this command.