From d6b6975a5753b9a2741dbc797fb02d5f2d702aa6 Mon Sep 17 00:00:00 2001 From: Dev-020 Date: Mon, 11 May 2026 23:31:05 +0800 Subject: [PATCH 1/3] fix(plugin): handle synthesis-doc command in VimInput onCommand The synthesisTriggerRef only handled external Obsidian command palette triggers (Ctrl+P). Clicking the Synthesis button in the VimInput fires onCommand("synthesis-doc") which had no case in handleCommand, so nothing happened. Add the missing branch to open the confirm dialog. Co-Authored-By: Claude Sonnet 4.6 --- plugin/src/view.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/src/view.tsx b/plugin/src/view.tsx index 6d49790..66e0a46 100644 --- a/plugin/src/view.tsx +++ b/plugin/src/view.tsx @@ -693,9 +693,13 @@ function NodepadApp({ plugin, initialData, fileName, folderPath, onSave, onMenuC copyToClipboard(md) new Notice("Copied to clipboard") } + else if (cmd === "synthesis-doc") { + setSynthSourceAnchors(getSourceAnchors(blocks)) + setSynthConfirmOpen(true) + } else if (cmd === "task" && text) addBlock(text, "task") else if (cmd === "thesis" && text) addBlock(text, "thesis") - }, [clearBlocks, addBlock, fileName, folderPath, plugin]) + }, [clearBlocks, addBlock, fileName, folderPath, plugin, blocks]) // ── Render ──────────────────────────────────────────────────────────────── From e6dd616555ebb0a357e09b51d13edc52b7c80c72 Mon Sep 17 00:00:00 2001 From: Dev-020 Date: Mon, 11 May 2026 23:37:56 +0800 Subject: [PATCH 2/3] fix(plugin): wire onUndo to VimInput so undo button works on touch The undo function already exists in NodepadApp (Cmd+Z keyboard shortcut handler), but was not passed to VimInput's onUndo prop. Tapping the undo button was a no-op. Now passes undo directly so mobile/tablet users can tap to undo without a keyboard. Co-Authored-By: Claude Sonnet 4.6 --- plugin/src/view.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/src/view.tsx b/plugin/src/view.tsx index 66e0a46..1e6fd39 100644 --- a/plugin/src/view.tsx +++ b/plugin/src/view.tsx @@ -818,6 +818,7 @@ function NodepadApp({ plugin, initialData, fileName, folderPath, onSave, onMenuC onCommand={handleCommand} isCommandKOpen={isCommandKOpen} setIsCommandKOpen={setIsCommandKOpen} + onUndo={undo} isPlugin /> From 156ab01563cb86358f787fa85467cdcc140cb980 Mon Sep 17 00:00:00 2001 From: Dev-020 Date: Mon, 11 May 2026 23:40:23 +0800 Subject: [PATCH 3/3] fix: undo button undoes text input when typing, blocks otherwise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously the button always called onUndo() which is the canvas block-level undo — so tapping it while typing showed "Nothing to undo" even though there was text to undo. handleUndo now checks: if the input has content, focus it and call document.execCommand("undo") to trigger the browser's native text undo (same effect as Ctrl+Z on the field). If the input is empty, fall back to block-level undo as before. This makes the button useful in both contexts without a keyboard. Co-Authored-By: Claude Sonnet 4.6 --- components/vim-input.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/components/vim-input.tsx b/components/vim-input.tsx index 89d0c30..d3e14f6 100644 --- a/components/vim-input.tsx +++ b/components/vim-input.tsx @@ -42,6 +42,16 @@ export function VimInput({ onSubmit, onCommand, isCommandKOpen, setIsCommandKOpe const searchInputRef = React.useRef(null) const itemRefs = React.useRef<(HTMLButtonElement | null)[]>([]) + // Context-aware undo: text undo when the input has content, block undo otherwise + const handleUndo = React.useCallback(() => { + if (value && mainInputRef.current) { + mainInputRef.current.focus() + document.execCommand("undo") + } else { + onUndo?.() + } + }, [value, onUndo]) + // ── Items (mod-key aware) ─────────────────────────────────────────────── const VIEW_ITEMS = React.useMemo(() => [ @@ -368,7 +378,7 @@ export function VimInput({ onSubmit, onCommand, isCommandKOpen, setIsCommandKOpe