Skip to content

fix(web): include images when copying prompts - #8099

Open
StiensWout wants to merge 2 commits into
pingdotgg:mainfrom
StiensWout:t3code/include-images-in-copy
Open

fix(web): include images when copying prompts#8099
StiensWout wants to merge 2 commits into
pingdotgg:mainfrom
StiensWout:t3code/include-images-in-copy

Conversation

@StiensWout

@StiensWout StiensWout commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Copying a user prompt with an attached image only placed the text on the clipboard, so pasting into a new thread dropped the image.

The copy action now writes the prompt and first available attachment as one clipboard item. Images are normalized to PNG for browser clipboard support, while unsupported browsers keep the existing text-only fallback.

Proof

Playwright proof of copying a prompt and image into a new thread

Testing

  • vp test run on the message clipboard, copy hook, and message timeline tests
  • Web package typecheck
  • Targeted lint for the changed files
  • Playwright copy and paste round trip in an isolated T3 environment

Implemented with GPT-5.6-Sol in the Codex harness inside T3 Code.


Note

Low Risk
Client-only clipboard write with a text fallback. No auth, persistence, or server changes.

Overview
Copying a user prompt with an attachment now writes text and one image as a single clipboard item, so pasting into a new thread keeps the image.

writeMessageToClipboard fetches the preview, normalizes it to PNG, and uses navigator.clipboard.write. If there is no image, the browser lacks composite clipboard support, or the rich write fails, it still copies text.

The copy hook accepts an optional write override. User timeline copy uses the first attachment with a previewUrl (regular images first, then preview annotations). Assistant copy is unchanged.

Reviewed by Cursor Bugbot for commit 025f7ff. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Include images when copying chat prompts via MessageCopyButton

  • Adds writeMessageToClipboard in messageClipboard.ts to write text plus a PNG image as a single ClipboardItem, falling back to text-only when unsupported or on error.
  • Extends useCopyToClipboard in useCopyToClipboard.ts with an optional write override so callers can perform rich clipboard writes while keeping the hook's copied-state and callbacks.
  • Passes a selected image (first regular image with a previewUrl, else first preview-annotation image) from UserTimelineRow in MessagesTimeline.tsx into MessageCopyButton, which uses the new path when an image is present.
  • Risk: fetchClipboardImageAsPng relies on fetch + offscreen canvas conversion; if the preview URL is cross-origin without CORS headers, the canvas taints and the write fails, silently degrading to text-only copy.

Macroscope summarized 025f7ff.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f601b7b6-272b-410b-a0b5-446403b5b4df

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 24, 2026
Comment thread apps/web/src/messageClipboard.ts

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One interaction regression found in the new clipboard path. See the inline comment.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/messageClipboard.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2cd1af3. Configure here.

Comment thread apps/web/src/messageClipboard.ts
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
@macroscopeapp

macroscopeapp Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This change introduces a new rich-clipboard workflow that fetches and normalizes attached images before writing them alongside prompt text. Its browser API, asynchronous image-processing, and fallback behavior create meaningful runtime surface area beyond a simple copy bug fix.

You can add or adjust custom eligibility rules. Learn more.

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant