]> BookStack Code Mirror - bookstack/commitdiff
Lexical: Fixed task list parsing
authorDan Brown <redacted>
Thu, 27 Mar 2025 14:56:32 +0000 (14:56 +0000)
committerDan Brown <redacted>
Thu, 27 Mar 2025 14:56:32 +0000 (14:56 +0000)
Updated list DOM parsing to properly consider task list format set by
other MD/WYSIWYG editors.

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

index 6edf0d64a2e0b5aa4c1450e8850130da00761875..b5c83adddcef7dca707a6a1921718a29b5b4aca6 100644 (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;
     }
   }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.