Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/16197

Vanessa903acf43bdcc
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index d47224da95..25574d4088 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -97,6 +97,21 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
};
}
});
+ foldTransaction.data.undoOperations.reverse();
+ if (topElement.previousElementSibling &&
+ topElement.previousElementSibling.getAttribute("data-type") === "NodeHeading" &&
+ topElement.previousElementSibling.getAttribute("fold") === "1") {
+ const foldId = topElement.previousElementSibling.getAttribute("data-node-id");
+ if (!unfoldData[foldId]) {
+ const foldTransaction = await fetchSyncPost("/api/block/getHeadingDeleteTransaction", {
+ id: foldId,
+ });
+ unfoldData[foldId] = {
+ element: topElement.previousElementSibling,
+ previousID: foldTransaction.data.doOperations[foldTransaction.data.doOperations.length - 1].id
+ };
+ }
+ }
inserts.push(...foldTransaction.data.undoOperations);
// https://github.com/siyuan-note/siyuan/issues/4422
topElement.firstElementChild.removeAttribute("contenteditable");