Przeglądaj źródła

:art: fix https://github.com/siyuan-note/siyuan/issues/10653

Vanessa 1 rok temu
rodzic
commit
521c7289b8
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      app/src/protyle/wysiwyg/enter.ts

+ 3 - 1
app/src/protyle/wysiwyg/enter.ts

@@ -219,7 +219,9 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
     // 回车之前的块为 1\n\n2 时会产生多个块
     // 回车之前的块为 1\n\n2 时会产生多个块
     Array.from(enterElement.children).forEach((item: HTMLElement) => {
     Array.from(enterElement.children).forEach((item: HTMLElement) => {
         if (item.dataset.nodeId === id) {
         if (item.dataset.nodeId === id) {
-            editableElement.innerHTML = item.querySelector('[contenteditable="true"]').innerHTML;
+            const previousElement = blockElement.previousElementSibling;
+            blockElement.outerHTML = item.outerHTML;
+            blockElement = (previousElement?.nextElementSibling || protyle.wysiwyg.element.firstElementChild) as HTMLElement;
             doOperation.push({
             doOperation.push({
                 action: "update",
                 action: "update",
                 data: blockElement.outerHTML,
                 data: blockElement.outerHTML,