From: Dan Brown Date: Thu, 27 Mar 2025 14:56:32 +0000 (+0000) Subject: Lexical: Fixed task list parsing X-Git-Tag: v25.02.2~1^2~1^2~3 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/c03e44124a3312d6832f71103bda76ab66646a54 Lexical: Fixed task list parsing Updated list DOM parsing to properly consider task list format set by other MD/WYSIWYG editors. --- diff --git a/resources/js/wysiwyg/lexical/list/LexicalListNode.ts b/resources/js/wysiwyg/lexical/list/LexicalListNode.ts index 6edf0d64a..b5c83addd 100644 --- a/resources/js/wysiwyg/lexical/list/LexicalListNode.ts +++ b/resources/js/wysiwyg/lexical/list/LexicalListNode.ts @@ -332,7 +332,19 @@ function isDomChecklist(domNode: HTMLElement) { } // if children are checklist items, the node is a checklist ul. Applicable for googledoc checklist pasting. for (const child of domNode.childNodes) { - if (isHTMLElement(child) && child.hasAttribute('aria-checked')) { + if (!isHTMLElement(child)) { + continue; + } + + if (child.hasAttribute('aria-checked')) { + return true; + } + + if (child.classList.contains('task-list-item')) { + return true; + } + + if (child.firstElementChild && child.firstElementChild.matches('input[type="checkbox"]')) { return true; } }