From c03e44124a3312d6832f71103bda76ab66646a54 Mon Sep 17 00:00:00 2001 From: Dan Brown <ssddanbrown@googlemail.com> Date: Thu, 27 Mar 2025 14:56:32 +0000 Subject: [PATCH] Lexical: Fixed task list parsing Updated list DOM parsing to properly consider task list format set by other MD/WYSIWYG editors. --- .../js/wysiwyg/lexical/list/LexicalListNode.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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; } }