fix: synthesis button, undo button, and plugin command handler#5
Merged
Conversation
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three fixes discovered during testing after PR #4 was merged:
1. Synthesis button did nothing in the plugin
Clicking "Synthesis · document" in the plugin's Ctrl+K palette closed the palette but nothing else happened. The VimInput fires
onCommand("synthesis-doc")but the plugin'shandleCommandfunction had no case for it. ThesynthesisTriggerRefonly handled the external Obsidian Ctrl+P command, not the internal VimInput click.Fix: Added
"synthesis-doc"case tohandleCommandinNodepadApp(plugin/src/view.tsx).2. Undo button was a no-op in the plugin
The
undofunction exists inNodepadAppand works via keyboard, but was not passed asonUndotoVimInput. Tapping the button did nothing on touch devices.Fix: Pass
onUndo={undo}toVimInputin the plugin render.3. Undo button showed "Nothing to undo" when typing (web-app + plugin)
The undo button always called
onUndo()which is the canvas block-level undo. When the user has text typed in the input and taps Undo, the relevant undo is the browser's native text undo — the same thing Ctrl+Z does on the input field. Block-level undo has nothing to revert, so it showed "Nothing to undo".Fix:
handleUndoinVimInputnow checks context:document.execCommand("undo")(browser native text undo)onUndo()for canvas block undoFiles changed
plugin/src/view.tsx"synthesis-doc"tohandleCommand; passonUndo={undo}to VimInputcomponents/vim-input.tsxhandleUndo— text undo vs block undo🤖 Generated with Claude Code