From e5c3417a833665258a69f705a9395f5f2d28c0dc Mon Sep 17 00:00:00 2001 From: Heiko Joerg Schick Date: Wed, 29 Apr 2026 22:41:25 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20editorCheckCallback=20=E2=80=94=20brok?= =?UTF-8?q?e=20command=20palette=20visibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove editorCheckCallback from all 8 commands - Remove MarkdownView import and editorCheck helper function - fixup e8e5760 --- src/commands.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/commands.ts b/src/commands.ts index 2ad0ea8..2cb90db 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -1,15 +1,10 @@ -import { Plugin, MarkdownView } from "obsidian"; +import { Plugin } from "obsidian"; import { transformText, cleanText, bulletToEmdash, bulletToArrow, numberedListSlash, numberedListParens, markdownToLinkedIn, FormatStyle } from "./formatter"; -function editorCheck(plugin: Plugin) { - return (_checking: boolean) => plugin.app.workspace.getActiveViewOfType(MarkdownView) !== null; -} - function addFormatCommand(plugin: Plugin, style: FormatStyle, name: string) { plugin.addCommand({ id: `unicode-formatter:${style}`, name, - editorCheckCallback: editorCheck(plugin), editorCallback: (editor) => { const selection = editor.getSelection(); if (selection) { @@ -26,7 +21,6 @@ export function registerCommands(plugin: Plugin): void { plugin.addCommand({ id: "unicode-formatter:clean", name: "Remove Unicode Formatting", - editorCheckCallback: editorCheck(plugin), editorCallback: (editor) => { const selection = editor.getSelection(); if (selection) { @@ -37,7 +31,6 @@ export function registerCommands(plugin: Plugin): void { plugin.addCommand({ id: "unicode-formatter:bullet-to-arrow", name: "Convert List Bullets to Arrow", - editorCheckCallback: editorCheck(plugin), editorCallback: (editor) => { const selection = editor.getSelection(); if (selection) { @@ -48,7 +41,6 @@ export function registerCommands(plugin: Plugin): void { plugin.addCommand({ id: "unicode-formatter:bullet-to-emdash", name: "Convert List Bullets to Em Dash", - editorCheckCallback: editorCheck(plugin), editorCallback: (editor) => { const selection = editor.getSelection(); if (selection) { @@ -59,7 +51,6 @@ export function registerCommands(plugin: Plugin): void { plugin.addCommand({ id: "unicode-formatter:numbered-list-slash", name: "Convert List to Numbered (Slash)", - editorCheckCallback: editorCheck(plugin), editorCallback: (editor) => { const selection = editor.getSelection(); if (selection) { @@ -70,7 +61,6 @@ export function registerCommands(plugin: Plugin): void { plugin.addCommand({ id: "unicode-formatter:numbered-list-parens", name: "Convert List to Numbered (Parentheses)", - editorCheckCallback: editorCheck(plugin), editorCallback: (editor) => { const selection = editor.getSelection(); if (selection) { @@ -81,7 +71,6 @@ export function registerCommands(plugin: Plugin): void { plugin.addCommand({ id: "unicode-formatter:markdown-to-linkedin", name: "Convert Markdown to Post Format", - editorCheckCallback: editorCheck(plugin), editorCallback: (editor) => { const selection = editor.getSelection(); if (selection) {