Skip to content

NOW MANAGED ON CODEBERG

Lexical: Fixed task list parsing

Dan Brownc03e44124a33
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;
}
}