Skip to content

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

:bug: Prevent task list nesting from the first list item block https://github.com/siyuan-note/siyuan/issues/18359

Danielf383594c349f
diff --git a/app/src/protyle/wysiwyg/turnIntoList.ts b/app/src/protyle/wysiwyg/turnIntoList.ts
index 3c1f4e7497..a7d8eeeedb 100644
--- a/app/src/protyle/wysiwyg/turnIntoList.ts
+++ b/app/src/protyle/wysiwyg/turnIntoList.ts
@@ -25,10 +25,10 @@ export const turnIntoTaskList = (protyle: IProtyle, type: string, blockElement:
editElement.removeAttribute("placeholder");
const isDone = dataTask && dataTask[1] !== " ";
if (blockElement.parentElement.classList.contains("li") &&
- blockElement.parentElement.childElementCount === 3 // https://ld246.com/article/1659315815506
- ) {
- // 仅有一项的列表才可转换
- if (!blockElement.parentElement.parentElement.classList.contains("protyle-wysiwyg") && // https://ld246.com/article/1659315815506
+ blockElement.previousElementSibling?.classList.contains("protyle-action")) {
+ // 仅包含一个内容块的单项列表才可转换
+ if (blockElement.parentElement.childElementCount === 3 && // https://ld246.com/article/1659315815506
+ !blockElement.parentElement.parentElement.classList.contains("protyle-wysiwyg") &&
blockElement.parentElement.parentElement.childElementCount === 2) {
const liElement = blockElement.parentElement.parentElement;
const oldHTML = liElement.outerHTML;