Skip to content

fix: keep the caret out of hidden marker#183

Draft
ocavue wants to merge 1 commit into
masterfrom
fix-caret-hidden-marker-deadzone
Draft

fix: keep the caret out of hidden marker#183
ocavue wants to merge 1 commit into
masterfrom
fix-caret-hidden-marker-deadzone

Conversation

@ocavue

@ocavue ocavue commented Jun 30, 2026

Copy link
Copy Markdown
Member

Draft. Fixes the hide-mode bug where the caret rests between a hidden Markdown marker and its content, so Enter/Space/typing corrupt the unit (clicking left of **foo** then Enter yields ** / foo**). Adds defineCaretMarkerSnap: an appendTransaction that snaps a pointer caret to the unit's outer edge and skips a keyboard caret over invisible marker interiors, plus a high-priority Enter keymap that relocates the split. Gated to hide mode only (in focus/show the markers are visible, so no trap). The full @meowdown/core suite passes (941) with no regressions.

Known-failing tests, left as the hard display:none follow-ups (each is commented in caret-marker-snap.test.ts):

  • click-then-Space/typing: the model selection snaps to the outer edge, but the browser's DOM insertion resolves the zero-width hidden ** to the inner position anyway (Enter works because it uses the model selection).
  • hide-mode arrow nav stops at the content edge instead of reaching the unit's outer edge (the browser natively skips display:none then gets stuck; no selection change fires for appendTransaction to nudge).
  • link click hit-testing in hide mode is unreliable (the zone/snap logic does handle a link's ](url) tail).

Design notes and experiments: brain projects/meowdown/PLAN_2026-06-30_18-58_caret-deadzone-in-hidden-markers.md.

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
meowdown Ignored Ignored Jun 30, 2026 11:39am

@pkg-pr-new

pkg-pr-new Bot commented Jun 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/prosekit/meowdown/@meowdown/core@183
npm i https://pkg.pr.new/prosekit/meowdown/@meowdown/react@183

commit: 8bb01c1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant