Command.editorCallback?
Command › editorCallback?
Official
Type: (editor: Editor, ctx: MarkdownView | MarkdownFileInfo) => any
A command callback that is only triggered when the user is in an editor. Overridescallback and checkCallback Since: 0.12.2
Example:
this.addCommand({ id: 'example-command', name: 'Example command', editorCallback: (editor: Editor, view: MarkdownView) => { const sel = editor.getSelection();
console.log(`You have selected: ${sel}`); }});