From 903acf43bdcc4eb40a407463990943da017c9bed Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 20 Dec 2025 21:16:54 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16197 --- app/src/protyle/wysiwyg/remove.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts index d47224da9..25574d408 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");