Skip to content

Commit 1c10187

Browse files
authored
fix: code copy failed (#2168)
1 parent 167fbbd commit 1c10187

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/hooks/useCodeCopy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const useCodeCopy = () => {
99
e.target.closest("button.copy-button")
1010
if (button) {
1111
if (button.classList.contains("copied")) return
12-
const pre = button.nextElementSibling
12+
const pre = button.nextElementSibling?.children[0]
1313
if (pre?.tagName === "PRE") {
1414
clipboardCopy(pre.textContent || "")
1515
const textEl = button.querySelector("span:nth-child(2)")

0 commit comments

Comments
 (0)