diff --git a/app/src/protyle/wysiwyg/turnIntoList.ts b/app/src/protyle/wysiwyg/turnIntoList.ts index c11d9ecba..d1d601585 100644 --- a/app/src/protyle/wysiwyg/turnIntoList.ts +++ b/app/src/protyle/wysiwyg/turnIntoList.ts @@ -1,16 +1,16 @@ -import {transaction} from "./transaction"; +import {transaction, updateTransaction} from "./transaction"; import {focusByWbr} from "../util/selection"; +import * as dayjs from "dayjs"; export const turnIntoTaskList = (protyle: IProtyle, type: string, blockElement: HTMLElement, editElement: HTMLElement) => { if (type !== "NodeCodeBlock" && + blockElement.parentElement.getAttribute("data-subtype") !== "t" && ( ["[ ]", "[x]", "[X]", "【 】", "【x】", "【X】"].includes(editElement.innerHTML.substring(0, 3)) || ["[]", "【】"].includes(editElement.innerHTML.substring(0, 2)) ) ) { - const doOperation: IOperation[] = [] - const undoOperation: IOperation[] = [] - const contextStartIndex = (editElement.innerHTML.indexOf("]") || editElement.innerHTML.indexOf("]")) + 1; + const contextStartIndex = (editElement.innerHTML.indexOf("]") + 1) || (editElement.innerHTML.indexOf("】") + 1); const isDone = editElement.innerHTML.substring(1, 2).toLowerCase() === "x"; if (blockElement.parentElement.classList.contains("li") && blockElement.parentElement.childElementCount === 3 // https://ld246.com/article/1659315815506 @@ -18,9 +18,20 @@ export const turnIntoTaskList = (protyle: IProtyle, type: string, blockElement: // 仅有一项的列表才可转换 if (!blockElement.parentElement.parentElement.classList.contains("protyle-wysiwyg") && // https://ld246.com/article/1659315815506 blockElement.parentElement.parentElement.childElementCount === 2) { - `