Jeffrey Chen 8 månader sedan
förälder
incheckning
8ca78a4938
1 ändrade filer med 4 tillägg och 1 borttagningar
  1. 4 1
      app/src/boot/globalEvent/click.ts

+ 4 - 1
app/src/boot/globalEvent/click.ts

@@ -66,7 +66,10 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
     }
     const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
     if (copyElement) {
-        let text = copyElement.parentElement.nextElementSibling.textContent.replace("/\n$/", "");
+        let text = copyElement.parentElement.nextElementSibling.textContent;
+        if (!/(\n{2,})$/.test(text)) {
+            text = text.replace(/\n$/, "");
+        }
         text = text.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382
         writeText(text);
         showMessage(window.siyuan.languages.copied, 2000);