Skip to content

feat(chat): add copy buttons to code blocks and agent prose messages#3238

Merged
MattPua merged 2 commits into
mainfrom
posthog-code/fix-copy-button-for-responses-in-new-chat
Jul 7, 2026
Merged

feat(chat): add copy buttons to code blocks and agent prose messages#3238
MattPua merged 2 commits into
mainfrom
posthog-code/fix-copy-button-for-responses-in-new-chat

Conversation

@MattPua

@MattPua MattPua commented Jul 7, 2026

Copy link
Copy Markdown
Member

Problem

The new chat thread had no copy buttons, so responses and code blocks couldn't be copied via a button like the classic view.

Changes

CleanShot.2026-07-07.at.12.30.08.mp4
  • ChatMarkdown: fenced/multi-line code blocks now render in a ChatCodeBlock with a hover copy button.
  • AgentProse (ChatThread): hover copy button for the whole message (raw markdown, matching the classic AgentMessage).

How did you test this?

Typecheck + lint pass. Not yet verified in the running app.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

@trunk-io

trunk-io Bot commented Jul 7, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit b0bcbda.

@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(chat): add copy buttons to code blo..." | Re-trigger Greptile

Comment thread packages/ui/src/features/sessions/components/chat-thread/ChatMarkdown.tsx Outdated
@MattPua MattPua requested a review from adamleithp July 7, 2026 16:25
Swallows clipboard write failures so the button doesn't report a false
"Copied!", and dedupes the copy state machine across ChatCodeBlock and
AgentProse.

Generated-By: PostHog Code
Task-Id: b447d951-99cf-4194-9d7a-867d6ea04f32
@MattPua MattPua merged commit b8eb80c into main Jul 7, 2026
24 checks passed
@MattPua MattPua deleted the posthog-code/fix-copy-button-for-responses-in-new-chat branch July 7, 2026 17:59
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.

2 participants