add copy to clipboard for invites

This commit is contained in:
2022-02-15 19:50:48 -05:00
parent 6c3867f9a8
commit 0b0e1cc639
8 changed files with 78 additions and 25 deletions

View File

@ -56,3 +56,13 @@ liveSocket.connect()
// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session
// >> liveSocket.disableLatencySim()
window.liveSocket = liveSocket
// Copy to clipboard
window.addEventListener('cannery:clipcopy', (event) => {
if ('clipboard' in navigator) {
const text = event.target.textContent
navigator.clipboard.writeText(text)
} else {
window.alert('Sorry, your browser does not support clipboard copy.')
}
})