From f09732df908ee45236e2ce89fd6d2030cc58d523 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Thu, 17 Sep 2026 17:44:56 +0300 Subject: [PATCH] share via copy --- app/javascript/elements/clipboard_copy.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/javascript/elements/clipboard_copy.js b/app/javascript/elements/clipboard_copy.js index f6e492bc9..a382f138e 100644 --- a/app/javascript/elements/clipboard_copy.js +++ b/app/javascript/elements/clipboard_copy.js @@ -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(() => {