(null);
const {copied, markCopied} = useCopiedFlag();
const handleCopy = useCallback(() => {
void copyText(preRef.current?.textContent ?? "").then((ok) => { if (ok) markCopied(); });
}, [markCopied]);
return (
);
}
const components: Components = {
a({node: _node, ...props}) {
return ;
},
img({node: _node, ...props}) {
return
;
},
pre({node: _node, ...props}) {
return ;
},
};
export function CopyMessageButton({text}:{text:string}) {
const {copied, markCopied} = useCopiedFlag();
if (!text.trim()) return null;
return (
);
}
export const ChatMarkdown = memo(function ChatMarkdown({children}:{children:string}) {
return (
sanitizeMarkdownUrl(url) ?? ""}
>
{children}
);
});