diff --git a/main.ts b/main.ts index 2c24c77..346901f 100644 --- a/main.ts +++ b/main.ts @@ -6,12 +6,13 @@ export default class LinkFormatterPlugin extends Plugin { this.addCommand({ id: 'link-formatter', name: 'Format links to unordered list', - editorCallback: (editor: Editor, view: MarkdownView) => { - if (editor.somethingSelected()) { - const selectedText = editor.getSelection(); - const formattedText = formatLinkList(selectedText); - editor.replaceSelection(formattedText); + editorCheckCallback: (checking: boolean, editor: Editor, view: MarkdownView) => { + if (checking) { + return !!editor.somethingSelected(); } + const selectedText = editor.getSelection(); + const formattedText = formatLinkList(selectedText); + editor.replaceSelection(formattedText); } }); } diff --git a/manifest.json b/manifest.json index 885562c..0c85a81 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "link-formatter", "name": "Link Formatter", - "version": "1.0.2", + "version": "1.0.3", "minAppVersion": "0.15.0", "description": "Formats a block of links into a clean markdown list", "author": "Dilantha Nanayakkara", diff --git a/package.json b/package.json index 64ab873..a3d7d0c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "link-formatter", - "version": "1.0.2", + "version": "1.0.3", "description": "", "main": "main.js", "scripts": {