From d5a25fb0ccb8a0cabc558f751518c8b1ef4dc5a9 Mon Sep 17 00:00:00 2001 From: sxz799 Date: Fri, 27 Oct 2023 15:45:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=97=B6=E5=A4=9A=E4=BD=99=E7=9A=84=E7=A9=BA?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: sxz799 --- assets/js/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/utils.js b/assets/js/utils.js index e78675e..79353aa 100644 --- a/assets/js/utils.js +++ b/assets/js/utils.js @@ -255,7 +255,7 @@ NexT.utils = { const button = element.querySelector('.copy-btn'); button.addEventListener('click', () => { const lines = element.querySelector('.code') || element.querySelector('code'); - const code = lines.innerText; + const code = lines.innerText.replace(/(\n{2,})/g, '\n'); if (navigator.clipboard) { // https://caniuse.com/mdn-api_clipboard_writetext navigator.clipboard.writeText(code).then(() => { @@ -647,4 +647,4 @@ NexT.utils = { intersectionObserver.observe(element); }); } -}; \ No newline at end of file +};