Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

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

Vanessa18d467007790
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index f850234fa7..9c5770e470 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/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) => {
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index abfb9e4324..5c6d277e8f 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/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