share via copy

This commit is contained in:
Pete Matsyburka committed 2026-09-23 11:00:17 +03:00
1 parent a588c2f4a4
commit f09732df90
1 file changed
+7
@@ -4,6 +4,13 @@ export default class extends HTMLElement {
this.addEventListener('click', (e) => {
const text = this.dataset.text || this.innerText.trim()
const download = window.webkit?.messageHandlers?.download
if (download && /^https?:\/\//.test(text)) {
e.preventDefault()
return download.postMessage({ url: text })
}
if (navigator.clipboard) {
navigator.clipboard.writeText(text).then(() => {