Repository navigation
feat: simpler text selection and Copy as Image - #6
Merged
Merged
Conversation
…ont faces; same-origin images
… remove dead hook
…es and image origin rule
CodeQL js/incomplete-multi-character-sanitization flagged a single-pass tag strip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… helper The loop form was not recognised by CodeQL js/incomplete-multi-character-sanitization. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
…ping CodeQL js/incomplete-multi-character-sanitization flags any regex tag strip here. Co-Authored-By: Claude Opus 5.5 <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.
Simpler text selection and Copy as Image
What
.trunc"… N more characters", gutter, git bars, blame) never reach copied text..truncisuser-select: none.min(devicePixelRatio, 2), reduced to stay under 16M pixels.foreignObject, with fonts and same-origin images embedded as data URIs. On failure it copies plain text and shows a message.ClipboardItemis built synchronously inside the user gesture, as WebKit requires. Falls back to downloading the PNG. The macOS app gets a nativecopyimagehandler.Why
User request: assess text selection from a user's point of view and add "Copy as image" on a selection that preserves the rendering format. The code view is virtualised, so a DOM-based copy would lose selections on scroll and re-render. The feature therefore draws from the model, and the markdown preview uses the DOM snapshot path.
AC to commit mapping
textOf,restorePlan, DOM restore.truncnever copiedfitScale, size cap, feedback messagesHow to test manually
ClipboardItem, the PNG should download and show "Clipboard unavailable: image downloaded". In the macOS app, the image should land on the pasteboard through the native handler.Automated:
bun scripts/build.ts --client-only && bun test(one suite at a time; concurrent runs flake).Assumptions
bindKeys. Terminal focus is excluded. In Chromium, outside the app, the shortcut may open devtools inspect; accepted.getComputedStylefrom the--sx-*variables at copy time. Tests inject a theme object.tscand a linter are unavailable), solintandtypecheckare omitted fromcommands.json.ClipboardItemand SVG-to-image glue lives insrc/client/imagedom.ts, excluded from coverage and verified by hand. Everything else is unit-tested.copyimagehandler are checked by hand.Known limitations
The findings first reported here (stale range, WebKit canvas taint, selection collapsing at click time, dead hook, untested font table and image rule) are fixed by the follow-up commits below. What remains:
imagedom.ts), the app wiring (app.ts,editor.ts) and the Swift handlers are checked by reading, not run in a real browser or WKWebView. Please try the manual steps above.test/client.snapfallback4.test.tssetswindow/documentglobals without teardown. The suite is green, but it depends on test order.Follow-up fixes (open review findings)
🤖 Generated with Claude Code