@mdxeditor/editor 3.21.3 → 3.21.5
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.
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
|
/**
|
|
@@ -2069,7 +2073,7 @@ export declare interface MDXEditorProps {
|
|
|
2069
2073
|
*/
|
|
2070
2074
|
contentEditableClassName?: string;
|
|
2071
2075
|
/**
|
|
2072
|
-
* Controls the spellCheck value for the content editable element of the
|
|
2076
|
+
* Controls the spellCheck value for the content editable element of the editor.
|
|
2073
2077
|
* Defaults to true, use false to disable spell checking.
|
|
2074
2078
|
*/
|
|
2075
2079
|
spellCheck?: boolean;
|
|
@@ -2129,7 +2133,7 @@ export declare interface MDXEditorProps {
|
|
|
2129
2133
|
*/
|
|
2130
2134
|
iconComponentFor?: (name: IconKey) => JSX.Element;
|
|
2131
2135
|
/**
|
|
2132
|
-
* Set to
|
|
2136
|
+
* Set to true if you want to suppress the processing of HTML tags.
|
|
2133
2137
|
*/
|
|
2134
2138
|
suppressHtmlProcessing?: boolean;
|
|
2135
2139
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { $isListItemNode, $isListNode } from "@lexical/list";
|
|
2
|
+
import { $isTextNode, $isElementNode } 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
|
-
|
|
23
|
+
let surroundingParagraph = null;
|
|
24
|
+
for (const child of lexicalNode.getChildren()) {
|
|
25
|
+
if ($isTextNode(child) || $isElementNode(child) && child.isInline()) {
|
|
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
|
};
|