0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-04-25 04:51:35 +00:00

Lexical: Fixed task list parsing

Updated list DOM parsing to properly consider task list format set by
other MD/WYSIWYG editors.
This commit is contained in:
Dan Brown 2025-03-27 14:56:32 +00:00
parent 5c6671b3bf
commit c03e44124a
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9

View file

@ -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;
}
}