Open kindoflew opened 3 years ago
sorry for the delayed response - interesting idea! not sure about the a11y angle of offering it for a button or a p tag. but i like it that its not trivial to implement so it could be helpful in a library.
leaving it open for people to find.
no worries! it gave me time to actually learn how to use jsdom
properly 😂
Copies text to clipboard when clicked. Attach to the node you want to copy or, with the optional target parameter, attach to a button to copy the desired text. I've seen this used a lot for coding tutorials, specifically for copying long terminal commands.
REPL example: https://svelte.dev/repl/667d8ac94e2349f3a1b7b8c5fa4c0082?version=3.32.1
Would be happy to try a PR if people like this.