Skip to content

Commit

Permalink
multiple buttons
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 303ae13 commit bddb0ea
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions libs/remix-ui/remix-ai/src/lib/components/Default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ export const Default = (props) => {
observer.complete()
const codeBlocks = document.getElementsByClassName('code-block')

// override copy button functionality
Array.from(codeBlocks).forEach((block) => {
// only 1 copy button per code block
const copyButton = document.getElementsByClassName('nlux-comp-copyButton')
copyButton[0].addEventListener('click', async () => {
console.log('nlux copy button clicked');
const text = block.textContent; //|| block.innerText;
await navigator.clipboard.writeText(block.textContent);
});
const copyButtons = block.getElementsByClassName('nlux-comp-copyButton');
Array.from(copyButtons).forEach((cp_btn) => {
cp_btn.addEventListener('click', async () => {
await navigator.clipboard.writeText(block.textContent);
});
})
})
}
)
Expand Down

0 comments on commit bddb0ea

Please sign in to comment.