浏览代码

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

Vanessa 2 年之前
父节点
当前提交
18d4670077
共有 2 个文件被更改,包括 5 次插入9 次删除
  1. 4 3
      app/src/protyle/toolbar/index.ts
  2. 1 6
      app/src/protyle/wysiwyg/remove.ts

+ 4 - 3
app/src/protyle/toolbar/index.ts

@@ -614,7 +614,7 @@ export class Toolbar {
         }
         const id = nodeElement.getAttribute("data-node-id");
         const type = renderElement.getAttribute("data-type");
-        let html = nodeElement.outerHTML;
+        let html = protyle.lute.SpinBlockDOM(nodeElement.outerHTML);
         let title = "HTML";
         let placeholder = "";
         switch (renderElement.getAttribute("data-subtype")) {
@@ -854,8 +854,9 @@ export class Toolbar {
                 renderElement.setAttribute("data-content", renderElement.getAttribute("data-content").replace(/\n/g, ""));
             }
             nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
-            updateTransaction(protyle, id, nodeElement.outerHTML, html);
-            html = nodeElement.outerHTML;
+            const newHTML = protyle.lute.SpinBlockDOM(nodeElement.outerHTML)
+            updateTransaction(protyle, id, newHTML, html);
+            html = newHTML;
             event.stopPropagation();
         });
         textElement.addEventListener("keydown", (event: KeyboardEvent) => {

+ 1 - 6
app/src/protyle/wysiwyg/remove.ts

@@ -212,14 +212,9 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
                     }
                 }
             } else {
-                // https://github.com/siyuan-note/siyuan/issues/4113
-                if (topElement.getAttribute("data-render") === "true" && ["mindmap", "echarts"].includes(topElement.getAttribute("data-subtype"))) {
-                    topElement.removeAttribute("data-render");
-                    topElement.firstElementChild.outerHTML = '<div spin="1"></div>';
-                }
                 inserts.push({
                     action: "insert",
-                    data: topElement.outerHTML,
+                    data: protyle.lute.SpinBlockDOM(topElement.outerHTML),  // 防止图标撤销问题
                     id,
                     previousID: topElement.previousElementSibling ? topElement.previousElementSibling.getAttribute("data-node-id") : "",
                     parentID: topElement.parentElement.getAttribute("data-node-id") || protyle.block.parentID