Skip to content

Commit c376e54

Browse files
committedApr 21, 2023
fix: fix copy listener event issue. (#220)
1 parent 96ca579 commit c376e54

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎core/src/plugins/useCopied.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function useCopied(container: React.RefObject<HTMLDivElement>) {
1212
});
1313
}, []);
1414
useEffect(() => {
15-
const btns = container.current?.querySelectorAll('pre code + div.copied');
15+
const btns = container.current?.querySelectorAll('div.copied[data-code]');
1616
btns && Array.from(btns).forEach((elm) => elm.addEventListener('click', handle, false));
1717
return () => {
1818
btns && Array.from(btns).forEach((elm) => elm.removeEventListener('click', handle, false));

0 commit comments

Comments
 (0)
Please sign in to comment.