Skip to content

Commit c03e441

Browse files
committed
Lexical: Fixed task list parsing
Updated list DOM parsing to properly consider task list format set by other MD/WYSIWYG editors.
1 parent 5c6671b commit c03e441

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

resources/js/wysiwyg/lexical/list/LexicalListNode.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,19 @@ function isDomChecklist(domNode: HTMLElement) {
332332
}
333333
// if children are checklist items, the node is a checklist ul. Applicable for googledoc checklist pasting.
334334
for (const child of domNode.childNodes) {
335-
if (isHTMLElement(child) && child.hasAttribute('aria-checked')) {
335+
if (!isHTMLElement(child)) {
336+
continue;
337+
}
338+
339+
if (child.hasAttribute('aria-checked')) {
340+
return true;
341+
}
342+
343+
if (child.classList.contains('task-list-item')) {
344+
return true;
345+
}
346+
347+
if (child.firstElementChild && child.firstElementChild.matches('input[type="checkbox"]')) {
336348
return true;
337349
}
338350
}

0 commit comments

Comments
 (0)