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/16113 6112

Vanessac0699721ac09
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index 0600f09517..e15603157d 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -52,6 +52,7 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
let listElement: Element;
let topParentElement: Element;
hideElements(["select"], protyle);
+ const unfoldOperations = [];
for (let i = 0; i < selectElements.length; i++) {
const item = selectElements[i];
const topElement = getTopAloneElement(item);
@@ -108,9 +109,7 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
(topElement.nextElementSibling.getAttribute("data-type") !== "NodeHeading" ||
(topElement.nextElementSibling.getAttribute("data-type") === "NodeHeading" && topElement.nextElementSibling.getAttribute("data-subtype") < topElement.getAttribute("data-subtype"))
)) {
- const unfoldOperations = setFold(protyle, topElement.previousElementSibling, true, false, false, true);
- deletes.push(...unfoldOperations.doOperations);
- inserts.push(...unfoldOperations.undoOperations);
+ unfoldOperations.push(setFold(protyle, topElement.previousElementSibling, true, false, false, true));
const foldTransaction = await fetchSyncPost("/api/block/getHeadingDeleteTransaction", {
id: topElement.previousElementSibling.getAttribute("data-node-id"),
});
@@ -131,6 +130,10 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
topElement.remove();
}
}
+ unfoldOperations.forEach(item => {
+ deletes.push(...item.doOperations);
+ inserts.push(...item.undoOperations);
+ });
if (sideElement) {
if (protyle.block.showAll && sideElement.classList.contains("protyle-wysiwyg") && protyle.wysiwyg.element.childElementCount === 0) {
setTimeout(() => {