From b0ca44de00c848fbd76eceed48590015160708e6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 22 Apr 2025 17:41:52 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14666 --- app/src/protyle/wysiwyg/turnIntoList.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/protyle/wysiwyg/turnIntoList.ts b/app/src/protyle/wysiwyg/turnIntoList.ts index f0b30af2d..4bf58e6d6 100644 --- a/app/src/protyle/wysiwyg/turnIntoList.ts +++ b/app/src/protyle/wysiwyg/turnIntoList.ts @@ -11,10 +11,12 @@ export const turnIntoTaskList = (protyle: IProtyle, type: string, blockElement: ["[]", "【】"].includes(editElement.innerHTML.substring(0, 2)) ) ) { - const contextStar2tIndex = (editElement.innerHTML.indexOf("】") + 1); - let contextStartIndex = (editElement.innerHTML.indexOf("]") + 1) || contextStar2tIndex; - if (contextStartIndex !== -1 && contextStar2tIndex < contextStartIndex) { + const contextStar2tIndex = editElement.innerHTML.indexOf("】") + 1; + let contextStartIndex = editElement.innerHTML.indexOf("]") + 1; + if (contextStartIndex === 0) { contextStartIndex = contextStar2tIndex; + } else if (contextStartIndex > 0 && contextStar2tIndex > 0) { + contextStartIndex = Math.min(contextStartIndex, contextStar2tIndex); } const isDone = editElement.innerHTML.substring(1, 2).toLowerCase() === "x"; if (blockElement.parentElement.classList.contains("li") &&