From a021c8130f2b4f2690c042023afa339dcd06e35f Mon Sep 17 00:00:00 2001 From: wisonic Date: Wed, 30 Oct 2024 14:58:20 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E5=8D=95=E5=85=83=E6=A0=BC=E5=A4=9A=E9=80=89=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E6=8D=A2=E8=A1=8C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/js/util.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/util.ts b/core/core-frontend/src/views/chart/components/js/util.ts index f3c8fc292f..897ec36972 100644 --- a/core/core-frontend/src/views/chart/components/js/util.ts +++ b/core/core-frontend/src/views/chart/components/js/util.ts @@ -555,14 +555,13 @@ export const copyString = (content: string, notify = false) => { const clipboard = navigator.clipboard || { writeText: data => { return new Promise(resolve => { - const inputDom = document.createElement('input') - inputDom.setAttribute('style', 'z-index: -1;position: fixed;opacity: 0;') - inputDom.setAttribute('type', 'text') - inputDom.setAttribute('value', data) - document.body.appendChild(inputDom) - inputDom.select() + const textareaDom = document.createElement('textarea') + textareaDom.setAttribute('style', 'z-index: -1;position: fixed;opacity: 0;') + textareaDom.value = data + document.body.appendChild(textareaDom) + textareaDom.select() document.execCommand('copy') - inputDom.remove() + textareaDom.remove() resolve() }) }