Change message copy button to copy content instead of anchor link
The per-message copy button previously copied a URL with a hash
anchor (#msg-{uuid}) for deep linking. Replace this with copying
the actual message content: for tool_call messages it copies the
tool name and input; for all other categories it copies the text
body. This is more immediately useful — users copying message
content is far more common than sharing anchor links.
Button title updated from "Copy link to message" to "Copy message
content" to match the new behavior.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -153,14 +153,16 @@ export function MessageBubble({
|
|||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const url = `${window.location.origin}${window.location.pathname}#msg-${message.uuid}`;
|
const text = message.category === "tool_call"
|
||||||
navigator.clipboard.writeText(url).then(() => {
|
? `${message.toolName || "Tool Call"}\n${message.toolInput || ""}`
|
||||||
|
: message.content;
|
||||||
|
navigator.clipboard.writeText(text).then(() => {
|
||||||
setLinkCopied(true);
|
setLinkCopied(true);
|
||||||
setTimeout(() => setLinkCopied(false), 1500);
|
setTimeout(() => setLinkCopied(false), 1500);
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}}
|
}}
|
||||||
className="flex items-center justify-center w-7 h-7 rounded-md text-foreground-muted hover:text-foreground hover:bg-surface-overlay/60 transition-colors"
|
className="flex items-center justify-center w-7 h-7 rounded-md text-foreground-muted hover:text-foreground hover:bg-surface-overlay/60 transition-colors"
|
||||||
title="Copy link to message"
|
title="Copy message content"
|
||||||
>
|
>
|
||||||
{linkCopied ? (
|
{linkCopied ? (
|
||||||
<svg className="w-4 h-4 text-green-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
<svg className="w-4 h-4 text-green-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
||||||
|
|||||||
Reference in New Issue
Block a user