diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx index b57fd74904cf..4f1b0ed24ead 100644 --- a/app/components/markdown.tsx +++ b/app/components/markdown.tsx @@ -128,8 +128,9 @@ export function PreCode(props: { children: any }) { className="copy-code-button" onClick={() => { if (ref.current) { - const code = ref.current.innerText; - copyToClipboard(code); + copyToClipboard( + ref.current.querySelector("code")?.innerText ?? "", + ); } }} >