Prechádzať zdrojové kódy

:bug: fix https://github.com/siyuan-note/insider/issues/1084

Vanessa 2 rokov pred
rodič
commit
0e2971c43f

+ 0 - 2
app/src/protyle/gutter/index.ts

@@ -65,7 +65,6 @@ export class Gutter {
                 window.siyuan.dragElement = undefined;
             }
         });
-        // TODO:fold
         this.element.addEventListener("click", (event: MouseEvent & { target: HTMLInputElement }) => {
             const buttonElement = hasClosestByTag(event.target, "BUTTON");
             if (!buttonElement) {
@@ -1454,7 +1453,6 @@ export class Gutter {
                 });
             }
         });
-        // TODO 字体大小
         return styles;
     }
 

+ 3 - 2
app/src/protyle/wysiwyg/transaction.ts

@@ -220,6 +220,7 @@ const promiseTransaction = () => {
                     if (operation.previousID) {
                         Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.previousID}"]`)).forEach(item => {
                             if (item.nextElementSibling?.getAttribute("data-node-id") !== operation.id &&
+                                !hasClosestByAttribute(item, "data-node-id", operation.id) && // 段落转列表会在段落后插入新列表
                                 (item.getAttribute("data-type") === "NodeBlockQueryEmbed" || !hasClosestByAttribute(item.parentElement, "data-type", "NodeBlockQueryEmbed"))) {
                                 item.insertAdjacentHTML("afterend", operation.data);
                                 cursorElements.push(item.nextElementSibling);
@@ -643,7 +644,7 @@ export const turnsIntoOneTransaction = (options: { protyle: IProtyle, selectsEle
         });
         parentElement.innerHTML = html + '<div class="protyle-attr" contenteditable="false"></div>';
     }
-    const previousId = options.selectsElement[0].previousElementSibling ? options.selectsElement[0].previousElementSibling.getAttribute("data-node-id") : undefined;
+    const previousId = options.selectsElement[0].getAttribute("data-node-id");
     const parentId = options.selectsElement[0].parentElement.getAttribute("data-node-id") || options.protyle.block.parentID;
     const doOperations: IOperation[] = [{
         action: "insert",
@@ -665,7 +666,7 @@ export const turnsIntoOneTransaction = (options: { protyle: IProtyle, selectsEle
         undoOperations.push({
             action: "move",
             id: itemId,
-            previousID: itemPreviousId || previousId,
+            previousID: itemPreviousId || id,
             parentID: parentId
         });
         if (options.type.endsWith("Ls")) {