mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-24 06:39:38 +08: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:
@ -332,7 +332,19 @@ function isDomChecklist(domNode: HTMLElement) {
|
|||||||
}
|
}
|
||||||
// if children are checklist items, the node is a checklist ul. Applicable for googledoc checklist pasting.
|
// if children are checklist items, the node is a checklist ul. Applicable for googledoc checklist pasting.
|
||||||
for (const child of domNode.childNodes) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user