From 5b17f60f6fd2782f5f5266e1872ac56fd8a1c7cb Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Thu, 10 Jul 2025 10:15:38 +0800 Subject: [PATCH] Drop document.execCommand --- source/js/utils.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/source/js/utils.js b/source/js/utils.js index 966a320..3dcf058 100644 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -52,21 +52,7 @@ NexT.utils = { button.querySelector('i').className = 'fa fa-times-circle fa-fw'; }); } else { - const ta = document.createElement('textarea'); - ta.style.top = window.scrollY + 'px'; // Prevent page scrolling - ta.style.position = 'absolute'; - ta.style.opacity = '0'; - ta.readOnly = true; - ta.value = code; - document.body.append(ta); - ta.select(); - ta.setSelectionRange(0, code.length); - ta.readOnly = false; - const result = document.execCommand('copy'); - button.querySelector('i').className = result ? 'fa fa-check-circle fa-fw' : 'fa fa-times-circle fa-fw'; - ta.blur(); // For iOS - button.blur(); - document.body.removeChild(ta); + button.querySelector('i').className = 'fa fa-times-circle fa-fw'; } }); // If copycode.style is not mac, element is larger than target