@payloadcms/richtext-lexical 4.0.0-canary.2 → 4.0.0-internal.011fd46

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 (150) hide show
  1. package/dist/exports/client/Field-VQX3RNMF.js +2 -0
  2. package/dist/exports/client/{Field-G5Z2HM5Y.js.map → Field-VQX3RNMF.js.map} +3 -3
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-X3D4LZS7.js +2 -0
  5. package/dist/exports/client/chunk-X3D4LZS7.js.map +7 -0
  6. package/dist/exports/client/index.js +22 -20
  7. package/dist/exports/client/index.js.map +4 -4
  8. package/dist/features/blockquote/markdownTransformer.d.ts +1 -1
  9. package/dist/features/blockquote/markdownTransformer.d.ts.map +1 -1
  10. package/dist/features/blockquote/markdownTransformer.js.map +1 -1
  11. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  12. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  13. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  14. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  15. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  16. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  17. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +1 -1
  18. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  19. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  20. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  21. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  22. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  23. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  24. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  25. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  26. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  27. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  28. package/dist/features/converters/markdownToLexical/index.js +1 -1
  29. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  30. package/dist/features/experimental_table/markdownTransformer.d.ts +1 -1
  31. package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -1
  32. package/dist/features/experimental_table/markdownTransformer.js +1 -1
  33. package/dist/features/experimental_table/markdownTransformer.js.map +1 -1
  34. package/dist/features/format/bold/markdownTransformers.d.ts +1 -1
  35. package/dist/features/format/bold/markdownTransformers.d.ts.map +1 -1
  36. package/dist/features/format/bold/markdownTransformers.js.map +1 -1
  37. package/dist/features/format/inlineCode/markdownTransformers.d.ts +1 -1
  38. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +1 -1
  39. package/dist/features/format/inlineCode/markdownTransformers.js.map +1 -1
  40. package/dist/features/format/italic/markdownTransformers.d.ts +1 -1
  41. package/dist/features/format/italic/markdownTransformers.d.ts.map +1 -1
  42. package/dist/features/format/italic/markdownTransformers.js.map +1 -1
  43. package/dist/features/format/strikethrough/markdownTransformers.d.ts +1 -1
  44. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +1 -1
  45. package/dist/features/format/strikethrough/markdownTransformers.js.map +1 -1
  46. package/dist/features/heading/markdownTransformer.d.ts +1 -1
  47. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  48. package/dist/features/heading/markdownTransformer.js.map +1 -1
  49. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +1 -1
  50. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  51. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  52. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +1 -1
  53. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  54. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  55. package/dist/features/link/markdownTransformer.d.ts +1 -1
  56. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  57. package/dist/features/link/markdownTransformer.js.map +1 -1
  58. package/dist/features/link/markdownTransformer.spec.js +1 -1
  59. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  60. package/dist/features/lists/checklist/markdownTransformers.d.ts +1 -1
  61. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +1 -1
  62. package/dist/features/lists/checklist/markdownTransformers.js.map +1 -1
  63. package/dist/features/lists/orderedList/markdownTransformer.d.ts +1 -1
  64. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +1 -1
  65. package/dist/features/lists/orderedList/markdownTransformer.js.map +1 -1
  66. package/dist/features/lists/shared/markdown.d.ts +1 -1
  67. package/dist/features/lists/shared/markdown.d.ts.map +1 -1
  68. package/dist/features/lists/shared/markdown.js.map +1 -1
  69. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +1 -1
  70. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +1 -1
  71. package/dist/features/lists/unorderedList/markdownTransformer.js.map +1 -1
  72. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  73. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  74. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  75. package/dist/features/typesClient.d.ts +1 -1
  76. package/dist/features/typesClient.d.ts.map +1 -1
  77. package/dist/features/typesClient.js.map +1 -1
  78. package/dist/features/typesServer.d.ts +1 -1
  79. package/dist/features/typesServer.d.ts.map +1 -1
  80. package/dist/features/typesServer.js.map +1 -1
  81. package/dist/features/upload/server/markdownTransformer.d.ts +1 -1
  82. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  83. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  84. package/dist/field/bundled.css +1 -1
  85. package/dist/field/index.css +3 -4
  86. package/dist/index.d.ts +2 -2
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +2 -2
  89. package/dist/index.js.map +1 -1
  90. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  91. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  92. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  93. package/dist/lexical/utils/markdown/createBlockNode.d.ts +1 -1
  94. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  95. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  96. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +28 -0
  97. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  98. package/dist/lexical/utils/markdown/normalizeMarkdown.js +95 -0
  99. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  100. package/dist/lexical-proxy/@lexical-markdown.d.ts +40 -1
  101. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  102. package/dist/lexical-proxy/@lexical-markdown.js +56 -1
  103. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  104. package/dist/lexical-proxy/@lexical-markdown.spec.js +89 -0
  105. package/dist/lexical-proxy/@lexical-markdown.spec.js.map +1 -0
  106. package/dist/utilities/fieldsDrawer/index.css +0 -4
  107. package/package.json +21 -25
  108. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  109. package/dist/exports/client/chunk-LH634DPU.js +0 -12
  110. package/dist/exports/client/chunk-LH634DPU.js.map +0 -7
  111. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  112. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  113. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  114. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  115. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  116. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  117. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -213
  118. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  119. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  120. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  121. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -198
  122. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  123. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  124. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  125. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  126. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  127. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -147
  128. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  129. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -268
  130. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  131. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  132. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  133. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  134. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  135. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  136. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  137. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  138. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  139. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  140. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  141. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  142. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  143. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  144. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  145. package/dist/packages/@lexical/markdown/index.js +0 -39
  146. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  147. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  148. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  149. package/dist/packages/@lexical/markdown/utils.js +0 -267
  150. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
@@ -1,304 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */import { $createRangeSelection, $getSelection, $isLineBreakNode, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, $setSelection } from 'lexical';
8
- import { TRANSFORMERS } from './index.js';
9
- import { indexBy, PUNCTUATION_OR_SPACE, transformersByType } from './utils.js';
10
- function runElementTransformers(parentNode, anchorNode, anchorOffset, elementTransformers) {
11
- const grandParentNode = parentNode.getParent();
12
- if (!$isRootOrShadowRoot(grandParentNode) || parentNode.getFirstChild() !== anchorNode) {
13
- return false;
14
- }
15
- const textContent = anchorNode.getTextContent();
16
- // Checking for anchorOffset position to prevent any checks for cases when caret is too far
17
- // from a line start to be a part of block-level markdown trigger.
18
- //
19
- // TODO:
20
- // Can have a quick check if caret is close enough to the beginning of the string (e.g. offset less than 10-20)
21
- // since otherwise it won't be a markdown shortcut, but tables are exception
22
- if (textContent[anchorOffset - 1] !== ' ') {
23
- return false;
24
- }
25
- for (const {
26
- regExp,
27
- replace
28
- } of elementTransformers) {
29
- const match = textContent.match(regExp);
30
- if (match && match[0].length === (match[0].endsWith(' ') ? anchorOffset : anchorOffset - 1)) {
31
- const nextSiblings = anchorNode.getNextSiblings();
32
- const [leadingNode, remainderNode] = anchorNode.splitText(anchorOffset);
33
- leadingNode?.remove();
34
- const siblings = remainderNode ? [remainderNode, ...nextSiblings] : nextSiblings;
35
- if (replace(parentNode, siblings, match, false) !== false) {
36
- return true;
37
- }
38
- }
39
- }
40
- return false;
41
- }
42
- function runMultilineElementTransformers(parentNode, anchorNode, anchorOffset, elementTransformers) {
43
- const grandParentNode = parentNode.getParent();
44
- if (!$isRootOrShadowRoot(grandParentNode) || parentNode.getFirstChild() !== anchorNode) {
45
- return false;
46
- }
47
- const textContent = anchorNode.getTextContent();
48
- // Checking for anchorOffset position to prevent any checks for cases when caret is too far
49
- // from a line start to be a part of block-level markdown trigger.
50
- //
51
- // TODO:
52
- // Can have a quick check if caret is close enough to the beginning of the string (e.g. offset less than 10-20)
53
- // since otherwise it won't be a markdown shortcut, but tables are exception
54
- if (textContent[anchorOffset - 1] !== ' ') {
55
- return false;
56
- }
57
- for (const {
58
- regExpEnd,
59
- regExpStart,
60
- replace
61
- } of elementTransformers) {
62
- if (regExpEnd && !('optional' in regExpEnd) || regExpEnd && 'optional' in regExpEnd && !regExpEnd.optional) {
63
- continue;
64
- }
65
- const match = textContent.match(regExpStart);
66
- if (match && match[0].length === (match[0].endsWith(' ') ? anchorOffset : anchorOffset - 1)) {
67
- const nextSiblings = anchorNode.getNextSiblings();
68
- const [leadingNode, remainderNode] = anchorNode.splitText(anchorOffset);
69
- leadingNode?.remove();
70
- const siblings = remainderNode ? [remainderNode, ...nextSiblings] : nextSiblings;
71
- if (replace(parentNode, siblings, match, null, null, false) !== false) {
72
- return true;
73
- }
74
- }
75
- }
76
- return false;
77
- }
78
- function runTextMatchTransformers(anchorNode, anchorOffset, transformersByTrigger) {
79
- let textContent = anchorNode.getTextContent();
80
- const lastChar = textContent[anchorOffset - 1];
81
- const transformers = transformersByTrigger[lastChar];
82
- if (transformers == null) {
83
- return false;
84
- }
85
- // If typing in the middle of content, remove the tail to do
86
- // reg exp match up to a string end (caret position)
87
- if (anchorOffset < textContent.length) {
88
- textContent = textContent.slice(0, anchorOffset);
89
- }
90
- for (const transformer of transformers) {
91
- if (!transformer.replace || !transformer.regExp) {
92
- continue;
93
- }
94
- const match = textContent.match(transformer.regExp);
95
- if (match === null) {
96
- continue;
97
- }
98
- const startIndex = match.index || 0;
99
- const endIndex = startIndex + match[0].length;
100
- let replaceNode;
101
- if (startIndex === 0) {
102
- [replaceNode] = anchorNode.splitText(endIndex);
103
- } else {
104
- [, replaceNode] = anchorNode.splitText(startIndex, endIndex);
105
- }
106
- if (replaceNode) {
107
- replaceNode.selectNext(0, 0);
108
- transformer.replace(replaceNode, match);
109
- }
110
- return true;
111
- }
112
- return false;
113
- }
114
- function $runTextFormatTransformers(anchorNode, anchorOffset, textFormatTransformers) {
115
- const textContent = anchorNode.getTextContent();
116
- const closeTagEndIndex = anchorOffset - 1;
117
- const closeChar = textContent[closeTagEndIndex];
118
- // Quick check if we're possibly at the end of inline markdown style
119
- const matchers = textFormatTransformers[closeChar];
120
- if (!matchers) {
121
- return false;
122
- }
123
- for (const matcher of matchers) {
124
- const {
125
- tag
126
- } = matcher;
127
- const tagLength = tag.length;
128
- const closeTagStartIndex = closeTagEndIndex - tagLength + 1;
129
- // If tag is not single char check if rest of it matches with text content
130
- if (tagLength > 1) {
131
- if (!isEqualSubString(textContent, closeTagStartIndex, tag, 0, tagLength)) {
132
- continue;
133
- }
134
- }
135
- // Space before closing tag cancels inline markdown
136
- if (textContent[closeTagStartIndex - 1] === ' ') {
137
- continue;
138
- }
139
- // Some tags can not be used within words, hence should have newline/space/punctuation after it
140
- const afterCloseTagChar = textContent[closeTagEndIndex + 1];
141
- if (matcher.intraword === false && afterCloseTagChar && !PUNCTUATION_OR_SPACE.test(afterCloseTagChar)) {
142
- continue;
143
- }
144
- const closeNode = anchorNode;
145
- let openNode = closeNode;
146
- let openTagStartIndex = getOpenTagStartIndex(textContent, closeTagStartIndex, tag);
147
- // Go through text node siblings and search for opening tag
148
- // if haven't found it within the same text node as closing tag
149
- let sibling = openNode;
150
- while (openTagStartIndex < 0 && (sibling = sibling.getPreviousSibling())) {
151
- if ($isLineBreakNode(sibling)) {
152
- break;
153
- }
154
- if ($isTextNode(sibling)) {
155
- const siblingTextContent = sibling.getTextContent();
156
- openNode = sibling;
157
- openTagStartIndex = getOpenTagStartIndex(siblingTextContent, siblingTextContent.length, tag);
158
- }
159
- }
160
- // Opening tag is not found
161
- if (openTagStartIndex < 0) {
162
- continue;
163
- }
164
- // No content between opening and closing tag
165
- if (openNode === closeNode && openTagStartIndex + tagLength === closeTagStartIndex) {
166
- continue;
167
- }
168
- // Checking longer tags for repeating chars (e.g. *** vs **)
169
- const prevOpenNodeText = openNode.getTextContent();
170
- if (openTagStartIndex > 0 && prevOpenNodeText[openTagStartIndex - 1] === closeChar) {
171
- continue;
172
- }
173
- // Some tags can not be used within words, hence should have newline/space/punctuation before it
174
- const beforeOpenTagChar = prevOpenNodeText[openTagStartIndex - 1];
175
- if (matcher.intraword === false && beforeOpenTagChar && !PUNCTUATION_OR_SPACE.test(beforeOpenTagChar)) {
176
- continue;
177
- }
178
- // Clean text from opening and closing tags (starting from closing tag
179
- // to prevent any offset shifts if we start from opening one)
180
- const prevCloseNodeText = closeNode.getTextContent();
181
- const closeNodeText = prevCloseNodeText.slice(0, closeTagStartIndex) + prevCloseNodeText.slice(closeTagEndIndex + 1);
182
- closeNode.setTextContent(closeNodeText);
183
- const openNodeText = openNode === closeNode ? closeNodeText : prevOpenNodeText;
184
- openNode.setTextContent(openNodeText.slice(0, openTagStartIndex) + openNodeText.slice(openTagStartIndex + tagLength));
185
- const selection = $getSelection();
186
- const nextSelection = $createRangeSelection();
187
- $setSelection(nextSelection);
188
- // Adjust offset based on deleted chars
189
- const newOffset = closeTagEndIndex - tagLength * (openNode === closeNode ? 2 : 1) + 1;
190
- nextSelection.anchor.set(openNode.__key, openTagStartIndex, 'text');
191
- nextSelection.focus.set(closeNode.__key, newOffset, 'text');
192
- // Apply formatting to selected text
193
- for (const format of matcher.format) {
194
- if (!nextSelection.hasFormat(format)) {
195
- nextSelection.formatText(format);
196
- }
197
- }
198
- // Collapse selection up to the focus point
199
- nextSelection.anchor.set(nextSelection.focus.key, nextSelection.focus.offset, nextSelection.focus.type);
200
- // Remove formatting from collapsed selection
201
- for (const format of matcher.format) {
202
- if (nextSelection.hasFormat(format)) {
203
- nextSelection.toggleFormat(format);
204
- }
205
- }
206
- if ($isRangeSelection(selection)) {
207
- nextSelection.format = selection.format;
208
- }
209
- return true;
210
- }
211
- return false;
212
- }
213
- function getOpenTagStartIndex(string, maxIndex, tag) {
214
- const tagLength = tag.length;
215
- for (let i = maxIndex; i >= tagLength; i--) {
216
- const startIndex = i - tagLength;
217
- if (isEqualSubString(string, startIndex, tag, 0, tagLength) &&
218
- // Space after opening tag cancels transformation
219
- string[startIndex + tagLength] !== ' ') {
220
- return startIndex;
221
- }
222
- }
223
- return -1;
224
- }
225
- function isEqualSubString(stringA, aStart, stringB, bStart, length) {
226
- for (let i = 0; i < length; i++) {
227
- if (stringA[aStart + i] !== stringB[bStart + i]) {
228
- return false;
229
- }
230
- }
231
- return true;
232
- }
233
- export function registerMarkdownShortcuts(editor, transformers = TRANSFORMERS) {
234
- const byType = transformersByType(transformers);
235
- const textFormatTransformersByTrigger = indexBy(byType.textFormat, ({
236
- tag
237
- }) => tag[tag.length - 1]);
238
- const textMatchTransformersByTrigger = indexBy(byType.textMatch, ({
239
- trigger
240
- }) => trigger);
241
- for (const transformer of transformers) {
242
- const type = transformer.type;
243
- if (type === 'element' || type === 'text-match' || type === 'multiline-element') {
244
- const dependencies = transformer.dependencies;
245
- for (const node of dependencies) {
246
- if (!editor.hasNode(node)) {
247
- throw new Error('MarkdownShortcuts: missing dependency %s for transformer. Ensure node dependency is included in editor initial config.' + node.getType());
248
- }
249
- }
250
- }
251
- }
252
- const $transform = (parentNode, anchorNode, anchorOffset) => {
253
- if (runElementTransformers(parentNode, anchorNode, anchorOffset, byType.element)) {
254
- return;
255
- }
256
- if (runMultilineElementTransformers(parentNode, anchorNode, anchorOffset, byType.multilineElement)) {
257
- return;
258
- }
259
- if (runTextMatchTransformers(anchorNode, anchorOffset, textMatchTransformersByTrigger)) {
260
- return;
261
- }
262
- $runTextFormatTransformers(anchorNode, anchorOffset, textFormatTransformersByTrigger);
263
- };
264
- return editor.registerUpdateListener(({
265
- dirtyLeaves,
266
- editorState,
267
- prevEditorState,
268
- tags
269
- }) => {
270
- // Ignore updates from collaboration and undo/redo (as changes already calculated)
271
- if (tags.has('collaboration') || tags.has('historic')) {
272
- return;
273
- }
274
- // If editor is still composing (i.e. backticks) we must wait before the user confirms the key
275
- if (editor.isComposing()) {
276
- return;
277
- }
278
- const selection = editorState.read($getSelection);
279
- const prevSelection = prevEditorState.read($getSelection);
280
- // We expect selection to be a collapsed range and not match previous one (as we want
281
- // to trigger transforms only as user types)
282
- if (!$isRangeSelection(prevSelection) || !$isRangeSelection(selection) || !selection.isCollapsed() || selection.is(prevSelection)) {
283
- return;
284
- }
285
- const anchorKey = selection.anchor.key;
286
- const anchorOffset = selection.anchor.offset;
287
- const anchorNode = editorState._nodeMap.get(anchorKey);
288
- if (!$isTextNode(anchorNode) || !dirtyLeaves.has(anchorKey) || anchorOffset !== 1 && anchorOffset > prevSelection.anchor.offset + 1) {
289
- return;
290
- }
291
- editor.update(() => {
292
- // Markdown is not available inside code
293
- if (anchorNode.hasFormat('code')) {
294
- return;
295
- }
296
- const parentNode = anchorNode.getParent();
297
- if (parentNode === null) {
298
- return;
299
- }
300
- $transform(parentNode, anchorNode, selection.anchor.offset);
301
- });
302
- });
303
- }
304
- //# sourceMappingURL=MarkdownShortcuts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkdownShortcuts.js","names":["$createRangeSelection","$getSelection","$isLineBreakNode","$isRangeSelection","$isRootOrShadowRoot","$isTextNode","$setSelection","TRANSFORMERS","indexBy","PUNCTUATION_OR_SPACE","transformersByType","runElementTransformers","parentNode","anchorNode","anchorOffset","elementTransformers","grandParentNode","getParent","getFirstChild","textContent","getTextContent","regExp","replace","match","length","endsWith","nextSiblings","getNextSiblings","leadingNode","remainderNode","splitText","remove","siblings","runMultilineElementTransformers","regExpEnd","regExpStart","optional","runTextMatchTransformers","transformersByTrigger","lastChar","transformers","slice","transformer","startIndex","index","endIndex","replaceNode","selectNext","$runTextFormatTransformers","textFormatTransformers","closeTagEndIndex","closeChar","matchers","matcher","tag","tagLength","closeTagStartIndex","isEqualSubString","afterCloseTagChar","intraword","test","closeNode","openNode","openTagStartIndex","getOpenTagStartIndex","sibling","getPreviousSibling","siblingTextContent","prevOpenNodeText","beforeOpenTagChar","prevCloseNodeText","closeNodeText","setTextContent","openNodeText","selection","nextSelection","newOffset","anchor","set","__key","focus","format","hasFormat","formatText","key","offset","type","toggleFormat","string","maxIndex","i","stringA","aStart","stringB","bStart","registerMarkdownShortcuts","editor","byType","textFormatTransformersByTrigger","textFormat","textMatchTransformersByTrigger","textMatch","trigger","dependencies","node","hasNode","Error","getType","$transform","element","multilineElement","registerUpdateListener","dirtyLeaves","editorState","prevEditorState","tags","has","isComposing","read","prevSelection","isCollapsed","is","anchorKey","_nodeMap","get","update"],"sources":["../../../../src/packages/@lexical/markdown/MarkdownShortcuts.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { ElementNode, LexicalEditor, TextNode } from 'lexical'\n\nimport {\n $createRangeSelection,\n $getSelection,\n $isLineBreakNode,\n $isRangeSelection,\n $isRootOrShadowRoot,\n $isTextNode,\n $setSelection,\n} from 'lexical'\n\nimport type {\n ElementTransformer,\n MultilineElementTransformer,\n TextFormatTransformer,\n TextMatchTransformer,\n Transformer,\n} from './MarkdownTransformers.js'\n\nimport { TRANSFORMERS } from './index.js'\nimport { indexBy, PUNCTUATION_OR_SPACE, transformersByType } from './utils.js'\n\nfunction runElementTransformers(\n parentNode: ElementNode,\n anchorNode: TextNode,\n anchorOffset: number,\n elementTransformers: ReadonlyArray<ElementTransformer>,\n): boolean {\n const grandParentNode = parentNode.getParent()\n\n if (!$isRootOrShadowRoot(grandParentNode) || parentNode.getFirstChild() !== anchorNode) {\n return false\n }\n\n const textContent = anchorNode.getTextContent()\n\n // Checking for anchorOffset position to prevent any checks for cases when caret is too far\n // from a line start to be a part of block-level markdown trigger.\n //\n // TODO:\n // Can have a quick check if caret is close enough to the beginning of the string (e.g. offset less than 10-20)\n // since otherwise it won't be a markdown shortcut, but tables are exception\n if (textContent[anchorOffset - 1] !== ' ') {\n return false\n }\n\n for (const { regExp, replace } of elementTransformers) {\n const match = textContent.match(regExp)\n\n if (match && match[0].length === (match[0].endsWith(' ') ? anchorOffset : anchorOffset - 1)) {\n const nextSiblings = anchorNode.getNextSiblings()\n const [leadingNode, remainderNode] = anchorNode.splitText(anchorOffset)\n leadingNode?.remove()\n const siblings = remainderNode ? [remainderNode, ...nextSiblings] : nextSiblings\n if (replace(parentNode, siblings, match, false) !== false) {\n return true\n }\n }\n }\n\n return false\n}\n\nfunction runMultilineElementTransformers(\n parentNode: ElementNode,\n anchorNode: TextNode,\n anchorOffset: number,\n elementTransformers: ReadonlyArray<MultilineElementTransformer>,\n): boolean {\n const grandParentNode = parentNode.getParent()\n\n if (!$isRootOrShadowRoot(grandParentNode) || parentNode.getFirstChild() !== anchorNode) {\n return false\n }\n\n const textContent = anchorNode.getTextContent()\n\n // Checking for anchorOffset position to prevent any checks for cases when caret is too far\n // from a line start to be a part of block-level markdown trigger.\n //\n // TODO:\n // Can have a quick check if caret is close enough to the beginning of the string (e.g. offset less than 10-20)\n // since otherwise it won't be a markdown shortcut, but tables are exception\n if (textContent[anchorOffset - 1] !== ' ') {\n return false\n }\n\n for (const { regExpEnd, regExpStart, replace } of elementTransformers) {\n if (\n (regExpEnd && !('optional' in regExpEnd)) ||\n (regExpEnd && 'optional' in regExpEnd && !regExpEnd.optional)\n ) {\n continue\n }\n\n const match = textContent.match(regExpStart)\n\n if (match && match[0].length === (match[0].endsWith(' ') ? anchorOffset : anchorOffset - 1)) {\n const nextSiblings = anchorNode.getNextSiblings()\n const [leadingNode, remainderNode] = anchorNode.splitText(anchorOffset)\n leadingNode?.remove()\n const siblings = remainderNode ? [remainderNode, ...nextSiblings] : nextSiblings\n\n if (replace(parentNode, siblings, match, null, null, false) !== false) {\n return true\n }\n }\n }\n\n return false\n}\n\nfunction runTextMatchTransformers(\n anchorNode: TextNode,\n anchorOffset: number,\n transformersByTrigger: Readonly<Record<string, Array<TextMatchTransformer>>>,\n): boolean {\n let textContent = anchorNode.getTextContent()\n const lastChar = textContent[anchorOffset - 1]!\n const transformers = transformersByTrigger[lastChar]\n\n if (transformers == null) {\n return false\n }\n\n // If typing in the middle of content, remove the tail to do\n // reg exp match up to a string end (caret position)\n if (anchorOffset < textContent.length) {\n textContent = textContent.slice(0, anchorOffset)\n }\n\n for (const transformer of transformers) {\n if (!transformer.replace || !transformer.regExp) {\n continue\n }\n const match = textContent.match(transformer.regExp)\n\n if (match === null) {\n continue\n }\n\n const startIndex = match.index || 0\n const endIndex = startIndex + match[0].length\n let replaceNode\n\n if (startIndex === 0) {\n ;[replaceNode] = anchorNode.splitText(endIndex)\n } else {\n ;[, replaceNode] = anchorNode.splitText(startIndex, endIndex)\n }\n if (replaceNode) {\n replaceNode.selectNext(0, 0)\n transformer.replace(replaceNode, match)\n }\n return true\n }\n\n return false\n}\n\nfunction $runTextFormatTransformers(\n anchorNode: TextNode,\n anchorOffset: number,\n textFormatTransformers: Readonly<Record<string, ReadonlyArray<TextFormatTransformer>>>,\n): boolean {\n const textContent = anchorNode.getTextContent()\n const closeTagEndIndex = anchorOffset - 1\n const closeChar = textContent[closeTagEndIndex]!\n // Quick check if we're possibly at the end of inline markdown style\n const matchers = textFormatTransformers[closeChar]\n\n if (!matchers) {\n return false\n }\n\n for (const matcher of matchers) {\n const { tag } = matcher\n const tagLength = tag.length\n const closeTagStartIndex = closeTagEndIndex - tagLength + 1\n\n // If tag is not single char check if rest of it matches with text content\n if (tagLength > 1) {\n if (!isEqualSubString(textContent, closeTagStartIndex, tag, 0, tagLength)) {\n continue\n }\n }\n\n // Space before closing tag cancels inline markdown\n if (textContent[closeTagStartIndex - 1] === ' ') {\n continue\n }\n\n // Some tags can not be used within words, hence should have newline/space/punctuation after it\n const afterCloseTagChar = textContent[closeTagEndIndex + 1]\n\n if (\n matcher.intraword === false &&\n afterCloseTagChar &&\n !PUNCTUATION_OR_SPACE.test(afterCloseTagChar)\n ) {\n continue\n }\n\n const closeNode = anchorNode\n let openNode = closeNode\n let openTagStartIndex = getOpenTagStartIndex(textContent, closeTagStartIndex, tag)\n\n // Go through text node siblings and search for opening tag\n // if haven't found it within the same text node as closing tag\n let sibling: null | TextNode = openNode\n\n while (openTagStartIndex < 0 && (sibling = sibling.getPreviousSibling<TextNode>())) {\n if ($isLineBreakNode(sibling)) {\n break\n }\n\n if ($isTextNode(sibling)) {\n const siblingTextContent = sibling.getTextContent()\n openNode = sibling\n openTagStartIndex = getOpenTagStartIndex(siblingTextContent, siblingTextContent.length, tag)\n }\n }\n\n // Opening tag is not found\n if (openTagStartIndex < 0) {\n continue\n }\n\n // No content between opening and closing tag\n if (openNode === closeNode && openTagStartIndex + tagLength === closeTagStartIndex) {\n continue\n }\n\n // Checking longer tags for repeating chars (e.g. *** vs **)\n const prevOpenNodeText = openNode.getTextContent()\n\n if (openTagStartIndex > 0 && prevOpenNodeText[openTagStartIndex - 1] === closeChar) {\n continue\n }\n\n // Some tags can not be used within words, hence should have newline/space/punctuation before it\n const beforeOpenTagChar = prevOpenNodeText[openTagStartIndex - 1]\n\n if (\n matcher.intraword === false &&\n beforeOpenTagChar &&\n !PUNCTUATION_OR_SPACE.test(beforeOpenTagChar)\n ) {\n continue\n }\n\n // Clean text from opening and closing tags (starting from closing tag\n // to prevent any offset shifts if we start from opening one)\n const prevCloseNodeText = closeNode.getTextContent()\n const closeNodeText =\n prevCloseNodeText.slice(0, closeTagStartIndex) + prevCloseNodeText.slice(closeTagEndIndex + 1)\n closeNode.setTextContent(closeNodeText)\n const openNodeText = openNode === closeNode ? closeNodeText : prevOpenNodeText\n openNode.setTextContent(\n openNodeText.slice(0, openTagStartIndex) + openNodeText.slice(openTagStartIndex + tagLength),\n )\n const selection = $getSelection()\n const nextSelection = $createRangeSelection()\n $setSelection(nextSelection)\n // Adjust offset based on deleted chars\n const newOffset = closeTagEndIndex - tagLength * (openNode === closeNode ? 2 : 1) + 1\n nextSelection.anchor.set(openNode.__key, openTagStartIndex, 'text')\n nextSelection.focus.set(closeNode.__key, newOffset, 'text')\n\n // Apply formatting to selected text\n for (const format of matcher.format) {\n if (!nextSelection.hasFormat(format)) {\n nextSelection.formatText(format)\n }\n }\n\n // Collapse selection up to the focus point\n nextSelection.anchor.set(\n nextSelection.focus.key,\n nextSelection.focus.offset,\n nextSelection.focus.type,\n )\n\n // Remove formatting from collapsed selection\n for (const format of matcher.format) {\n if (nextSelection.hasFormat(format)) {\n nextSelection.toggleFormat(format)\n }\n }\n\n if ($isRangeSelection(selection)) {\n nextSelection.format = selection.format\n }\n\n return true\n }\n\n return false\n}\n\nfunction getOpenTagStartIndex(string: string, maxIndex: number, tag: string): number {\n const tagLength = tag.length\n\n for (let i = maxIndex; i >= tagLength; i--) {\n const startIndex = i - tagLength\n\n if (\n isEqualSubString(string, startIndex, tag, 0, tagLength) && // Space after opening tag cancels transformation\n string[startIndex + tagLength] !== ' '\n ) {\n return startIndex\n }\n }\n\n return -1\n}\n\nfunction isEqualSubString(\n stringA: string,\n aStart: number,\n stringB: string,\n bStart: number,\n length: number,\n): boolean {\n for (let i = 0; i < length; i++) {\n if (stringA[aStart + i] !== stringB[bStart + i]) {\n return false\n }\n }\n\n return true\n}\n\nexport function registerMarkdownShortcuts(\n editor: LexicalEditor,\n transformers: Array<Transformer> = TRANSFORMERS,\n): () => void {\n const byType = transformersByType(transformers)\n const textFormatTransformersByTrigger = indexBy(\n byType.textFormat,\n ({ tag }) => tag[tag.length - 1],\n )\n const textMatchTransformersByTrigger = indexBy(byType.textMatch, ({ trigger }) => trigger)\n\n for (const transformer of transformers) {\n const type = transformer.type\n if (type === 'element' || type === 'text-match' || type === 'multiline-element') {\n const dependencies = transformer.dependencies\n for (const node of dependencies) {\n if (!editor.hasNode(node)) {\n throw new Error(\n 'MarkdownShortcuts: missing dependency %s for transformer. Ensure node dependency is included in editor initial config.' +\n node.getType(),\n )\n }\n }\n }\n }\n\n const $transform = (parentNode: ElementNode, anchorNode: TextNode, anchorOffset: number) => {\n if (runElementTransformers(parentNode, anchorNode, anchorOffset, byType.element)) {\n return\n }\n\n if (\n runMultilineElementTransformers(parentNode, anchorNode, anchorOffset, byType.multilineElement)\n ) {\n return\n }\n\n if (runTextMatchTransformers(anchorNode, anchorOffset, textMatchTransformersByTrigger)) {\n return\n }\n\n $runTextFormatTransformers(anchorNode, anchorOffset, textFormatTransformersByTrigger)\n }\n\n return editor.registerUpdateListener(({ dirtyLeaves, editorState, prevEditorState, tags }) => {\n // Ignore updates from collaboration and undo/redo (as changes already calculated)\n if (tags.has('collaboration') || tags.has('historic')) {\n return\n }\n\n // If editor is still composing (i.e. backticks) we must wait before the user confirms the key\n if (editor.isComposing()) {\n return\n }\n\n const selection = editorState.read($getSelection)\n const prevSelection = prevEditorState.read($getSelection)\n\n // We expect selection to be a collapsed range and not match previous one (as we want\n // to trigger transforms only as user types)\n if (\n !$isRangeSelection(prevSelection) ||\n !$isRangeSelection(selection) ||\n !selection.isCollapsed() ||\n selection.is(prevSelection)\n ) {\n return\n }\n\n const anchorKey = selection.anchor.key\n const anchorOffset = selection.anchor.offset\n\n const anchorNode = editorState._nodeMap.get(anchorKey)\n\n if (\n !$isTextNode(anchorNode) ||\n !dirtyLeaves.has(anchorKey) ||\n (anchorOffset !== 1 && anchorOffset > prevSelection.anchor.offset + 1)\n ) {\n return\n }\n\n editor.update(() => {\n // Markdown is not available inside code\n if (anchorNode.hasFormat('code')) {\n return\n }\n\n const parentNode = anchorNode.getParent()\n\n if (parentNode === null) {\n return\n }\n\n $transform(parentNode, anchorNode, selection.anchor.offset)\n })\n })\n}\n"],"mappings":"AAAA;;;;;;GAUA,SAC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,UAAA,CAAWqE,SAAS,CAAC,SAAS;QAChC;MACF;MAEA,MAAMtE,UAAA,GAAaC,UAAA,CAAWI,SAAS;MAEvC,IAAIL,UAAA,KAAe,MAAM;QACvB;MACF;MAEAgG,UAAA,CAAWhG,UAAA,EAAYC,UAAA,EAAY6D,SAAA,CAAUG,MAAM,CAACQ,MAAM;IAC5D;EACF;AACF","ignoreList":[]}
@@ -1,147 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import type { ElementNode, Klass, LexicalNode, TextFormatType, TextNode } from 'lexical';
9
- export type Transformer = ElementTransformer | MultilineElementTransformer | TextFormatTransformer | TextMatchTransformer;
10
- export type ElementTransformer = {
11
- dependencies: Array<Klass<LexicalNode>>;
12
- /**
13
- * `export` is called when the `$convertToMarkdownString` is called to convert the editor state into markdown.
14
- *
15
- * @return return null to cancel the export, even though the regex matched. Lexical will then search for the next transformer.
16
- */
17
- export: (node: LexicalNode, traverseChildren: (node: ElementNode) => string) => null | string;
18
- regExp: RegExp;
19
- /**
20
- * `replace` is called when markdown is imported or typed in the editor
21
- *
22
- * @return return false to cancel the transform, even though the regex matched. Lexical will then search for the next transformer.
23
- */
24
- replace: (parentNode: ElementNode, children: Array<LexicalNode>, match: Array<string>,
25
- /**
26
- * Whether the match is from an import operation (e.g. through `$convertFromMarkdownString`) or not (e.g. through typing in the editor).
27
- */
28
- isImport: boolean) => boolean | void;
29
- type: 'element';
30
- };
31
- export type MultilineElementTransformer = {
32
- dependencies: Array<Klass<LexicalNode>>;
33
- /**
34
- * `export` is called when the `$convertToMarkdownString` is called to convert the editor state into markdown.
35
- *
36
- * @return return null to cancel the export, even though the regex matched. Lexical will then search for the next transformer.
37
- */
38
- export?: (node: LexicalNode, traverseChildren: (node: ElementNode) => string) => null | string;
39
- /**
40
- * Use this function to manually handle the import process, once the `regExpStart` has matched successfully.
41
- * Without providing this function, the default behavior is to match until `regExpEnd` is found, or until the end of the document if `regExpEnd.optional` is true.
42
- *
43
- * @returns a tuple or null. The first element of the returned tuple is a boolean indicating if a multiline element was imported. The second element is the index of the last line that was processed. If null is returned, the next multilineElementTransformer will be tried. If undefined is returned, the default behavior will be used.
44
- */
45
- handleImportAfterStartMatch?: (args: {
46
- lines: Array<string>;
47
- rootNode: ElementNode;
48
- startLineIndex: number;
49
- startMatch: RegExpMatchArray;
50
- transformer: MultilineElementTransformer;
51
- }) => [boolean, number] | null | undefined;
52
- /**
53
- * This regex determines when to stop matching. Anything in between regExpStart and regExpEnd will be matched
54
- */
55
- regExpEnd?: {
56
- /**
57
- * Whether the end match is optional. If true, the end match is not required to match for the transformer to be triggered.
58
- * The entire text from regexpStart to the end of the document will then be matched.
59
- */
60
- optional?: true;
61
- regExp: RegExp;
62
- } | RegExp;
63
- /**
64
- * This regex determines when to start matching
65
- */
66
- regExpStart: RegExp;
67
- /**
68
- * `replace` is called only when markdown is imported in the editor, not when it's typed
69
- *
70
- * @return return false to cancel the transform, even though the regex matched. Lexical will then search for the next transformer.
71
- */
72
- replace: (rootNode: ElementNode,
73
- /**
74
- * During markdown shortcut transforms, children nodes may be provided to the transformer. If this is the case, no `linesInBetween` will be provided and
75
- * the children nodes should be used instead of the `linesInBetween` to create the new node.
76
- */
77
- children: Array<LexicalNode> | null, startMatch: Array<string>, endMatch: Array<string> | null,
78
- /**
79
- * linesInBetween includes the text between the start & end matches, split up by lines, not including the matches themselves.
80
- * This is null when the transformer is triggered through markdown shortcuts (by typing in the editor)
81
- */
82
- linesInBetween: Array<string> | null,
83
- /**
84
- * Whether the match is from an import operation (e.g. through `$convertFromMarkdownString`) or not (e.g. through typing in the editor).
85
- */
86
- isImport: boolean) => boolean | void;
87
- type: 'multiline-element';
88
- };
89
- export type TextFormatTransformer = Readonly<{
90
- format: ReadonlyArray<TextFormatType>;
91
- intraword?: boolean;
92
- tag: string;
93
- type: 'text-format';
94
- }>;
95
- export type TextMatchTransformer = Readonly<{
96
- dependencies: Array<Klass<LexicalNode>>;
97
- /**
98
- * Determines how a node should be exported to markdown
99
- */
100
- export?: (node: LexicalNode, exportChildren: (node: ElementNode) => string, exportFormat: (node: TextNode, textContent: string) => string) => null | string;
101
- /**
102
- * For import operations, this function can be used to determine the end index of the match, after `importRegExp` has matched.
103
- * Without this function, the end index will be determined by the length of the match from `importRegExp`. Manually determining the end index can be useful if
104
- * the match from `importRegExp` is not the entire text content of the node. That way, `importRegExp` can be used to match only the start of the node, and `getEndIndex`
105
- * can be used to match the end of the node.
106
- *
107
- * @returns The end index of the match, or false if the match was unsuccessful and a different transformer should be tried.
108
- */
109
- getEndIndex?: (node: TextNode, match: RegExpMatchArray) => false | number;
110
- /**
111
- * This regex determines what text is matched during markdown imports
112
- */
113
- importRegExp?: RegExp;
114
- /**
115
- * This regex determines what text is matched for markdown shortcuts while typing in the editor
116
- */
117
- regExp: RegExp;
118
- /**
119
- * Determines how the matched markdown text should be transformed into a node during the markdown import process
120
- *
121
- * @returns nothing, or a TextNode that may be a child of the new node that is created.
122
- * If a TextNode is returned, text format matching will be applied to it (e.g. bold, italic, etc.)
123
- */
124
- replace?: (node: TextNode, match: RegExpMatchArray) => TextNode | void;
125
- /**
126
- * Single character that allows the transformer to trigger when typed in the editor. This does not affect markdown imports outside of the markdown shortcut plugin.
127
- * If the trigger is matched, the `regExp` will be used to match the text in the second step.
128
- */
129
- trigger?: string;
130
- type: 'text-match';
131
- }>;
132
- export declare const HEADING: ElementTransformer;
133
- export declare const QUOTE: ElementTransformer;
134
- export declare const UNORDERED_LIST: ElementTransformer;
135
- export declare const CHECK_LIST: ElementTransformer;
136
- export declare const ORDERED_LIST: ElementTransformer;
137
- export declare const INLINE_CODE: TextFormatTransformer;
138
- export declare const HIGHLIGHT: TextFormatTransformer;
139
- export declare const BOLD_ITALIC_STAR: TextFormatTransformer;
140
- export declare const BOLD_ITALIC_UNDERSCORE: TextFormatTransformer;
141
- export declare const BOLD_STAR: TextFormatTransformer;
142
- export declare const BOLD_UNDERSCORE: TextFormatTransformer;
143
- export declare const STRIKETHROUGH: TextFormatTransformer;
144
- export declare const ITALIC_STAR: TextFormatTransformer;
145
- export declare const ITALIC_UNDERSCORE: TextFormatTransformer;
146
- export declare function normalizeMarkdown(input: string, shouldMergeAdjacentLines: boolean): string;
147
- //# sourceMappingURL=MarkdownTransformers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkdownTransformers.d.ts","sourceRoot":"","sources":["../../../../src/packages/@lexical/markdown/MarkdownTransformers.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAoBxF,MAAM,MAAM,WAAW,GACnB,kBAAkB,GAClB,2BAA2B,GAC3B,qBAAqB,GACrB,oBAAoB,CAAA;AAExB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;IACvC;;;;OAIG;IACH,MAAM,EAAE,CACN,IAAI,EAAE,WAAW,EAEjB,gBAAgB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,MAAM,KAC5C,IAAI,GAAG,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,OAAO,EAAE,CACP,UAAU,EAAE,WAAW,EACvB,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,EAC5B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,OAAO,KACd,OAAO,GAAG,IAAI,CAAA;IACnB,IAAI,EAAE,SAAS,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;IACvC;;;;OAIG;IACH,MAA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