Skip to content

Commit

Permalink
rm multiple same listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
STetsing authored and Aniket-Engg committed Jan 13, 2025
1 parent bddb0ea commit 66405d2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libs/remix-ui/remix-ai/src/lib/components/Default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export const Default = (props) => {
Array.from(codeBlocks).forEach((block) => {
const copyButtons = block.getElementsByClassName('nlux-comp-copyButton');
Array.from(copyButtons).forEach((cp_btn) => {
// remove click event listener if existing
cp_btn.removeEventListener('click', () => {});

cp_btn.addEventListener('click', async () => {
await navigator.clipboard.writeText(block.textContent);
});
Expand Down

0 comments on commit 66405d2

Please sign in to comment.