feat: add advanced keyboard shortcuts#196
Merged
Merged
Conversation
|
@maccman is attempting to deploy a commit to the ocavue's projects Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
Adds the meowdown-scoped keyboard behaviors from the v1 editor: - Alt-ArrowUp/Down moves a list item with its nested children, or swaps a plain top-level block with its neighbor (no-op inside tables) - Typing [ over a selection wraps it into an open wikilink ([[query) with the menu searching it; a bare [ still types literally - Mod-Enter follows the wikilink/tag/link under the caret through the same handlers a click uses, falling through to the task cycle off-link - Mod-Shift-7/8/9 toggle ordered/bullet/task lists (same kind unwraps) - Escape collapses a non-empty selection, at low priority so open menus keep owning the key The click payload event types widen to MouseEvent | KeyboardEvent, and the key-bindings table and README document the new shortcuts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
c2d5ea8 to
dade0b7
Compare
Exercises the two untested branches of the block-move fallback: a NodeSelection from the block handle moves the node and keeps it selected, and a caret inside a blockquote moves the whole blockquote. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ocavue
approved these changes
Jul 2, 2026
Merged
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.
What
Ports the editor-scoped keyboard behaviors from the v1 Reflect editor, per the porting doc's recommended list:
Alt-ArrowUp/Alt-ArrowDown— newmove-block.ts. Moves the list item under the caret together with its nested children (viaprosemirror-flat-list'screateMoveListCommand), and falls back to swapping a plain top-level block with its previous/next sibling so the shortcut behaves uniformly outside lists. The caret stays inside the moved block. No-op inside table cells (row swapping is deliberately out of scope) and at document edges.[over a selection — extendswikilink-trigger.ts. Typing[over a non-empty single-block selection replaces it with[[selection(brackets left open, caret at the end) so the wikilink menu opens with the selection as the query. Guards: a selection already starting with[[falls through (never[[[), a leading single[is stripped so a second tap converges, and a bare[on an empty caret still types literally.Mod-Shift-kkeeps its existing behavior via the same command withallowEmpty, and both now decline inside code blocks.Mod-Enterfollows the link under the caret — newfollow-link.ts. Resolves the wikilink, tag, or Markdown link at the caret (wikilink → tag → link) and fires the sameonWikilinkClick/onTagClick/onLinkClickhandlers a click does, with theKeyboardEventasevent. Off a link the key falls through, so the existing checkbox-task cycle onMod-Enteris untouched — the plugin runs atPriority.high, ahead of every keymap binding, and returnsfalsewhen there is nothing to follow. The click payloadeventtypes widen toMouseEvent | KeyboardEvent.Mod-Shift-7/8/9— ordered / bullet / task list toggles in the list keymap (Google-Docs semantics viatoggleList: same kind unwraps, a different kind converts in place, a non-list block wraps). Resolved through the physical digit key, so layouts where Shift+digit types punctuation still work.Escapecollapses a non-empty selection — newescape-collapse.ts, bound atPriority.lowso the autocomplete menus (which bind Escape at the highest priority) keep dismissing themselves first; a React test verifies an open wikilink menu closes without disturbing the text and only a second press touches the selection.The
EDITOR_KEY_BINDINGStable and the README shortcuts table document all the new bindings (plus the previously missingMod-Shift-kentry).Why
These are the most-missed structural edits from the v1 editor — reordering a bullet without cut/paste, linking a selected phrase in two keystrokes, and following links without the mouse. Editor-level bindings belong here in meowdown; the host app only sees the existing click-handler props.
Notes for review
Mod-Enterconflict with the task-rotate cycle is the subtle part:follow-link.test.tscovers both sides (on-link follows and leaves the markdown untouched; off-link in the same task item rotates it), plus the modifier guard soMod-Shift-Enterkeeps rotating circle tasks even on a link.[Digit7..9]keys to exercise prosemirror-keymap'skeyCodefallback for shifted digits. Verified under Chromium locally; worth watching under WebKit in CI.Mod-Enterreuses the existingonWikilinkClick/onTagClick/onLinkClickthreading, installed only when a handler is present.Testing
move-block.test.ts,wikilink-trigger.test.ts,follow-link.test.ts,escape-collapse.test.ts, and extensions tolist.test.ts/wikilink-menu.test.tsx, including markdown round-trip assertions.tsc -b, eslint, oxfmt, and knip all clean.🤖 Generated with Claude Code