Command interface
Signature:
export interface Command
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
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. | |
id | string | Globally unique ID to identify this command. | |
mobileOnly? | boolean | (Optional) | |
name | string | Human friendly name for searching. | |
repeatable? | boolean | (Optional) Whether holding the hotkey should repeatedly trigger this command. |