@lexical/markdown 0.2.5 → 0.2.8
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/LexicalMarkdown.d.ts +84 -6
- package/LexicalMarkdown.dev.js +685 -1220
- package/LexicalMarkdown.js.flow +84 -6
- package/LexicalMarkdown.prod.js +21 -39
- package/README.md +88 -6
- package/package.json +8 -8
package/LexicalMarkdown.d.ts
CHANGED
|
@@ -6,14 +6,92 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
LexicalEditor,
|
|
11
|
+
ElementNode,
|
|
12
|
+
LexicalNode,
|
|
13
|
+
TextNode,
|
|
14
|
+
TextFormatType,
|
|
15
|
+
} from 'lexical';
|
|
10
16
|
|
|
11
|
-
export
|
|
17
|
+
export type Transformer =
|
|
18
|
+
| ElementTransformer
|
|
19
|
+
| TextFormatTransformer
|
|
20
|
+
| TextMatchTransformer;
|
|
21
|
+
|
|
22
|
+
export type ElementTransformer = {
|
|
23
|
+
export: (
|
|
24
|
+
node: LexicalNode,
|
|
25
|
+
traverseChildren: (node: ElementNode) => string,
|
|
26
|
+
) => string | null;
|
|
27
|
+
regExp: RegExp;
|
|
28
|
+
replace: (
|
|
29
|
+
parentNode: ElementNode,
|
|
30
|
+
children: Array<LexicalNode>,
|
|
31
|
+
match: Array<string>,
|
|
32
|
+
isImport: boolean,
|
|
33
|
+
) => void;
|
|
34
|
+
type: 'element';
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type TextFormatTransformer = {
|
|
38
|
+
format: Array<TextFormatType>;
|
|
39
|
+
tag: string;
|
|
40
|
+
type: 'text-format';
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type TextMatchTransformer = {
|
|
44
|
+
export: (
|
|
45
|
+
node: LexicalNode,
|
|
46
|
+
exportChildren: (node: ElementNode) => string,
|
|
47
|
+
exportFormat: (node: TextNode, textContent: string) => string,
|
|
48
|
+
) => string | null;
|
|
49
|
+
importRegExp: RegExp;
|
|
50
|
+
regExp: RegExp;
|
|
51
|
+
replace: (node: TextNode, match: RegExpMatchArray) => void;
|
|
52
|
+
trigger: string;
|
|
53
|
+
type: 'text-match';
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// TODO:
|
|
57
|
+
// transformers should be required argument, breaking change
|
|
58
|
+
export function registerMarkdownShortcuts(
|
|
12
59
|
editor: LexicalEditor,
|
|
13
|
-
|
|
60
|
+
transformers?: Array<Transformer>,
|
|
14
61
|
): () => void;
|
|
62
|
+
|
|
63
|
+
// TODO:
|
|
64
|
+
// transformers should be required argument, breaking change
|
|
15
65
|
export function $convertFromMarkdownString(
|
|
16
|
-
|
|
17
|
-
|
|
66
|
+
markdown: string,
|
|
67
|
+
transformers?: Array<Transformer>,
|
|
18
68
|
): void;
|
|
19
|
-
|
|
69
|
+
|
|
70
|
+
// TODO:
|
|
71
|
+
// transformers should be required argument, breaking change
|
|
72
|
+
export function $convertToMarkdownString(
|
|
73
|
+
transformers?: Array<Transformer>,
|
|
74
|
+
): string;
|
|
75
|
+
|
|
76
|
+
export const BOLD_ITALIC_STAR: TextFormatTransformer;
|
|
77
|
+
export const BOLD_ITALIC_UNDERSCORE: TextFormatTransformer;
|
|
78
|
+
export const BOLD_STAR: TextFormatTransformer;
|
|
79
|
+
export const BOLD_UNDERSCORE: TextFormatTransformer;
|
|
80
|
+
export const INLINE_CODE: TextFormatTransformer;
|
|
81
|
+
export const ITALIC_STAR: TextFormatTransformer;
|
|
82
|
+
export const ITALIC_UNDERSCORE: TextFormatTransformer;
|
|
83
|
+
export const STRIKETHROUGH: TextFormatTransformer;
|
|
84
|
+
|
|
85
|
+
export const UNORDERED_LIST: ElementTransformer;
|
|
86
|
+
export const CODE: ElementTransformer;
|
|
87
|
+
export const HEADING: ElementTransformer;
|
|
88
|
+
export const ORDERED_LIST: ElementTransformer;
|
|
89
|
+
export const QUOTE: ElementTransformer;
|
|
90
|
+
export const CHECK_LIST: ElementTransformer;
|
|
91
|
+
|
|
92
|
+
export const LINK: TextMatchTransformer;
|
|
93
|
+
|
|
94
|
+
export const TRANSFORMERS: Array<Transformer>;
|
|
95
|
+
export const ELEMENT_TRANSFORMERS: Array<ElementTransformer>;
|
|
96
|
+
export const TEXT_FORMAT_TRANSFORMERS: Array<TextFormatTransformer>;
|
|
97
|
+
export const TEXT_MATCH_TRANSFORMERS: Array<TextFormatTransformer>;
|