Skip to content

Commit

Permalink
fix: fix copy listener event issue. (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Apr 21, 2023
1 parent 96ca579 commit c376e54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/plugins/useCopied.tsx
Expand Up @@ -12,7 +12,7 @@ export function useCopied(container: React.RefObject<HTMLDivElement>) {
});
}, []);
useEffect(() => {
const btns = container.current?.querySelectorAll('pre code + div.copied');
const btns = container.current?.querySelectorAll('div.copied[data-code]');
btns && Array.from(btns).forEach((elm) => elm.addEventListener('click', handle, false));
return () => {
btns && Array.from(btns).forEach((elm) => elm.removeEventListener('click', handle, false));
Expand Down

0 comments on commit c376e54

Please sign in to comment.