@mdxeditor/editor 3.21.3 → 3.21.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,6 +76,7 @@ function exportLexicalTreeToMdast({
76
76
  },
77
77
  appendToParent,
78
78
  visitChildren,
79
+ visit,
79
80
  registerReferredComponent
80
81
  }
81
82
  });
package/dist/index.d.ts CHANGED
@@ -1782,6 +1782,10 @@ export declare interface LexicalExportVisitor<LN extends LexicalNode, UN extends
1782
1782
  * @see {@link JsxComponentDescriptor}
1783
1783
  */
1784
1784
  registerReferredComponent(componentName: string): void;
1785
+ /**
1786
+ * visits the specified lexical node
1787
+ */
1788
+ visit(node: LexicalNode, parent: Mdast.Parent): void;
1785
1789
  };
1786
1790
  }): void;
1787
1791
  /**
@@ -1,4 +1,5 @@
1
1
  import { $isListItemNode, $isListNode } from "@lexical/list";
2
+ import { $isTextNode } from "lexical";
2
3
  const LexicalListItemVisitor = {
3
4
  testLexicalNode: $isListItemNode,
4
5
  visitLexicalNode: ({ lexicalNode, mdastParent, actions }) => {
@@ -19,7 +20,21 @@ const LexicalListItemVisitor = {
19
20
  spread: false,
20
21
  children: []
21
22
  });
22
- actions.visitChildren(lexicalNode, listItem);
23
+ let surroundingParagraph = null;
24
+ for (const child of lexicalNode.getChildren()) {
25
+ if ($isTextNode(child)) {
26
+ if (!surroundingParagraph) {
27
+ surroundingParagraph = actions.appendToParent(listItem, {
28
+ type: "paragraph",
29
+ children: []
30
+ });
31
+ }
32
+ actions.visit(child, surroundingParagraph);
33
+ } else {
34
+ surroundingParagraph = null;
35
+ actions.visit(child, listItem);
36
+ }
37
+ }
23
38
  }
24
39
  }
25
40
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "3.21.3",
14
+ "version": "3.21.4",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",