@blue-patterns/richtext 0.0.0-stage → 0.7.18

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.
Files changed (201) hide show
  1. package/CHANGELOG.md +275 -0
  2. package/LICENSE +22 -0
  3. package/README.md +88 -2
  4. package/astryx.integration.mjs +11 -0
  5. package/blocks/RichTextEditorShowcase.template.mjs +13 -0
  6. package/blocks/RichTextEditorShowcase.tsx +19 -0
  7. package/dist/RichTextEditor.d.ts +282 -0
  8. package/dist/RichTextEditor.d.ts.map +1 -0
  9. package/dist/RichTextEditor.js +657 -0
  10. package/dist/RichTextEditorAutoLinkPlugin.d.ts +83 -0
  11. package/dist/RichTextEditorAutoLinkPlugin.d.ts.map +1 -0
  12. package/dist/RichTextEditorAutoLinkPlugin.js +99 -0
  13. package/dist/RichTextEditorToolbar.d.ts +186 -0
  14. package/dist/RichTextEditorToolbar.d.ts.map +1 -0
  15. package/dist/RichTextEditorToolbar.js +688 -0
  16. package/dist/RichTextView.d.ts +92 -0
  17. package/dist/RichTextView.d.ts.map +1 -0
  18. package/dist/RichTextView.js +267 -0
  19. package/dist/codeLanguages.d.ts +14 -0
  20. package/dist/codeLanguages.d.ts.map +1 -0
  21. package/dist/codeLanguages.js +34 -0
  22. package/dist/codeLineTokens.d.ts +53 -0
  23. package/dist/codeLineTokens.d.ts.map +1 -0
  24. package/dist/codeLineTokens.js +188 -0
  25. package/dist/editorNodes.d.ts +8 -0
  26. package/dist/editorNodes.d.ts.map +1 -0
  27. package/dist/editorNodes.js +30 -0
  28. package/dist/editorTheme.d.ts +7 -0
  29. package/dist/editorTheme.d.ts.map +1 -0
  30. package/dist/editorTheme.js +328 -0
  31. package/dist/index.d.ts +31 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +28 -0
  34. package/dist/internal/CodeBackspacePlugin.d.ts +2 -0
  35. package/dist/internal/CodeBackspacePlugin.d.ts.map +1 -0
  36. package/dist/internal/CodeBackspacePlugin.js +70 -0
  37. package/dist/internal/CodeBlockHeaderPlugin.d.ts +11 -0
  38. package/dist/internal/CodeBlockHeaderPlugin.d.ts.map +1 -0
  39. package/dist/internal/CodeBlockHeaderPlugin.js +204 -0
  40. package/dist/internal/CodePastePlugin.d.ts +5 -0
  41. package/dist/internal/CodePastePlugin.d.ts.map +1 -0
  42. package/dist/internal/CodePastePlugin.js +104 -0
  43. package/dist/internal/CodeSyntaxPlugin.d.ts +8 -0
  44. package/dist/internal/CodeSyntaxPlugin.d.ts.map +1 -0
  45. package/dist/internal/CodeSyntaxPlugin.js +397 -0
  46. package/dist/internal/CodeTabPlugin.d.ts +2 -0
  47. package/dist/internal/CodeTabPlugin.d.ts.map +1 -0
  48. package/dist/internal/CodeTabPlugin.js +256 -0
  49. package/dist/internal/DisabledLinkGuardPlugin.d.ts +4 -0
  50. package/dist/internal/DisabledLinkGuardPlugin.d.ts.map +1 -0
  51. package/dist/internal/DisabledLinkGuardPlugin.js +93 -0
  52. package/dist/internal/ImageSourceCaretPlugin.d.ts +3 -0
  53. package/dist/internal/ImageSourceCaretPlugin.d.ts.map +1 -0
  54. package/dist/internal/ImageSourceCaretPlugin.js +105 -0
  55. package/dist/internal/ListItemShortcutsPlugin.d.ts +6 -0
  56. package/dist/internal/ListItemShortcutsPlugin.d.ts.map +1 -0
  57. package/dist/internal/ListItemShortcutsPlugin.js +314 -0
  58. package/dist/internal/MarkdownExtensionsPlugin.d.ts +17 -0
  59. package/dist/internal/MarkdownExtensionsPlugin.d.ts.map +1 -0
  60. package/dist/internal/MarkdownExtensionsPlugin.js +185 -0
  61. package/dist/internal/SelectAllScopePlugin.d.ts +2 -0
  62. package/dist/internal/SelectAllScopePlugin.d.ts.map +1 -0
  63. package/dist/internal/SelectAllScopePlugin.js +67 -0
  64. package/dist/internal/TableColumnFloorPlugin.d.ts +12 -0
  65. package/dist/internal/TableColumnFloorPlugin.d.ts.map +1 -0
  66. package/dist/internal/TableColumnFloorPlugin.js +84 -0
  67. package/dist/internal/TablePastePlugin.d.ts +9 -0
  68. package/dist/internal/TablePastePlugin.d.ts.map +1 -0
  69. package/dist/internal/TablePastePlugin.js +183 -0
  70. package/dist/internal/TableScrollRegionPlugin.d.ts +9 -0
  71. package/dist/internal/TableScrollRegionPlugin.d.ts.map +1 -0
  72. package/dist/internal/TableScrollRegionPlugin.js +95 -0
  73. package/dist/internal/TaskCheckboxPlugin.d.ts +7 -0
  74. package/dist/internal/TaskCheckboxPlugin.d.ts.map +1 -0
  75. package/dist/internal/TaskCheckboxPlugin.js +193 -0
  76. package/dist/internal/ToolbarLinkPopover.d.ts +74 -0
  77. package/dist/internal/ToolbarLinkPopover.d.ts.map +1 -0
  78. package/dist/internal/ToolbarLinkPopover.js +292 -0
  79. package/dist/linkEditing.d.ts +6 -0
  80. package/dist/linkEditing.d.ts.map +1 -0
  81. package/dist/linkEditing.js +20 -0
  82. package/dist/linkForm.d.ts +28 -0
  83. package/dist/linkForm.d.ts.map +1 -0
  84. package/dist/linkForm.js +137 -0
  85. package/dist/linkUtils.d.ts +27 -0
  86. package/dist/linkUtils.d.ts.map +1 -0
  87. package/dist/linkUtils.js +101 -0
  88. package/dist/markdown.d.ts +17 -0
  89. package/dist/markdown.d.ts.map +1 -0
  90. package/dist/markdown.js +17 -0
  91. package/dist/markdownCharacterReferences.d.ts +135 -0
  92. package/dist/markdownCharacterReferences.d.ts.map +1 -0
  93. package/dist/markdownCharacterReferences.js +1127 -0
  94. package/dist/markdownCodeFence.d.ts +4 -0
  95. package/dist/markdownCodeFence.d.ts.map +1 -0
  96. package/dist/markdownCodeFence.js +167 -0
  97. package/dist/markdownExtensionNode.d.ts +88 -0
  98. package/dist/markdownExtensionNode.d.ts.map +1 -0
  99. package/dist/markdownExtensionNode.js +248 -0
  100. package/dist/markdownExtensions.d.ts +115 -0
  101. package/dist/markdownExtensions.d.ts.map +1 -0
  102. package/dist/markdownExtensions.js +392 -0
  103. package/dist/markdownHardLineBreak.d.ts +25 -0
  104. package/dist/markdownHardLineBreak.d.ts.map +1 -0
  105. package/dist/markdownHardLineBreak.js +59 -0
  106. package/dist/markdownHeading.d.ts +20 -0
  107. package/dist/markdownHeading.d.ts.map +1 -0
  108. package/dist/markdownHeading.js +30 -0
  109. package/dist/markdownLink.d.ts +5 -0
  110. package/dist/markdownLink.d.ts.map +1 -0
  111. package/dist/markdownLink.js +80 -0
  112. package/dist/markdownListExport.d.ts +3 -0
  113. package/dist/markdownListExport.d.ts.map +1 -0
  114. package/dist/markdownListExport.js +68 -0
  115. package/dist/markdownListIndentation.d.ts +8 -0
  116. package/dist/markdownListIndentation.d.ts.map +1 -0
  117. package/dist/markdownListIndentation.js +101 -0
  118. package/dist/markdownOrderedList.d.ts +3 -0
  119. package/dist/markdownOrderedList.d.ts.map +1 -0
  120. package/dist/markdownOrderedList.js +51 -0
  121. package/dist/markdownQuote.d.ts +22 -0
  122. package/dist/markdownQuote.d.ts.map +1 -0
  123. package/dist/markdownQuote.js +32 -0
  124. package/dist/markdownSerializers.d.ts +49 -0
  125. package/dist/markdownSerializers.d.ts.map +1 -0
  126. package/dist/markdownSerializers.js +83 -0
  127. package/dist/markdownSource.d.ts +71 -0
  128. package/dist/markdownSource.d.ts.map +1 -0
  129. package/dist/markdownSource.js +804 -0
  130. package/dist/markdownSpaceRuns.d.ts +24 -0
  131. package/dist/markdownSpaceRuns.d.ts.map +1 -0
  132. package/dist/markdownSpaceRuns.js +147 -0
  133. package/dist/markdownTable.d.ts +35 -0
  134. package/dist/markdownTable.d.ts.map +1 -0
  135. package/dist/markdownTable.js +227 -0
  136. package/dist/markdownTaskList.d.ts +48 -0
  137. package/dist/markdownTaskList.d.ts.map +1 -0
  138. package/dist/markdownTaskList.js +166 -0
  139. package/dist/markdownThematicBreak.d.ts +3 -0
  140. package/dist/markdownThematicBreak.d.ts.map +1 -0
  141. package/dist/markdownThematicBreak.js +55 -0
  142. package/dist/privateAttributes/layerPortalBoundary.stylex.d.ts +12 -0
  143. package/dist/privateAttributes/layerPortalBoundary.stylex.d.ts.map +1 -0
  144. package/dist/privateAttributes/layerPortalBoundary.stylex.js +16 -0
  145. package/dist/richtext.css +213 -0
  146. package/dist/textSemantics.d.ts +3 -0
  147. package/dist/textSemantics.d.ts.map +1 -0
  148. package/dist/textSemantics.js +87 -0
  149. package/package.json +158 -3
  150. package/src/RichTextEditor.doc.mjs +308 -0
  151. package/src/RichTextEditor.tsx +1109 -0
  152. package/src/RichTextEditorAutoLinkPlugin.doc.mjs +43 -0
  153. package/src/RichTextEditorAutoLinkPlugin.tsx +126 -0
  154. package/src/RichTextEditorToolbar.doc.mjs +92 -0
  155. package/src/RichTextEditorToolbar.tsx +871 -0
  156. package/src/RichTextView.doc.mjs +101 -0
  157. package/src/RichTextView.tsx +351 -0
  158. package/src/codeLanguages.ts +42 -0
  159. package/src/codeLineTokens.ts +241 -0
  160. package/src/doc-mjs.d.ts +23 -0
  161. package/src/editorNodes.ts +44 -0
  162. package/src/editorTheme.ts +550 -0
  163. package/src/index.ts +59 -0
  164. package/src/internal/CodeBackspacePlugin.tsx +96 -0
  165. package/src/internal/CodeBlockHeaderPlugin.tsx +282 -0
  166. package/src/internal/CodePastePlugin.tsx +144 -0
  167. package/src/internal/CodeSyntaxPlugin.tsx +493 -0
  168. package/src/internal/CodeTabPlugin.tsx +298 -0
  169. package/src/internal/DisabledLinkGuardPlugin.tsx +93 -0
  170. package/src/internal/ImageSourceCaretPlugin.tsx +159 -0
  171. package/src/internal/ListItemShortcutsPlugin.tsx +404 -0
  172. package/src/internal/MarkdownExtensionsPlugin.tsx +289 -0
  173. package/src/internal/SelectAllScopePlugin.tsx +86 -0
  174. package/src/internal/TableColumnFloorPlugin.tsx +99 -0
  175. package/src/internal/TablePastePlugin.tsx +223 -0
  176. package/src/internal/TableScrollRegionPlugin.tsx +107 -0
  177. package/src/internal/TaskCheckboxPlugin.tsx +246 -0
  178. package/src/internal/ToolbarLinkPopover.tsx +392 -0
  179. package/src/linkEditing.ts +20 -0
  180. package/src/linkForm.tsx +156 -0
  181. package/src/linkUtils.ts +106 -0
  182. package/src/markdown.ts +25 -0
  183. package/src/markdownCharacterReferences.ts +1137 -0
  184. package/src/markdownCodeFence.ts +216 -0
  185. package/src/markdownExtensionNode.ts +339 -0
  186. package/src/markdownExtensions.ts +496 -0
  187. package/src/markdownHardLineBreak.ts +73 -0
  188. package/src/markdownHeading.ts +33 -0
  189. package/src/markdownLink.ts +86 -0
  190. package/src/markdownListExport.ts +85 -0
  191. package/src/markdownListIndentation.ts +105 -0
  192. package/src/markdownOrderedList.ts +60 -0
  193. package/src/markdownQuote.ts +35 -0
  194. package/src/markdownSerializers.ts +108 -0
  195. package/src/markdownSource.ts +1045 -0
  196. package/src/markdownSpaceRuns.ts +164 -0
  197. package/src/markdownTable.ts +309 -0
  198. package/src/markdownTaskList.ts +222 -0
  199. package/src/markdownThematicBreak.ts +66 -0
  200. package/src/privateAttributes/layerPortalBoundary.stylex.ts +18 -0
  201. package/src/textSemantics.ts +104 -0
@@ -0,0 +1,241 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file codeLineTokens.ts
5
+ * @input Core CodeBlock's tokenizer (`tokenize`) and token line type.
6
+ * @output Exports CodeLineTokens, which keeps core CodeBlock's tokens for a
7
+ * block of code line by line and re-tokenizes only the lines an edit can
8
+ * change.
9
+ * @position Used by CodeSyntaxPlugin. Its tokens always equal what `tokenize`
10
+ * returns for the whole code. An edit re-tokenizes only its own line, and
11
+ * at most the line above it, for the built-in TypeScript, JavaScript,
12
+ * Python, and shell grammars while every line passes `standsAlone`;
13
+ * anything else re-tokenizes all of it. The checks follow those grammars'
14
+ * patterns in core CodeBlock's tokenizer.ts, and codeLineTokens.test.ts
15
+ * compares edits against a full `tokenize`, so a grammar change that
16
+ * breaks them fails there.
17
+ */
18
+
19
+ import {
20
+ tokenize,
21
+ type CodeLanguage,
22
+ type TokenLine,
23
+ } from '@blue-patterns/core/CodeBlock';
24
+
25
+ type Family = 'javascript' | 'python' | 'shell';
26
+
27
+ const FAMILIES: ReadonlyMap<string, Family> = new Map([
28
+ ['typescript', 'javascript'],
29
+ ['javascript', 'javascript'],
30
+ ['tsx', 'javascript'],
31
+ ['jsx', 'javascript'],
32
+ ['ts', 'javascript'],
33
+ ['js', 'javascript'],
34
+ ['python', 'python'],
35
+ ['py', 'python'],
36
+ ['bash', 'shell'],
37
+ ['sh', 'shell'],
38
+ ['zsh', 'shell'],
39
+ ['shell', 'shell'],
40
+ ]);
41
+
42
+ /** What can open a string or comment that runs on past its line. */
43
+ const OPENERS: Readonly<Record<Family, RegExp>> = {
44
+ javascript: /['"`]|\/\*/,
45
+ python: /['"]/,
46
+ shell: /['"`]|\$\{|\$\(|<</,
47
+ };
48
+
49
+ /** A line whose last visible character can end a function name. */
50
+ const NAME_END = /[\w$]\s*$/;
51
+
52
+ /**
53
+ * Whether the name that ends a line can change color with the code after
54
+ * it: its last visible character is a name character outside every string,
55
+ * comment, number, keyword, and constant, whose patterns come before
56
+ * function names.
57
+ */
58
+ function endsInOpenName(text: string, tokens: TokenLine): boolean {
59
+ const last = text.trimEnd().length - 1;
60
+ return (
61
+ NAME_END.test(text) &&
62
+ !tokens.some(
63
+ token =>
64
+ token.start <= last &&
65
+ token.end > last &&
66
+ token.type !== 'function' &&
67
+ token.type !== 'type',
68
+ )
69
+ );
70
+ }
71
+
72
+ /** A line's first visible character, or '' when it has none. */
73
+ function firstVisible(line: string): string {
74
+ return /\S/.exec(line)?.[0] ?? '';
75
+ }
76
+
77
+ /**
78
+ * Whether a line's strings and comments all close on it. Their patterns
79
+ * match line breaks, so an opener left open can run on to a later line.
80
+ * Only a string or comment the tokenizer emitted shields an opener: one that
81
+ * another token swallowed, such as `/*` in the operator `+/*`, still counts
82
+ * as open. Python tries triple quotes first, so `"""` can pair with another
83
+ * line even where its quotes close as single strings on this one.
84
+ */
85
+ function standsAlone(text: string, tokens: TokenLine, family: Family): boolean {
86
+ if (family === 'python' && /'''|"""/.test(text)) {
87
+ return false;
88
+ }
89
+ const opener = OPENERS[family];
90
+ let position = 0;
91
+ for (const token of tokens) {
92
+ if (token.end > text.length) {
93
+ return false;
94
+ }
95
+ if (token.type === 'string' || token.type === 'comment') {
96
+ if (opener.test(text.slice(position, token.start))) {
97
+ return false;
98
+ }
99
+ position = token.end;
100
+ }
101
+ }
102
+ return !opener.test(text.slice(position));
103
+ }
104
+
105
+ /**
106
+ * Core CodeBlock's tokens for a block of code, kept line by line with
107
+ * line-relative offsets, exactly as `tokenize` returns them for the whole
108
+ * code.
109
+ */
110
+ export class CodeLineTokens {
111
+ readonly language: string | CodeLanguage;
112
+ /** Where each line starts in the code. */
113
+ starts: number[] = [];
114
+ /** Each line's tokens. */
115
+ tokens: TokenLine[] = [];
116
+ private lines: string[] = [];
117
+ private readonly family: Family | null;
118
+ /** Whether every line stands alone, so an edit re-tokenizes lines alone. */
119
+ private linesStandAlone = false;
120
+
121
+ constructor(text: string, language: string | CodeLanguage) {
122
+ this.language = language;
123
+ this.family =
124
+ typeof language === 'string' ? (FAMILIES.get(language) ?? null) : null;
125
+ this.tokenizeAll(text);
126
+ }
127
+
128
+ /** The code. */
129
+ get text(): string {
130
+ return this.lines.join('\n');
131
+ }
132
+
133
+ /** The line that holds `offset` in the code. */
134
+ lineAt(offset: number): number {
135
+ let low = 0;
136
+ let high = this.starts.length - 1;
137
+ while (low < high) {
138
+ const mid = (low + high + 1) >>> 1;
139
+ if (this.starts[mid] <= offset) {
140
+ low = mid;
141
+ } else {
142
+ high = mid - 1;
143
+ }
144
+ }
145
+ return low;
146
+ }
147
+
148
+ /**
149
+ * Replaces `removed` characters at `offset` in the code with `inserted`.
150
+ * Returns the lines it re-tokenized when the edit stays inside one line
151
+ * and every line still stands alone; otherwise it re-tokenizes all the
152
+ * code and returns null.
153
+ */
154
+ replace(offset: number, removed: number, inserted: string): number[] | null {
155
+ const line = this.lineAt(offset);
156
+ const before = this.lines[line];
157
+ const column = offset - this.starts[line];
158
+ if (
159
+ this.family == null ||
160
+ !this.linesStandAlone ||
161
+ column + removed > before.length ||
162
+ inserted.includes('\n')
163
+ ) {
164
+ const text = this.text;
165
+ this.tokenizeAll(
166
+ text.slice(0, offset) + inserted + text.slice(offset + removed),
167
+ );
168
+ return null;
169
+ }
170
+ const after =
171
+ before.slice(0, column) + inserted + before.slice(column + removed);
172
+ this.lines[line] = after;
173
+ const tokens = this.tokenizeLine(line);
174
+ if (!standsAlone(after, tokens, this.family)) {
175
+ this.tokenizeAll(this.text);
176
+ return null;
177
+ }
178
+ this.tokens[line] = tokens;
179
+ for (let i = line + 1; i < this.starts.length; i++) {
180
+ this.starts[i] += inserted.length - removed;
181
+ }
182
+ const changed = [line];
183
+ // A name that ends an earlier line looks past blank lines for `(`, so a
184
+ // new first visible character here can change that name's color.
185
+ if (firstVisible(before) !== firstVisible(after)) {
186
+ let above = line - 1;
187
+ while (above >= 0 && firstVisible(this.lines[above]) === '') {
188
+ above--;
189
+ }
190
+ if (
191
+ above >= 0 &&
192
+ endsInOpenName(this.lines[above], this.tokens[above] ?? [])
193
+ ) {
194
+ this.tokens[above] = this.tokenizeLine(above);
195
+ changed.unshift(above);
196
+ }
197
+ }
198
+ return changed;
199
+ }
200
+
201
+ /**
202
+ * A line's tokens as `tokenize` finds them in the whole code. A function
203
+ * name is a name followed by `(` past any whitespace, line breaks
204
+ * included, so when the line ends in a name, the code up to the next
205
+ * visible character is tokenized with it.
206
+ */
207
+ private tokenizeLine(line: number): TokenLine {
208
+ let text = this.lines[line];
209
+ if (NAME_END.test(text)) {
210
+ for (let next = line + 1; next < this.lines.length; next++) {
211
+ const visible = /\S/.exec(this.lines[next]);
212
+ text +=
213
+ '\n' +
214
+ (visible == null
215
+ ? this.lines[next]
216
+ : this.lines[next].slice(0, visible.index + 1));
217
+ if (visible != null) {
218
+ break;
219
+ }
220
+ }
221
+ }
222
+ return tokenize(text, this.language)[0] ?? [];
223
+ }
224
+
225
+ private tokenizeAll(text: string): void {
226
+ this.lines = text.split('\n');
227
+ let start = 0;
228
+ this.starts = this.lines.map(line => {
229
+ const lineStart = start;
230
+ start += line.length + 1;
231
+ return lineStart;
232
+ });
233
+ this.tokens = tokenize(text, this.language);
234
+ const family = this.family;
235
+ this.linesStandAlone =
236
+ family != null &&
237
+ this.lines.every((line, i) =>
238
+ standsAlone(line, this.tokens[i] ?? [], family),
239
+ );
240
+ }
241
+ }
@@ -0,0 +1,23 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Ambient module declaration for `*.doc.mjs` imports.
5
+ *
6
+ * Package tests import `{Name}.doc.mjs` files directly to assert that their
7
+ * documented metadata stays in sync with what the component renders (see the
8
+ * theme-target test in RichTextEditor.test.tsx). Without this declaration,
9
+ * TypeScript has no way to type a `.mjs` import and the package typecheck
10
+ * fails with TS7016 ("Could not find a declaration file for module").
11
+ * Mirrors packages/core/src/doc-mjs.d.ts, which this package cannot see.
12
+ */
13
+
14
+ declare module '*.doc.mjs' {
15
+ import type {
16
+ ComponentDoc,
17
+ ComponentTranslationDoc,
18
+ } from '@blue-patterns/cli/authoring';
19
+
20
+ export const docs: ComponentDoc;
21
+ export const docsZh: ComponentDoc;
22
+ export const docsDense: ComponentTranslationDoc;
23
+ }
@@ -0,0 +1,44 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file editorNodes.ts
5
+ * @input Imports the default Lexical node classes registered by the editor.
6
+ * @output Exports DEFAULT_NODES — the base OSS node set.
7
+ * @position Shared by RichTextEditor.tsx (editor config) and
8
+ * markdownSerializers.ts (headless conversion), so both register the same
9
+ * nodes and Markdown round-trips consistently.
10
+ *
11
+ * SYNC: When the default node set changes, both consumers pick it up here.
12
+ */
13
+
14
+ import {ListNode, ListItemNode} from '@lexical/list';
15
+ import {HeadingNode, QuoteNode} from '@lexical/rich-text';
16
+ import {LinkNode, AutoLinkNode} from '@lexical/link';
17
+ import {CodeNode, CodeHighlightNode} from '@lexical/code';
18
+ import {TableNode, TableRowNode, TableCellNode} from '@lexical/table';
19
+ import {HorizontalRuleNode} from '@lexical/extension';
20
+ import type {Klass, LexicalNode} from 'lexical';
21
+ import {RichTextExtensionNode} from './markdownExtensionNode';
22
+
23
+ /**
24
+ * The default OSS node set registered with the editor: headings, quotes,
25
+ * lists, links, code, and tables. Extend via the `nodes` prop / option rather
26
+ * than editing this list.
27
+ */
28
+ export const DEFAULT_NODES: ReadonlyArray<Klass<LexicalNode>> = [
29
+ HeadingNode,
30
+ QuoteNode,
31
+ ListNode,
32
+ ListItemNode,
33
+ LinkNode,
34
+ AutoLinkNode,
35
+ CodeNode,
36
+ CodeHighlightNode,
37
+ TableNode,
38
+ TableRowNode,
39
+ TableCellNode,
40
+ HorizontalRuleNode,
41
+ // Markdown plugin nodes (spec:AST-064): registered everywhere so stored
42
+ // state that holds them always loads.
43
+ RichTextExtensionNode,
44
+ ];