Skip to content

feat(dom): text-select on rendered surfaces (data-surface="block")#141

Open
adnaan wants to merge 1 commit into
mainfrom
text-select-preview
Open

feat(dom): text-select on rendered surfaces (data-surface="block")#141
adnaan wants to merge 1 commit into
mainfrom
text-select-preview

Conversation

@adnaan

@adnaan adnaan commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #140. lvt-fx:text-select only resolved selections on the code surface ([data-line] rows), so in a host's rendered view (e.g. prereview's Markdown Preview) selecting text produced no Comment button. This adds a block surface.

What's new

  • data-surface="block" on the host → a native selection resolves to the touched [data-from]/[data-to] blocks' source line range + the exact rendered phrase ({fromLine,toLine,text}, fromCol=toCol=0). Rendered text can't map to source columns (**b** renders as b), so this is line-precision with the phrase captured.
  • The default code surface (character ranges + keyboard block caret) is unchanged.
  • On the block surface there's no caret and arrow keys are left alone (only the mouse/touch selection → button flow runs).

Tests

tests/text-select.test.ts: 4 new block-surface cases (within-block, cross-block, outside-host, collapsed). Full suite green (789).

🤖 Generated with Claude Code

Extends lvt-fx:text-select to rendered Markdown (host data-surface="block"):
a native selection resolves to the touched [data-from]/[data-to] blocks' source
line range + the exact rendered phrase, instead of character columns (rendered
text can't map to source offsets). No caret and arrow keys are left alone on the
block surface. The default "code" surface (char ranges + caret) is unchanged.

Fixes text selection producing no Comment button in the rendered Preview view.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ey41dRwDpRgLtVHZjhYLKt
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