From 14441cc52a9e83c0f8e27cff57e7e3e39d032ce8 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 28 Dec 2025 21:59:22 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/12327 --- app/src/menus/protyle.ts | 4 +++- app/src/protyle/wysiwyg/remove.ts | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 9af4c9f0c..355040728 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -2460,7 +2460,9 @@ export const setFoldById = (data: { export const setFold = (protyle: IProtyle, nodeElement: Element, isOpen?: boolean, isRemove?: boolean, addLoading = true, getOperations = false) => { - if (nodeElement.getAttribute("data-type") === "NodeListItem" && nodeElement.childElementCount < 4) { + if (nodeElement.getAttribute("data-type") === "NodeListItem" && nodeElement.childElementCount < 4 && + // 该情况需要强制展开 https://github.com/siyuan-note/siyuan/issues/12327 + !isOpen) { // 没有子列表或多个块的列表项不进行折叠 return {fold: -1}; } diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts index 666b2fe5f..1fc12776d 100644 --- a/app/src/protyle/wysiwyg/remove.ts +++ b/app/src/protyle/wysiwyg/remove.ts @@ -55,7 +55,7 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang const unfoldData: { [key: string]: { element: Element, - previousID: string + previousID?: string } } = {}; for (let i = 0; i < selectElements.length; i++) { @@ -149,6 +149,13 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang } else { listElement = undefined; } + // https://github.com/siyuan-note/siyuan/issues/12327 + if (topElement.parentElement.classList.contains("li") && topElement.parentElement.childElementCount === 4 && + topElement.parentElement.getAttribute("fold") === "1") { + unfoldData[topElement.parentElement.getAttribute("data-node-id")] = { + element: topElement.parentElement, + }; + } topElement.remove(); } }