You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docuseal/app/javascript/elements/clipboard_copy.js

16 lines
348 B

export default class extends HTMLElement {
connectedCallback () {
this.addEventListener('click', (e) => {
e.stopPropagation()
navigator.clipboard.writeText(this.dataset.text || this.innerText.trim())
})
}
disconnectedCallback () {
this.querySelectorAll('input').forEach((e) => {
e.checked = false
})
}
}