This commit is contained in:
Vanessa 2022-08-19 10:37:26 +08:00
parent 17a8d4fac2
commit 18d4670077
2 changed files with 5 additions and 9 deletions

View file

@ -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) => {

View file

@ -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