Skip to content

Commit 1432018

Browse files
author
kongjing
committed
fix: 代码复制
1 parent 4f49952 commit 1432018

File tree

1 file changed

+4
-1
lines changed
  • packages/doc/src/components/markdown

1 file changed

+4
-1
lines changed

packages/doc/src/components/markdown/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ function copyAction() {
6262
const timer = null
6363
item.onclick = () => {
6464
if (timer) return
65-
const parent = item.parentNode
65+
let parent = item.parentNode
66+
if (parent.className !== 'code-box') {
67+
parent = parent.parentNode
68+
}
6669
const code = parent.querySelectorAll('pre code')[0]
6770
copyToClipboard(code.innerText)
6871
toast.success('复制成功!', {

0 commit comments

Comments
 (0)