diff --git a/src/main.ts b/src/main.ts index d750406..d6498e7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -23,8 +23,11 @@ export default class TableBeautifierPlugin extends Plugin { this.addCommand({ id: "convert-table-to-markdown", name: "Convert table to Markdown", - editorCallback: (editor: Editor) => { - convertSelection(editor); + editorCheckCallback: (checking: boolean, editor: Editor) => { + const selection = editor.getSelection(); + if (!selection || !looksLikeTable(selection)) return false; + if (!checking) convertSelection(editor); + return true; }, });