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

18 lines
365 B

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