fix:修复复制代码时多余的空行
Signed-off-by: sxz799 <sxz799@126.com>
This commit is contained in:
parent
8405b789e9
commit
d5a25fb0cc
@ -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(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user