Skip to content

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

:bug: Preserve list hierarchy when removing a nested task list https://github.com/siyuan-note/siyuan/issues/18327

Daniel3b9a704dfa76
diff --git a/app/src/protyle/wysiwyg/list.ts b/app/src/protyle/wysiwyg/list.ts
index 80272015e5..b35feea1b9 100644
--- a/app/src/protyle/wysiwyg/list.ts
+++ b/app/src/protyle/wysiwyg/list.ts
@@ -662,8 +662,11 @@ export const listOutdent = async (protyle: IProtyle, liItemElements: Element[],
return;
}
- if (liElement.childElementCount === 2 && parentLiItemElement.childElementCount === 3) {
- // 列表项里仅有包含一个列表项的列表,如 1. 1. 1 https://github.com/siyuan-note/insider/issues/494
+ if (liElement.childElementCount === 2 &&
+ (parentLiItemElement.childElementCount === 3 ||
+ (window.siyuan.config.editor.listLogicalOutdent &&
+ liElement.previousElementSibling?.classList.contains("protyle-action")))) {
+ // 父列表项仅包含单项子列表,或开启大纲反向缩进且单项子列表为首个内容块时,原地展开子列表
range.collapse(false);
moveToPrevious(deleteElement, range, isDelete);
range.insertNode(document.createElement("wbr"));