From a12a8830d49887cb1d7fa7391496310e58d63f7b Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Sat, 4 Oct 2025 11:34:56 +0800 Subject: [PATCH] =?UTF-8?q?ui:=20=E6=94=B9=E5=96=84=20=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E5=88=B0=E5=89=AA=E8=B4=B4=E8=96=84=20=E7=9A=84=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BD=93=E9=AA=8C=20*=20=E5=9C=A8=20Via=20=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E4=B8=8A,=20writeText=20=E6=9C=AC=E8=B4=A8?= =?UTF-8?q?=E4=B8=8A=E8=A2=AB=E9=87=8D=E5=86=99=E4=BA=86,=20=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E8=BF=98=E6=98=AF=20execCommand=20copy=20*=20?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2=20copy=20=E4=B8=BA=20cut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/copyToClipboard.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ui/copyToClipboard.ts b/client/ui/copyToClipboard.ts index 759e123..2cb4a7b 100644 --- a/client/ui/copyToClipboard.ts +++ b/client/ui/copyToClipboard.ts @@ -1,5 +1,5 @@ export default function copyToClipboard(text: string) { - if (navigator.clipboard) + if (!("via" in window) && navigator.clipboard) return navigator.clipboard.writeText(text) return new Promise((res, rej) => { if (document.hasFocus()) { @@ -10,7 +10,7 @@ export default function copyToClipboard(text: string) { a.style.top = "10px" a.value = text a.select() - document.execCommand("copy", true) + document.execCommand("cut", true) document.body.removeChild(a) res(null) } else {