From 2d1d19e4578d811b05c34955cfdc16cbc7216ca9 Mon Sep 17 00:00:00 2001 From: machine Date: Fri, 25 Oct 2024 17:37:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=A0=E6=B3=95=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E8=A7=84=E5=88=99=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@core/utils/navigator.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/@core/utils/navigator.ts b/src/@core/utils/navigator.ts index e3f3782f..f60a0841 100644 --- a/src/@core/utils/navigator.ts +++ b/src/@core/utils/navigator.ts @@ -21,6 +21,8 @@ export async function copyToClipboard(content: string) { const input = document.createElement('textarea') input.value = content document.body.appendChild(input) + // 阻止事件冒泡到其他元素,确保 focusin 事件只在 textarea 元素上处理,不会影响其他元素 + input.addEventListener('focusin', e => e.stopPropagation()) input.select() document.execCommand('copy') document.body.removeChild(input)