Add hover copy actions for fenced and inline chat code

This commit is contained in:
2026-11-07 02:52:29 +00:00
parent 9e6d55942f
commit 4340c3e72f
6 changed files with 549 additions and 45 deletions
+21
View File
@@ -0,0 +1,21 @@
# Copy code on hover
Fenced blocks reveal a native Copy action in a permanently reserved header slot
on mouse hover or keyboard focus. Inline backtick runs remain TextSpans and use
hover callbacks to show a native floating Copy control above their glyph bounds
(or below at the viewport top), leaving text gestures and wrapping untouched.
Copy writes the rendered code content without fences, language labels or
backticks, preserving spaces, tabs and newlines. The shared copy button reports
Copied, resets on content replacement, and ignores stale asynchronous feedback.
The code control is excluded from transcript text selection.
Inline hover allows 180ms to cross onto the floating control. It cleans up on
mouse exit, scrolling, route/dependency changes, text replacement and disposal.
The existing fixture (`chats=1&msgs=2`) supplies both inline and fenced code for
captures; no live chat is modified.
Checks cover both native hosts, raw clipboard contents, multiple inline runs,
code inside links, keyboard activation, TextSpan structure and cleanup. Browser
hover/click captures exercise block and inline Copy → Copied on both hosts.
Device behaviour remains unverified; normal touch selection is preserved.