Fix code duplication

This commit is contained in:
lyf 2024-09-23 11:34:20 +08:00
parent 23f2b6213c
commit 35aa2c7270
1 changed files with 4 additions and 2 deletions

View File

@ -128,8 +128,10 @@ export function PreCode(props: { children: any }) {
className="copy-code-button" className="copy-code-button"
onClick={() => { onClick={() => {
if (ref.current) { if (ref.current) {
const code = ref.current.innerText; // const code = ref.current.innerText;
copyToClipboard(code); copyToClipboard(
ref.current.querySelector("code")?.innerText ?? "",
);
} }
}} }}
></span> ></span>