Skip to content

Command.editorCheckCallback?

Command › editorCheckCallback?

Official

Type: (checking: boolean, editor: Editor, ctx: MarkdownView | MarkdownFileInfo) => boolean | void

A command callback that is only triggered when the user is in an editor. Overrides editorCallback, callback and checkCallback

Since: 0.12.2

Example:

this.addCommand({
id: 'example-command',
name: 'Example command',
editorCheckCallback: (checking: boolean, editor: Editor, view: MarkdownView) => {
const value = getRequiredValue();
if (value) {
if (!checking) {
doCommand(value);
}
return true;
}
return false;
}
});