@lexical/react 0.14.4 → 0.15.0

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 (287) hide show
  1. package/LexicalAutoEmbedPlugin.dev.js +17 -1
  2. package/LexicalAutoEmbedPlugin.dev.mjs +3 -0
  3. package/LexicalAutoEmbedPlugin.js +2 -0
  4. package/LexicalAutoEmbedPlugin.mjs +2 -0
  5. package/LexicalAutoEmbedPlugin.node.mjs +2 -0
  6. package/LexicalAutoEmbedPlugin.prod.js +6 -4
  7. package/LexicalAutoEmbedPlugin.prod.mjs +2 -0
  8. package/LexicalAutoFocusPlugin.dev.js +3 -0
  9. package/LexicalAutoFocusPlugin.dev.mjs +3 -0
  10. package/LexicalAutoFocusPlugin.js +2 -0
  11. package/LexicalAutoFocusPlugin.mjs +2 -0
  12. package/LexicalAutoFocusPlugin.node.mjs +2 -0
  13. package/LexicalAutoFocusPlugin.prod.js +2 -0
  14. package/LexicalAutoFocusPlugin.prod.mjs +2 -0
  15. package/LexicalAutoLinkPlugin.dev.js +9 -4
  16. package/LexicalAutoLinkPlugin.dev.mjs +10 -5
  17. package/LexicalAutoLinkPlugin.js +2 -0
  18. package/LexicalAutoLinkPlugin.mjs +2 -0
  19. package/LexicalAutoLinkPlugin.node.mjs +2 -0
  20. package/LexicalAutoLinkPlugin.prod.js +12 -10
  21. package/LexicalAutoLinkPlugin.prod.mjs +3 -1
  22. package/LexicalBlockWithAlignableContents.dev.js +20 -4
  23. package/LexicalBlockWithAlignableContents.dev.mjs +6 -3
  24. package/LexicalBlockWithAlignableContents.js +2 -0
  25. package/LexicalBlockWithAlignableContents.mjs +2 -0
  26. package/LexicalBlockWithAlignableContents.node.mjs +2 -0
  27. package/LexicalBlockWithAlignableContents.prod.js +6 -4
  28. package/LexicalBlockWithAlignableContents.prod.mjs +2 -0
  29. package/LexicalCharacterLimitPlugin.dev.js +21 -4
  30. package/LexicalCharacterLimitPlugin.dev.mjs +7 -3
  31. package/LexicalCharacterLimitPlugin.js +2 -0
  32. package/LexicalCharacterLimitPlugin.mjs +2 -0
  33. package/LexicalCharacterLimitPlugin.node.mjs +2 -0
  34. package/LexicalCharacterLimitPlugin.prod.js +11 -9
  35. package/LexicalCharacterLimitPlugin.prod.mjs +3 -1
  36. package/LexicalCheckListPlugin.dev.js +3 -0
  37. package/LexicalCheckListPlugin.dev.mjs +3 -0
  38. package/LexicalCheckListPlugin.js +2 -0
  39. package/LexicalCheckListPlugin.mjs +2 -0
  40. package/LexicalCheckListPlugin.node.mjs +2 -0
  41. package/LexicalCheckListPlugin.prod.js +2 -0
  42. package/LexicalCheckListPlugin.prod.mjs +2 -0
  43. package/LexicalClearEditorPlugin.dev.js +5 -2
  44. package/LexicalClearEditorPlugin.dev.mjs +7 -4
  45. package/LexicalClearEditorPlugin.js +2 -0
  46. package/LexicalClearEditorPlugin.mjs +2 -0
  47. package/LexicalClearEditorPlugin.node.mjs +2 -0
  48. package/LexicalClearEditorPlugin.prod.js +3 -1
  49. package/LexicalClearEditorPlugin.prod.mjs +3 -1
  50. package/LexicalClickableLinkPlugin.dev.js +14 -13
  51. package/LexicalClickableLinkPlugin.dev.mjs +14 -13
  52. package/LexicalClickableLinkPlugin.js +2 -0
  53. package/LexicalClickableLinkPlugin.mjs +2 -0
  54. package/LexicalClickableLinkPlugin.node.mjs +2 -0
  55. package/LexicalClickableLinkPlugin.prod.js +5 -4
  56. package/LexicalClickableLinkPlugin.prod.mjs +3 -1
  57. package/LexicalCollaborationContext.dev.js +3 -0
  58. package/LexicalCollaborationContext.dev.mjs +3 -0
  59. package/LexicalCollaborationContext.js +2 -0
  60. package/LexicalCollaborationContext.mjs +2 -0
  61. package/LexicalCollaborationContext.node.mjs +2 -0
  62. package/LexicalCollaborationContext.prod.js +2 -0
  63. package/LexicalCollaborationContext.prod.mjs +2 -0
  64. package/LexicalCollaborationPlugin.dev.js +19 -2
  65. package/LexicalCollaborationPlugin.dev.mjs +4 -0
  66. package/LexicalCollaborationPlugin.js +2 -0
  67. package/LexicalCollaborationPlugin.mjs +2 -0
  68. package/LexicalCollaborationPlugin.node.mjs +2 -0
  69. package/LexicalCollaborationPlugin.prod.js +12 -10
  70. package/LexicalCollaborationPlugin.prod.mjs +2 -0
  71. package/LexicalComposer.dev.js +19 -3
  72. package/LexicalComposer.dev.mjs +7 -4
  73. package/LexicalComposer.js +2 -0
  74. package/LexicalComposer.mjs +2 -0
  75. package/LexicalComposer.node.mjs +2 -0
  76. package/LexicalComposer.prod.js +5 -3
  77. package/LexicalComposer.prod.mjs +3 -1
  78. package/LexicalComposerContext.dev.js +3 -0
  79. package/LexicalComposerContext.dev.mjs +3 -0
  80. package/LexicalComposerContext.js +2 -0
  81. package/LexicalComposerContext.mjs +2 -0
  82. package/LexicalComposerContext.node.mjs +2 -0
  83. package/LexicalComposerContext.prod.js +4 -2
  84. package/LexicalComposerContext.prod.mjs +3 -1
  85. package/LexicalContentEditable.dev.js +18 -3
  86. package/LexicalContentEditable.dev.mjs +6 -4
  87. package/LexicalContentEditable.js +2 -0
  88. package/LexicalContentEditable.mjs +2 -0
  89. package/LexicalContentEditable.node.mjs +2 -0
  90. package/LexicalContentEditable.prod.js +6 -3
  91. package/LexicalContentEditable.prod.mjs +3 -1
  92. package/LexicalContextMenuPlugin.dev.js +24 -7
  93. package/LexicalContextMenuPlugin.dev.mjs +11 -7
  94. package/LexicalContextMenuPlugin.js +2 -0
  95. package/LexicalContextMenuPlugin.js.flow +12 -0
  96. package/LexicalContextMenuPlugin.mjs +2 -0
  97. package/LexicalContextMenuPlugin.node.mjs +2 -0
  98. package/LexicalContextMenuPlugin.prod.js +18 -16
  99. package/LexicalContextMenuPlugin.prod.mjs +3 -1
  100. package/LexicalDecoratorBlockNode.d.ts +1 -0
  101. package/LexicalDecoratorBlockNode.dev.js +6 -0
  102. package/LexicalDecoratorBlockNode.dev.mjs +6 -0
  103. package/LexicalDecoratorBlockNode.js +2 -0
  104. package/LexicalDecoratorBlockNode.mjs +2 -0
  105. package/LexicalDecoratorBlockNode.node.mjs +2 -0
  106. package/LexicalDecoratorBlockNode.prod.js +3 -1
  107. package/LexicalDecoratorBlockNode.prod.mjs +3 -1
  108. package/LexicalEditorRefPlugin.dev.js +17 -1
  109. package/LexicalEditorRefPlugin.dev.mjs +3 -0
  110. package/LexicalEditorRefPlugin.js +2 -0
  111. package/LexicalEditorRefPlugin.js.flow +19 -0
  112. package/LexicalEditorRefPlugin.mjs +2 -0
  113. package/LexicalEditorRefPlugin.node.mjs +2 -0
  114. package/LexicalEditorRefPlugin.prod.js +3 -1
  115. package/LexicalEditorRefPlugin.prod.mjs +2 -0
  116. package/LexicalErrorBoundary.dev.js +21 -5
  117. package/LexicalErrorBoundary.dev.mjs +3 -0
  118. package/LexicalErrorBoundary.js +2 -0
  119. package/LexicalErrorBoundary.mjs +2 -0
  120. package/LexicalErrorBoundary.node.mjs +2 -0
  121. package/LexicalErrorBoundary.prod.js +6 -4
  122. package/LexicalErrorBoundary.prod.mjs +2 -0
  123. package/LexicalHashtagPlugin.dev.js +5 -2
  124. package/LexicalHashtagPlugin.dev.mjs +5 -2
  125. package/LexicalHashtagPlugin.js +2 -0
  126. package/LexicalHashtagPlugin.mjs +2 -0
  127. package/LexicalHashtagPlugin.node.mjs +2 -0
  128. package/LexicalHashtagPlugin.prod.js +2 -0
  129. package/LexicalHashtagPlugin.prod.mjs +2 -0
  130. package/LexicalHistoryPlugin.dev.js +4 -0
  131. package/LexicalHistoryPlugin.dev.mjs +4 -0
  132. package/LexicalHistoryPlugin.js +2 -0
  133. package/LexicalHistoryPlugin.mjs +2 -0
  134. package/LexicalHistoryPlugin.node.mjs +2 -0
  135. package/LexicalHistoryPlugin.prod.js +2 -0
  136. package/LexicalHistoryPlugin.prod.mjs +2 -0
  137. package/LexicalHorizontalRuleNode.dev.js +22 -6
  138. package/LexicalHorizontalRuleNode.dev.mjs +8 -5
  139. package/LexicalHorizontalRuleNode.js +2 -0
  140. package/LexicalHorizontalRuleNode.mjs +2 -0
  141. package/LexicalHorizontalRuleNode.node.mjs +2 -0
  142. package/LexicalHorizontalRuleNode.prod.js +7 -5
  143. package/LexicalHorizontalRuleNode.prod.mjs +2 -0
  144. package/LexicalHorizontalRulePlugin.dev.js +3 -0
  145. package/LexicalHorizontalRulePlugin.dev.mjs +3 -0
  146. package/LexicalHorizontalRulePlugin.js +2 -0
  147. package/LexicalHorizontalRulePlugin.mjs +2 -0
  148. package/LexicalHorizontalRulePlugin.node.mjs +2 -0
  149. package/LexicalHorizontalRulePlugin.prod.js +2 -0
  150. package/LexicalHorizontalRulePlugin.prod.mjs +2 -0
  151. package/LexicalLinkPlugin.dev.js +6 -3
  152. package/LexicalLinkPlugin.dev.mjs +7 -4
  153. package/LexicalLinkPlugin.js +2 -0
  154. package/LexicalLinkPlugin.mjs +2 -0
  155. package/LexicalLinkPlugin.node.mjs +2 -0
  156. package/LexicalLinkPlugin.prod.js +3 -1
  157. package/LexicalLinkPlugin.prod.mjs +3 -1
  158. package/LexicalListPlugin.dev.js +4 -0
  159. package/LexicalListPlugin.dev.mjs +4 -0
  160. package/LexicalListPlugin.js +2 -0
  161. package/LexicalListPlugin.mjs +2 -0
  162. package/LexicalListPlugin.node.mjs +2 -0
  163. package/LexicalListPlugin.prod.js +2 -0
  164. package/LexicalListPlugin.prod.mjs +2 -0
  165. package/LexicalMarkdownShortcutPlugin.dev.js +3 -0
  166. package/LexicalMarkdownShortcutPlugin.dev.mjs +3 -0
  167. package/LexicalMarkdownShortcutPlugin.js +2 -0
  168. package/LexicalMarkdownShortcutPlugin.mjs +2 -0
  169. package/LexicalMarkdownShortcutPlugin.node.mjs +2 -0
  170. package/LexicalMarkdownShortcutPlugin.prod.js +2 -0
  171. package/LexicalMarkdownShortcutPlugin.prod.mjs +2 -0
  172. package/LexicalNestedComposer.dev.js +17 -1
  173. package/LexicalNestedComposer.dev.mjs +3 -0
  174. package/LexicalNestedComposer.js +2 -0
  175. package/LexicalNestedComposer.mjs +2 -0
  176. package/LexicalNestedComposer.node.mjs +2 -0
  177. package/LexicalNestedComposer.prod.js +7 -5
  178. package/LexicalNestedComposer.prod.mjs +3 -1
  179. package/LexicalNodeEventPlugin.dev.js +3 -0
  180. package/LexicalNodeEventPlugin.dev.mjs +3 -0
  181. package/LexicalNodeEventPlugin.js +2 -0
  182. package/LexicalNodeEventPlugin.js.flow +12 -0
  183. package/LexicalNodeEventPlugin.mjs +2 -0
  184. package/LexicalNodeEventPlugin.node.mjs +2 -0
  185. package/LexicalNodeEventPlugin.prod.js +2 -0
  186. package/LexicalNodeEventPlugin.prod.mjs +2 -0
  187. package/LexicalNodeMenuPlugin.dev.js +25 -8
  188. package/LexicalNodeMenuPlugin.dev.mjs +11 -7
  189. package/LexicalNodeMenuPlugin.js +2 -0
  190. package/LexicalNodeMenuPlugin.mjs +2 -0
  191. package/LexicalNodeMenuPlugin.node.mjs +2 -0
  192. package/LexicalNodeMenuPlugin.prod.js +17 -15
  193. package/LexicalNodeMenuPlugin.prod.mjs +3 -1
  194. package/LexicalOnChangePlugin.dev.js +5 -2
  195. package/LexicalOnChangePlugin.dev.mjs +7 -4
  196. package/LexicalOnChangePlugin.js +2 -0
  197. package/LexicalOnChangePlugin.mjs +2 -0
  198. package/LexicalOnChangePlugin.node.mjs +2 -0
  199. package/LexicalOnChangePlugin.prod.js +3 -1
  200. package/LexicalOnChangePlugin.prod.mjs +3 -1
  201. package/LexicalPlainTextPlugin.dev.js +26 -7
  202. package/LexicalPlainTextPlugin.dev.mjs +13 -7
  203. package/LexicalPlainTextPlugin.js +2 -0
  204. package/LexicalPlainTextPlugin.mjs +2 -0
  205. package/LexicalPlainTextPlugin.node.mjs +2 -0
  206. package/LexicalPlainTextPlugin.prod.js +6 -4
  207. package/LexicalPlainTextPlugin.prod.mjs +3 -1
  208. package/LexicalRichTextPlugin.dev.js +26 -7
  209. package/LexicalRichTextPlugin.dev.mjs +13 -7
  210. package/LexicalRichTextPlugin.js +2 -0
  211. package/LexicalRichTextPlugin.mjs +2 -0
  212. package/LexicalRichTextPlugin.node.mjs +2 -0
  213. package/LexicalRichTextPlugin.prod.js +6 -4
  214. package/LexicalRichTextPlugin.prod.mjs +3 -1
  215. package/LexicalTabIndentationPlugin.dev.js +5 -2
  216. package/LexicalTabIndentationPlugin.dev.mjs +5 -2
  217. package/LexicalTabIndentationPlugin.js +2 -0
  218. package/LexicalTabIndentationPlugin.mjs +2 -0
  219. package/LexicalTabIndentationPlugin.node.mjs +2 -0
  220. package/LexicalTabIndentationPlugin.prod.js +2 -0
  221. package/LexicalTabIndentationPlugin.prod.mjs +2 -0
  222. package/LexicalTableOfContents.d.ts +1 -1
  223. package/LexicalTableOfContents.dev.js +47 -8
  224. package/LexicalTableOfContents.dev.mjs +48 -9
  225. package/LexicalTableOfContents.js +2 -0
  226. package/LexicalTableOfContents.mjs +2 -0
  227. package/LexicalTableOfContents.node.mjs +2 -0
  228. package/LexicalTableOfContents.prod.js +6 -4
  229. package/LexicalTableOfContents.prod.mjs +3 -1
  230. package/LexicalTablePlugin.dev.js +28 -2
  231. package/LexicalTablePlugin.dev.mjs +31 -5
  232. package/LexicalTablePlugin.js +2 -0
  233. package/LexicalTablePlugin.mjs +2 -0
  234. package/LexicalTablePlugin.node.mjs +2 -0
  235. package/LexicalTablePlugin.prod.js +9 -5
  236. package/LexicalTablePlugin.prod.mjs +3 -1
  237. package/LexicalTreeView.dev.js +18 -2
  238. package/LexicalTreeView.dev.mjs +3 -0
  239. package/LexicalTreeView.js +2 -0
  240. package/LexicalTreeView.mjs +2 -0
  241. package/LexicalTreeView.node.mjs +2 -0
  242. package/LexicalTreeView.prod.js +5 -3
  243. package/LexicalTreeView.prod.mjs +2 -0
  244. package/LexicalTypeaheadMenuPlugin.dev.js +25 -8
  245. package/LexicalTypeaheadMenuPlugin.dev.mjs +11 -7
  246. package/LexicalTypeaheadMenuPlugin.js +2 -0
  247. package/LexicalTypeaheadMenuPlugin.mjs +2 -0
  248. package/LexicalTypeaheadMenuPlugin.node.mjs +2 -0
  249. package/LexicalTypeaheadMenuPlugin.prod.js +21 -19
  250. package/LexicalTypeaheadMenuPlugin.prod.mjs +3 -1
  251. package/package.json +20 -19
  252. package/shared/useCharacterLimit.d.ts +1 -1
  253. package/useLexicalEditable.dev.js +6 -2
  254. package/useLexicalEditable.dev.mjs +8 -4
  255. package/useLexicalEditable.js +2 -0
  256. package/useLexicalEditable.mjs +2 -0
  257. package/useLexicalEditable.node.mjs +2 -0
  258. package/useLexicalEditable.prod.js +3 -1
  259. package/useLexicalEditable.prod.mjs +3 -1
  260. package/useLexicalIsTextContentEmpty.dev.js +5 -2
  261. package/useLexicalIsTextContentEmpty.dev.mjs +7 -4
  262. package/useLexicalIsTextContentEmpty.js +2 -0
  263. package/useLexicalIsTextContentEmpty.mjs +2 -0
  264. package/useLexicalIsTextContentEmpty.node.mjs +2 -0
  265. package/useLexicalIsTextContentEmpty.prod.js +3 -1
  266. package/useLexicalIsTextContentEmpty.prod.mjs +3 -1
  267. package/useLexicalNodeSelection.dev.js +3 -0
  268. package/useLexicalNodeSelection.dev.mjs +4 -1
  269. package/useLexicalNodeSelection.js +2 -0
  270. package/useLexicalNodeSelection.mjs +2 -0
  271. package/useLexicalNodeSelection.node.mjs +2 -0
  272. package/useLexicalNodeSelection.prod.js +2 -0
  273. package/useLexicalNodeSelection.prod.mjs +3 -1
  274. package/useLexicalSubscription.dev.js +5 -2
  275. package/useLexicalSubscription.dev.mjs +7 -4
  276. package/useLexicalSubscription.js +2 -0
  277. package/useLexicalSubscription.mjs +2 -0
  278. package/useLexicalSubscription.node.mjs +2 -0
  279. package/useLexicalSubscription.prod.js +3 -1
  280. package/useLexicalSubscription.prod.mjs +3 -1
  281. package/useLexicalTextEntity.dev.js +3 -0
  282. package/useLexicalTextEntity.dev.mjs +3 -0
  283. package/useLexicalTextEntity.js +2 -0
  284. package/useLexicalTextEntity.mjs +2 -0
  285. package/useLexicalTextEntity.node.mjs +2 -0
  286. package/useLexicalTextEntity.prod.js +2 -0
  287. package/useLexicalTextEntity.prod.mjs +2 -0
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict';
8
10
 
9
11
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
@@ -15,6 +17,19 @@ var reactDom = require('react-dom');
15
17
  var dragon = require('@lexical/dragon');
16
18
  var plainText = require('@lexical/plain-text');
17
19
 
20
+ function _interopNamespaceDefault(e) {
21
+ var n = Object.create(null);
22
+ if (e) {
23
+ for (var k in e) {
24
+ n[k] = e[k];
25
+ }
26
+ }
27
+ n.default = e;
28
+ return n;
29
+ }
30
+
31
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
32
+
18
33
  /**
19
34
  * Copyright (c) Meta Platforms, Inc. and affiliates.
20
35
  *
@@ -32,8 +47,8 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
32
47
  * LICENSE file in the root directory of this source tree.
33
48
  *
34
49
  */
50
+
35
51
  const useLayoutEffectImpl = CAN_USE_DOM ? React.useLayoutEffect : React.useEffect;
36
- var useLayoutEffect = useLayoutEffectImpl;
37
52
 
38
53
  /**
39
54
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -42,13 +57,14 @@ var useLayoutEffect = useLayoutEffectImpl;
42
57
  * LICENSE file in the root directory of this source tree.
43
58
  *
44
59
  */
60
+
45
61
  function canShowPlaceholderFromCurrentEditorState(editor) {
46
62
  const currentCanShowPlaceholder = editor.getEditorState().read(text.$canShowPlaceholderCurry(editor.isComposing()));
47
63
  return currentCanShowPlaceholder;
48
64
  }
49
65
  function useCanShowPlaceholder(editor) {
50
66
  const [canShowPlaceholder, setCanShowPlaceholder] = React.useState(() => canShowPlaceholderFromCurrentEditorState(editor));
51
- useLayoutEffect(() => {
67
+ useLayoutEffectImpl(() => {
52
68
  function resetCanShowPlaceholder() {
53
69
  const currentCanShowPlaceholder = canShowPlaceholderFromCurrentEditorState(editor);
54
70
  setCanShowPlaceholder(currentCanShowPlaceholder);
@@ -70,11 +86,12 @@ function useCanShowPlaceholder(editor) {
70
86
  * LICENSE file in the root directory of this source tree.
71
87
  *
72
88
  */
89
+
73
90
  function useDecorators(editor, ErrorBoundary) {
74
91
  const [decorators, setDecorators] = React.useState(() => editor.getDecorators());
75
92
 
76
93
  // Subscribe to changes
77
- useLayoutEffect(() => {
94
+ useLayoutEffectImpl(() => {
78
95
  return editor.registerDecoratorListener(nextDecorators => {
79
96
  reactDom.flushSync(() => {
80
97
  setDecorators(nextDecorators);
@@ -94,9 +111,9 @@ function useDecorators(editor, ErrorBoundary) {
94
111
  const decoratorKeys = Object.keys(decorators);
95
112
  for (let i = 0; i < decoratorKeys.length; i++) {
96
113
  const nodeKey = decoratorKeys[i];
97
- const reactDecorator = /*#__PURE__*/React.createElement(ErrorBoundary, {
114
+ const reactDecorator = /*#__PURE__*/React__namespace.createElement(ErrorBoundary, {
98
115
  onError: e => editor._onError(e)
99
- }, /*#__PURE__*/React.createElement(React.Suspense, {
116
+ }, /*#__PURE__*/React__namespace.createElement(React.Suspense, {
100
117
  fallback: null
101
118
  }, decorators[nodeKey]));
102
119
  const element = editor.getElementByKey(nodeKey);
@@ -115,8 +132,9 @@ function useDecorators(editor, ErrorBoundary) {
115
132
  * LICENSE file in the root directory of this source tree.
116
133
  *
117
134
  */
135
+
118
136
  function usePlainTextSetup(editor) {
119
- useLayoutEffect(() => {
137
+ useLayoutEffectImpl(() => {
120
138
  return utils.mergeRegister(plainText.registerPlainText(editor), dragon.registerDragonSupport(editor));
121
139
 
122
140
  // We only do this for init
@@ -131,6 +149,7 @@ function usePlainTextSetup(editor) {
131
149
  * LICENSE file in the root directory of this source tree.
132
150
  *
133
151
  */
152
+
134
153
  function PlainTextPlugin({
135
154
  contentEditable,
136
155
  placeholder,
@@ -139,7 +158,7 @@ function PlainTextPlugin({
139
158
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
140
159
  const decorators = useDecorators(editor, ErrorBoundary);
141
160
  usePlainTextSetup(editor);
142
- return /*#__PURE__*/React.createElement(React.Fragment, null, contentEditable, /*#__PURE__*/React.createElement(Placeholder, {
161
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, contentEditable, /*#__PURE__*/React__namespace.createElement(Placeholder, {
143
162
  content: placeholder
144
163
  }), decorators);
145
164
  }
@@ -3,14 +3,16 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
10
  import useLexicalEditable from '@lexical/react/useLexicalEditable';
9
11
  import * as React from 'react';
10
- import { useLayoutEffect as useLayoutEffect$1, useEffect, useState, useMemo, Suspense } from 'react';
12
+ import { useLayoutEffect, useEffect, useState, useMemo, Suspense } from 'react';
11
13
  import { $canShowPlaceholderCurry } from '@lexical/text';
12
14
  import { mergeRegister } from '@lexical/utils';
13
- import { createPortal, flushSync } from 'react-dom';
15
+ import { flushSync, createPortal } from 'react-dom';
14
16
  import { registerDragonSupport } from '@lexical/dragon';
15
17
  import { registerPlainText } from '@lexical/plain-text';
16
18
 
@@ -31,8 +33,8 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
31
33
  * LICENSE file in the root directory of this source tree.
32
34
  *
33
35
  */
34
- const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect$1 : useEffect;
35
- var useLayoutEffect = useLayoutEffectImpl;
36
+
37
+ const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
36
38
 
37
39
  /**
38
40
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -41,13 +43,14 @@ var useLayoutEffect = useLayoutEffectImpl;
41
43
  * LICENSE file in the root directory of this source tree.
42
44
  *
43
45
  */
46
+
44
47
  function canShowPlaceholderFromCurrentEditorState(editor) {
45
48
  const currentCanShowPlaceholder = editor.getEditorState().read($canShowPlaceholderCurry(editor.isComposing()));
46
49
  return currentCanShowPlaceholder;
47
50
  }
48
51
  function useCanShowPlaceholder(editor) {
49
52
  const [canShowPlaceholder, setCanShowPlaceholder] = useState(() => canShowPlaceholderFromCurrentEditorState(editor));
50
- useLayoutEffect(() => {
53
+ useLayoutEffectImpl(() => {
51
54
  function resetCanShowPlaceholder() {
52
55
  const currentCanShowPlaceholder = canShowPlaceholderFromCurrentEditorState(editor);
53
56
  setCanShowPlaceholder(currentCanShowPlaceholder);
@@ -69,11 +72,12 @@ function useCanShowPlaceholder(editor) {
69
72
  * LICENSE file in the root directory of this source tree.
70
73
  *
71
74
  */
75
+
72
76
  function useDecorators(editor, ErrorBoundary) {
73
77
  const [decorators, setDecorators] = useState(() => editor.getDecorators());
74
78
 
75
79
  // Subscribe to changes
76
- useLayoutEffect(() => {
80
+ useLayoutEffectImpl(() => {
77
81
  return editor.registerDecoratorListener(nextDecorators => {
78
82
  flushSync(() => {
79
83
  setDecorators(nextDecorators);
@@ -114,8 +118,9 @@ function useDecorators(editor, ErrorBoundary) {
114
118
  * LICENSE file in the root directory of this source tree.
115
119
  *
116
120
  */
121
+
117
122
  function usePlainTextSetup(editor) {
118
- useLayoutEffect(() => {
123
+ useLayoutEffectImpl(() => {
119
124
  return mergeRegister(registerPlainText(editor), registerDragonSupport(editor));
120
125
 
121
126
  // We only do this for init
@@ -130,6 +135,7 @@ function usePlainTextSetup(editor) {
130
135
  * LICENSE file in the root directory of this source tree.
131
136
  *
132
137
  */
138
+
133
139
  function PlainTextPlugin({
134
140
  contentEditable,
135
141
  placeholder,
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict'
8
10
  const LexicalPlainTextPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalPlainTextPlugin.dev.js') : require('./LexicalPlainTextPlugin.prod.js');
9
11
  module.exports = LexicalPlainTextPlugin;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import * as modDev from './LexicalPlainTextPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalPlainTextPlugin.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalPlainTextPlugin.dev.mjs') : import('./LexicalPlainTextPlugin.prod.mjs'));
8
10
  export const PlainTextPlugin = mod.PlainTextPlugin;
@@ -3,8 +3,10 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- 'use strict';var b=require("@lexical/react/LexicalComposerContext"),g=require("@lexical/react/useLexicalEditable"),l=require("react"),m=require("@lexical/text"),n=require("@lexical/utils"),p=require("react-dom"),t=require("@lexical/dragon"),u=require("@lexical/plain-text"),v="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?l.useLayoutEffect:l.useEffect;
8
- function w(a){return a.getEditorState().read(m.$canShowPlaceholderCurry(a.isComposing()))}function x(a){let [d,c]=l.useState(()=>w(a));v(()=>{function e(){let f=w(a);c(f)}e();return n.mergeRegister(a.registerUpdateListener(()=>{e()}),a.registerEditableListener(()=>{e()}))},[a]);return d}
9
- function y(a,d){let [c,e]=l.useState(()=>a.getDecorators());v(()=>a.registerDecoratorListener(f=>{p.flushSync(()=>{e(f)})}),[a]);l.useEffect(()=>{e(a.getDecorators())},[a]);return l.useMemo(()=>{let f=[],q=Object.keys(c);for(let h=0;h<q.length;h++){let k=q[h],A=l.createElement(d,{onError:z=>a._onError(z)},l.createElement(l.Suspense,{fallback:null},c[k])),r=a.getElementByKey(k);null!==r&&f.push(p.createPortal(A,r,k))}return f},[d,c,a])}
10
- function B(a){v(()=>n.mergeRegister(u.registerPlainText(a),t.registerDragonSupport(a)),[a])}function C({content:a}){var [d]=b.useLexicalComposerContext();d=x(d);let c=g();return d?"function"===typeof a?a(c):a:null}exports.PlainTextPlugin=function({contentEditable:a,placeholder:d,ErrorBoundary:c}){let [e]=b.useLexicalComposerContext();c=y(e,c);B(e);return l.createElement(l.Fragment,null,a,l.createElement(C,{content:d}),c)}
8
+
9
+ 'use strict';var b=require("@lexical/react/LexicalComposerContext"),f=require("@lexical/react/useLexicalEditable"),h=require("react"),m=require("@lexical/text"),n=require("@lexical/utils"),p=require("react-dom"),q=require("@lexical/dragon"),r=require("@lexical/plain-text"),v=Object.create(null);if(h)for(var w in h)v[w]=h[w];v.default=h;let x="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?h.useLayoutEffect:h.useEffect;
10
+ function y(a){return a.getEditorState().read(m.$canShowPlaceholderCurry(a.isComposing()))}function z(a){let [d,c]=h.useState(()=>y(a));x(()=>{function e(){let g=y(a);c(g)}e();return n.mergeRegister(a.registerUpdateListener(()=>{e()}),a.registerEditableListener(()=>{e()}))},[a]);return d}
11
+ function A(a,d){let [c,e]=h.useState(()=>a.getDecorators());x(()=>a.registerDecoratorListener(g=>{p.flushSync(()=>{e(g)})}),[a]);h.useEffect(()=>{e(a.getDecorators())},[a]);return h.useMemo(()=>{let g=[],t=Object.keys(c);for(let k=0;k<t.length;k++){let l=t[k],C=v.createElement(d,{onError:B=>a._onError(B)},v.createElement(h.Suspense,{fallback:null},c[l])),u=a.getElementByKey(l);null!==u&&g.push(p.createPortal(C,u,l))}return g},[d,c,a])}
12
+ function D(a){x(()=>n.mergeRegister(r.registerPlainText(a),q.registerDragonSupport(a)),[a])}function E({content:a}){var [d]=b.useLexicalComposerContext();d=z(d);let c=f();return d?"function"===typeof a?a(c):a:null}exports.PlainTextPlugin=function({contentEditable:a,placeholder:d,ErrorBoundary:c}){let [e]=b.useLexicalComposerContext();c=A(e,c);D(e);return v.createElement(v.Fragment,null,a,v.createElement(E,{content:d}),c)}
@@ -3,5 +3,7 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import t from"@lexical/react/useLexicalEditable";import*as r from"react";import{useLayoutEffect as o,useEffect as n,useState as c,useMemo as i,Suspense as l}from"react";import{$canShowPlaceholderCurry as a}from"@lexical/text";import{mergeRegister as m}from"@lexical/utils";import{createPortal as u,flushSync as s}from"react-dom";import{registerDragonSupport as f}from"@lexical/dragon";import{registerPlainText as d}from"@lexical/plain-text";var p="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?o:n;function E(e){return e.getEditorState().read(a(e.isComposing()))}function x({contentEditable:t,placeholder:o,ErrorBoundary:a}){const[E]=e(),x=function(e,t){const[o,a]=c((()=>e.getDecorators()));return p((()=>e.registerDecoratorListener((e=>{s((()=>{a(e)}))}))),[e]),n((()=>{a(e.getDecorators())}),[e]),i((()=>{const n=[],c=Object.keys(o);for(let i=0;i<c.length;i++){const a=c[i],m=r.createElement(t,{onError:t=>e._onError(t)},r.createElement(l,{fallback:null},o[a])),s=e.getElementByKey(a);null!==s&&n.push(u(m,s,a))}return n}),[t,o,e])}(E,a);return function(e){p((()=>m(d(e),f(e))),[e])}(E),r.createElement(r.Fragment,null,t,r.createElement(g,{content:o}),x)}function g({content:r}){const[o]=e(),n=function(e){const[t,r]=c((()=>E(e)));return p((()=>{function t(){const t=E(e);r(t)}return t(),m(e.registerUpdateListener((()=>{t()})),e.registerEditableListener((()=>{t()})))}),[e]),t}(o),i=t();return n?"function"==typeof r?r(i):r:null}export{x as PlainTextPlugin};
8
+
9
+ import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import t from"@lexical/react/useLexicalEditable";import*as r from"react";import{useLayoutEffect as o,useEffect as n,useState as c,useMemo as i,Suspense as l}from"react";import{$canShowPlaceholderCurry as a}from"@lexical/text";import{mergeRegister as m}from"@lexical/utils";import{flushSync as u,createPortal as s}from"react-dom";import{registerDragonSupport as f}from"@lexical/dragon";import{registerPlainText as d}from"@lexical/plain-text";const p="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?o:n;function E(e){return e.getEditorState().read(a(e.isComposing()))}function x({contentEditable:t,placeholder:o,ErrorBoundary:a}){const[E]=e(),x=function(e,t){const[o,a]=c((()=>e.getDecorators()));return p((()=>e.registerDecoratorListener((e=>{u((()=>{a(e)}))}))),[e]),n((()=>{a(e.getDecorators())}),[e]),i((()=>{const n=[],c=Object.keys(o);for(let i=0;i<c.length;i++){const a=c[i],m=r.createElement(t,{onError:t=>e._onError(t)},r.createElement(l,{fallback:null},o[a])),u=e.getElementByKey(a);null!==u&&n.push(s(m,u,a))}return n}),[t,o,e])}(E,a);return function(e){p((()=>m(d(e),f(e))),[e])}(E),r.createElement(r.Fragment,null,t,r.createElement(g,{content:o}),x)}function g({content:r}){const[o]=e(),n=function(e){const[t,r]=c((()=>E(e)));return p((()=>{function t(){const t=E(e);r(t)}return t(),m(e.registerUpdateListener((()=>{t()})),e.registerEditableListener((()=>{t()})))}),[e]),t}(o),i=t();return n?"function"==typeof r?r(i):r:null}export{x as PlainTextPlugin};
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict';
8
10
 
9
11
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
@@ -15,6 +17,19 @@ var reactDom = require('react-dom');
15
17
  var dragon = require('@lexical/dragon');
16
18
  var richText = require('@lexical/rich-text');
17
19
 
20
+ function _interopNamespaceDefault(e) {
21
+ var n = Object.create(null);
22
+ if (e) {
23
+ for (var k in e) {
24
+ n[k] = e[k];
25
+ }
26
+ }
27
+ n.default = e;
28
+ return n;
29
+ }
30
+
31
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
32
+
18
33
  /**
19
34
  * Copyright (c) Meta Platforms, Inc. and affiliates.
20
35
  *
@@ -32,8 +47,8 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
32
47
  * LICENSE file in the root directory of this source tree.
33
48
  *
34
49
  */
50
+
35
51
  const useLayoutEffectImpl = CAN_USE_DOM ? React.useLayoutEffect : React.useEffect;
36
- var useLayoutEffect = useLayoutEffectImpl;
37
52
 
38
53
  /**
39
54
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -42,13 +57,14 @@ var useLayoutEffect = useLayoutEffectImpl;
42
57
  * LICENSE file in the root directory of this source tree.
43
58
  *
44
59
  */
60
+
45
61
  function canShowPlaceholderFromCurrentEditorState(editor) {
46
62
  const currentCanShowPlaceholder = editor.getEditorState().read(text.$canShowPlaceholderCurry(editor.isComposing()));
47
63
  return currentCanShowPlaceholder;
48
64
  }
49
65
  function useCanShowPlaceholder(editor) {
50
66
  const [canShowPlaceholder, setCanShowPlaceholder] = React.useState(() => canShowPlaceholderFromCurrentEditorState(editor));
51
- useLayoutEffect(() => {
67
+ useLayoutEffectImpl(() => {
52
68
  function resetCanShowPlaceholder() {
53
69
  const currentCanShowPlaceholder = canShowPlaceholderFromCurrentEditorState(editor);
54
70
  setCanShowPlaceholder(currentCanShowPlaceholder);
@@ -70,11 +86,12 @@ function useCanShowPlaceholder(editor) {
70
86
  * LICENSE file in the root directory of this source tree.
71
87
  *
72
88
  */
89
+
73
90
  function useDecorators(editor, ErrorBoundary) {
74
91
  const [decorators, setDecorators] = React.useState(() => editor.getDecorators());
75
92
 
76
93
  // Subscribe to changes
77
- useLayoutEffect(() => {
94
+ useLayoutEffectImpl(() => {
78
95
  return editor.registerDecoratorListener(nextDecorators => {
79
96
  reactDom.flushSync(() => {
80
97
  setDecorators(nextDecorators);
@@ -94,9 +111,9 @@ function useDecorators(editor, ErrorBoundary) {
94
111
  const decoratorKeys = Object.keys(decorators);
95
112
  for (let i = 0; i < decoratorKeys.length; i++) {
96
113
  const nodeKey = decoratorKeys[i];
97
- const reactDecorator = /*#__PURE__*/React.createElement(ErrorBoundary, {
114
+ const reactDecorator = /*#__PURE__*/React__namespace.createElement(ErrorBoundary, {
98
115
  onError: e => editor._onError(e)
99
- }, /*#__PURE__*/React.createElement(React.Suspense, {
116
+ }, /*#__PURE__*/React__namespace.createElement(React.Suspense, {
100
117
  fallback: null
101
118
  }, decorators[nodeKey]));
102
119
  const element = editor.getElementByKey(nodeKey);
@@ -115,8 +132,9 @@ function useDecorators(editor, ErrorBoundary) {
115
132
  * LICENSE file in the root directory of this source tree.
116
133
  *
117
134
  */
135
+
118
136
  function useRichTextSetup(editor) {
119
- useLayoutEffect(() => {
137
+ useLayoutEffectImpl(() => {
120
138
  return utils.mergeRegister(richText.registerRichText(editor), dragon.registerDragonSupport(editor));
121
139
 
122
140
  // We only do this for init
@@ -131,6 +149,7 @@ function useRichTextSetup(editor) {
131
149
  * LICENSE file in the root directory of this source tree.
132
150
  *
133
151
  */
152
+
134
153
  function RichTextPlugin({
135
154
  contentEditable,
136
155
  placeholder,
@@ -139,7 +158,7 @@ function RichTextPlugin({
139
158
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
140
159
  const decorators = useDecorators(editor, ErrorBoundary);
141
160
  useRichTextSetup(editor);
142
- return /*#__PURE__*/React.createElement(React.Fragment, null, contentEditable, /*#__PURE__*/React.createElement(Placeholder, {
161
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, contentEditable, /*#__PURE__*/React__namespace.createElement(Placeholder, {
143
162
  content: placeholder
144
163
  }), decorators);
145
164
  }
@@ -3,14 +3,16 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
10
  import useLexicalEditable from '@lexical/react/useLexicalEditable';
9
11
  import * as React from 'react';
10
- import { useLayoutEffect as useLayoutEffect$1, useEffect, useState, useMemo, Suspense } from 'react';
12
+ import { useLayoutEffect, useEffect, useState, useMemo, Suspense } from 'react';
11
13
  import { $canShowPlaceholderCurry } from '@lexical/text';
12
14
  import { mergeRegister } from '@lexical/utils';
13
- import { createPortal, flushSync } from 'react-dom';
15
+ import { flushSync, createPortal } from 'react-dom';
14
16
  import { registerDragonSupport } from '@lexical/dragon';
15
17
  import { registerRichText } from '@lexical/rich-text';
16
18
 
@@ -31,8 +33,8 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
31
33
  * LICENSE file in the root directory of this source tree.
32
34
  *
33
35
  */
34
- const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect$1 : useEffect;
35
- var useLayoutEffect = useLayoutEffectImpl;
36
+
37
+ const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
36
38
 
37
39
  /**
38
40
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -41,13 +43,14 @@ var useLayoutEffect = useLayoutEffectImpl;
41
43
  * LICENSE file in the root directory of this source tree.
42
44
  *
43
45
  */
46
+
44
47
  function canShowPlaceholderFromCurrentEditorState(editor) {
45
48
  const currentCanShowPlaceholder = editor.getEditorState().read($canShowPlaceholderCurry(editor.isComposing()));
46
49
  return currentCanShowPlaceholder;
47
50
  }
48
51
  function useCanShowPlaceholder(editor) {
49
52
  const [canShowPlaceholder, setCanShowPlaceholder] = useState(() => canShowPlaceholderFromCurrentEditorState(editor));
50
- useLayoutEffect(() => {
53
+ useLayoutEffectImpl(() => {
51
54
  function resetCanShowPlaceholder() {
52
55
  const currentCanShowPlaceholder = canShowPlaceholderFromCurrentEditorState(editor);
53
56
  setCanShowPlaceholder(currentCanShowPlaceholder);
@@ -69,11 +72,12 @@ function useCanShowPlaceholder(editor) {
69
72
  * LICENSE file in the root directory of this source tree.
70
73
  *
71
74
  */
75
+
72
76
  function useDecorators(editor, ErrorBoundary) {
73
77
  const [decorators, setDecorators] = useState(() => editor.getDecorators());
74
78
 
75
79
  // Subscribe to changes
76
- useLayoutEffect(() => {
80
+ useLayoutEffectImpl(() => {
77
81
  return editor.registerDecoratorListener(nextDecorators => {
78
82
  flushSync(() => {
79
83
  setDecorators(nextDecorators);
@@ -114,8 +118,9 @@ function useDecorators(editor, ErrorBoundary) {
114
118
  * LICENSE file in the root directory of this source tree.
115
119
  *
116
120
  */
121
+
117
122
  function useRichTextSetup(editor) {
118
- useLayoutEffect(() => {
123
+ useLayoutEffectImpl(() => {
119
124
  return mergeRegister(registerRichText(editor), registerDragonSupport(editor));
120
125
 
121
126
  // We only do this for init
@@ -130,6 +135,7 @@ function useRichTextSetup(editor) {
130
135
  * LICENSE file in the root directory of this source tree.
131
136
  *
132
137
  */
138
+
133
139
  function RichTextPlugin({
134
140
  contentEditable,
135
141
  placeholder,
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict'
8
10
  const LexicalRichTextPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalRichTextPlugin.dev.js') : require('./LexicalRichTextPlugin.prod.js');
9
11
  module.exports = LexicalRichTextPlugin;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import * as modDev from './LexicalRichTextPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalRichTextPlugin.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalRichTextPlugin.dev.mjs') : import('./LexicalRichTextPlugin.prod.mjs'));
8
10
  export const RichTextPlugin = mod.RichTextPlugin;
@@ -3,8 +3,10 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- 'use strict';var b=require("@lexical/react/LexicalComposerContext"),g=require("@lexical/react/useLexicalEditable"),l=require("react"),m=require("@lexical/text"),n=require("@lexical/utils"),p=require("react-dom"),t=require("@lexical/dragon"),u=require("@lexical/rich-text"),v="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?l.useLayoutEffect:l.useEffect;
8
- function w(a){return a.getEditorState().read(m.$canShowPlaceholderCurry(a.isComposing()))}function x(a){let [d,c]=l.useState(()=>w(a));v(()=>{function e(){let f=w(a);c(f)}e();return n.mergeRegister(a.registerUpdateListener(()=>{e()}),a.registerEditableListener(()=>{e()}))},[a]);return d}
9
- function y(a,d){let [c,e]=l.useState(()=>a.getDecorators());v(()=>a.registerDecoratorListener(f=>{p.flushSync(()=>{e(f)})}),[a]);l.useEffect(()=>{e(a.getDecorators())},[a]);return l.useMemo(()=>{let f=[],q=Object.keys(c);for(let h=0;h<q.length;h++){let k=q[h],A=l.createElement(d,{onError:z=>a._onError(z)},l.createElement(l.Suspense,{fallback:null},c[k])),r=a.getElementByKey(k);null!==r&&f.push(p.createPortal(A,r,k))}return f},[d,c,a])}
10
- function B(a){v(()=>n.mergeRegister(u.registerRichText(a),t.registerDragonSupport(a)),[a])}function C({content:a}){var [d]=b.useLexicalComposerContext();d=x(d);let c=g();return d?"function"===typeof a?a(c):a:null}exports.RichTextPlugin=function({contentEditable:a,placeholder:d,ErrorBoundary:c}){let [e]=b.useLexicalComposerContext();c=y(e,c);B(e);return l.createElement(l.Fragment,null,a,l.createElement(C,{content:d}),c)}
8
+
9
+ 'use strict';var b=require("@lexical/react/LexicalComposerContext"),f=require("@lexical/react/useLexicalEditable"),h=require("react"),m=require("@lexical/text"),n=require("@lexical/utils"),p=require("react-dom"),q=require("@lexical/dragon"),r=require("@lexical/rich-text"),v=Object.create(null);if(h)for(var w in h)v[w]=h[w];v.default=h;let x="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?h.useLayoutEffect:h.useEffect;
10
+ function y(a){return a.getEditorState().read(m.$canShowPlaceholderCurry(a.isComposing()))}function z(a){let [d,c]=h.useState(()=>y(a));x(()=>{function e(){let g=y(a);c(g)}e();return n.mergeRegister(a.registerUpdateListener(()=>{e()}),a.registerEditableListener(()=>{e()}))},[a]);return d}
11
+ function A(a,d){let [c,e]=h.useState(()=>a.getDecorators());x(()=>a.registerDecoratorListener(g=>{p.flushSync(()=>{e(g)})}),[a]);h.useEffect(()=>{e(a.getDecorators())},[a]);return h.useMemo(()=>{let g=[],t=Object.keys(c);for(let k=0;k<t.length;k++){let l=t[k],C=v.createElement(d,{onError:B=>a._onError(B)},v.createElement(h.Suspense,{fallback:null},c[l])),u=a.getElementByKey(l);null!==u&&g.push(p.createPortal(C,u,l))}return g},[d,c,a])}
12
+ function D(a){x(()=>n.mergeRegister(r.registerRichText(a),q.registerDragonSupport(a)),[a])}function E({content:a}){var [d]=b.useLexicalComposerContext();d=z(d);let c=f();return d?"function"===typeof a?a(c):a:null}exports.RichTextPlugin=function({contentEditable:a,placeholder:d,ErrorBoundary:c}){let [e]=b.useLexicalComposerContext();c=A(e,c);D(e);return v.createElement(v.Fragment,null,a,v.createElement(E,{content:d}),c)}
@@ -3,5 +3,7 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import t from"@lexical/react/useLexicalEditable";import*as r from"react";import{useLayoutEffect as o,useEffect as n,useState as c,useMemo as i,Suspense as l}from"react";import{$canShowPlaceholderCurry as a}from"@lexical/text";import{mergeRegister as m}from"@lexical/utils";import{createPortal as u,flushSync as s}from"react-dom";import{registerDragonSupport as f}from"@lexical/dragon";import{registerRichText as d}from"@lexical/rich-text";var p="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?o:n;function E(e){return e.getEditorState().read(a(e.isComposing()))}function x({contentEditable:t,placeholder:o,ErrorBoundary:a}){const[E]=e(),x=function(e,t){const[o,a]=c((()=>e.getDecorators()));return p((()=>e.registerDecoratorListener((e=>{s((()=>{a(e)}))}))),[e]),n((()=>{a(e.getDecorators())}),[e]),i((()=>{const n=[],c=Object.keys(o);for(let i=0;i<c.length;i++){const a=c[i],m=r.createElement(t,{onError:t=>e._onError(t)},r.createElement(l,{fallback:null},o[a])),s=e.getElementByKey(a);null!==s&&n.push(u(m,s,a))}return n}),[t,o,e])}(E,a);return function(e){p((()=>m(d(e),f(e))),[e])}(E),r.createElement(r.Fragment,null,t,r.createElement(g,{content:o}),x)}function g({content:r}){const[o]=e(),n=function(e){const[t,r]=c((()=>E(e)));return p((()=>{function t(){const t=E(e);r(t)}return t(),m(e.registerUpdateListener((()=>{t()})),e.registerEditableListener((()=>{t()})))}),[e]),t}(o),i=t();return n?"function"==typeof r?r(i):r:null}export{x as RichTextPlugin};
8
+
9
+ import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import t from"@lexical/react/useLexicalEditable";import*as r from"react";import{useLayoutEffect as o,useEffect as n,useState as c,useMemo as i,Suspense as l}from"react";import{$canShowPlaceholderCurry as a}from"@lexical/text";import{mergeRegister as m}from"@lexical/utils";import{flushSync as u,createPortal as s}from"react-dom";import{registerDragonSupport as f}from"@lexical/dragon";import{registerRichText as d}from"@lexical/rich-text";const p="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?o:n;function E(e){return e.getEditorState().read(a(e.isComposing()))}function x({contentEditable:t,placeholder:o,ErrorBoundary:a}){const[E]=e(),x=function(e,t){const[o,a]=c((()=>e.getDecorators()));return p((()=>e.registerDecoratorListener((e=>{u((()=>{a(e)}))}))),[e]),n((()=>{a(e.getDecorators())}),[e]),i((()=>{const n=[],c=Object.keys(o);for(let i=0;i<c.length;i++){const a=c[i],m=r.createElement(t,{onError:t=>e._onError(t)},r.createElement(l,{fallback:null},o[a])),u=e.getElementByKey(a);null!==u&&n.push(s(m,u,a))}return n}),[t,o,e])}(E,a);return function(e){p((()=>m(d(e),f(e))),[e])}(E),r.createElement(r.Fragment,null,t,r.createElement(g,{content:o}),x)}function g({content:r}){const[o]=e(),n=function(e){const[t,r]=c((()=>E(e)));return p((()=>{function t(){const t=E(e);r(t)}return t(),m(e.registerUpdateListener((()=>{t()})),e.registerEditableListener((()=>{t()})))}),[e]),t}(o),i=t();return n?"function"==typeof r?r(i):r:null}export{x as RichTextPlugin};
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict';
8
10
 
9
11
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
@@ -18,7 +20,8 @@ var react = require('react');
18
20
  * LICENSE file in the root directory of this source tree.
19
21
  *
20
22
  */
21
- function indentOverTab(selection) {
23
+
24
+ function $indentOverTab(selection) {
22
25
  // const handled = new Set();
23
26
  const nodes = selection.getNodes();
24
27
  const canIndentBlockNodes = utils.$filter(nodes, node => {
@@ -57,7 +60,7 @@ function registerTabIndentation(editor) {
57
60
  return false;
58
61
  }
59
62
  event.preventDefault();
60
- const command = indentOverTab(selection) ? event.shiftKey ? lexical.OUTDENT_CONTENT_COMMAND : lexical.INDENT_CONTENT_COMMAND : lexical.INSERT_TAB_COMMAND;
63
+ const command = $indentOverTab(selection) ? event.shiftKey ? lexical.OUTDENT_CONTENT_COMMAND : lexical.INDENT_CONTENT_COMMAND : lexical.INSERT_TAB_COMMAND;
61
64
  return editor.dispatchCommand(command, undefined);
62
65
  }, lexical.COMMAND_PRIORITY_EDITOR);
63
66
  }
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
10
  import { $filter, $getNearestBlockElementAncestorOrThrow } from '@lexical/utils';
9
11
  import { KEY_TAB_COMMAND, $getSelection, $isRangeSelection, OUTDENT_CONTENT_COMMAND, INDENT_CONTENT_COMMAND, INSERT_TAB_COMMAND, COMMAND_PRIORITY_EDITOR, $isBlockElementNode, $createRangeSelection, $normalizeSelection__EXPERIMENTAL } from 'lexical';
@@ -16,7 +18,8 @@ import { useEffect } from 'react';
16
18
  * LICENSE file in the root directory of this source tree.
17
19
  *
18
20
  */
19
- function indentOverTab(selection) {
21
+
22
+ function $indentOverTab(selection) {
20
23
  // const handled = new Set();
21
24
  const nodes = selection.getNodes();
22
25
  const canIndentBlockNodes = $filter(nodes, node => {
@@ -55,7 +58,7 @@ function registerTabIndentation(editor) {
55
58
  return false;
56
59
  }
57
60
  event.preventDefault();
58
- const command = indentOverTab(selection) ? event.shiftKey ? OUTDENT_CONTENT_COMMAND : INDENT_CONTENT_COMMAND : INSERT_TAB_COMMAND;
61
+ const command = $indentOverTab(selection) ? event.shiftKey ? OUTDENT_CONTENT_COMMAND : INDENT_CONTENT_COMMAND : INSERT_TAB_COMMAND;
59
62
  return editor.dispatchCommand(command, undefined);
60
63
  }, COMMAND_PRIORITY_EDITOR);
61
64
  }
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict'
8
10
  const LexicalTabIndentationPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalTabIndentationPlugin.dev.js') : require('./LexicalTabIndentationPlugin.prod.js');
9
11
  module.exports = LexicalTabIndentationPlugin;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import * as modDev from './LexicalTabIndentationPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalTabIndentationPlugin.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalTabIndentationPlugin.dev.mjs') : import('./LexicalTabIndentationPlugin.prod.mjs'));
8
10
  export const TabIndentationPlugin = mod.TabIndentationPlugin;
9
11
  export const registerTabIndentation = mod.registerTabIndentation;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict';var d=require("@lexical/react/LexicalComposerContext"),e=require("@lexical/utils"),f=require("lexical"),g=require("react");
8
10
  function h(b){var a=b.getNodes();if(0<e.$filter(a,c=>f.$isBlockElementNode(c)&&c.canIndent()?c:null).length)return!0;a=b.anchor;b=b.focus;b=b.isBefore(a)?b:a;a=b.getNode();a=e.$getNearestBlockElementAncestorOrThrow(a);if(a.canIndent()){a=a.getKey();let c=f.$createRangeSelection();c.anchor.set(a,0,"element");c.focus.set(a,0,"element");c=f.$normalizeSelection__EXPERIMENTAL(c);if(c.anchor.is(b))return!0}return!1}
9
11
  function k(b){return b.registerCommand(f.KEY_TAB_COMMAND,a=>{let c=f.$getSelection();if(!f.$isRangeSelection(c))return!1;a.preventDefault();a=h(c)?a.shiftKey?f.OUTDENT_CONTENT_COMMAND:f.INDENT_CONTENT_COMMAND:f.INSERT_TAB_COMMAND;return b.dispatchCommand(a,void 0)},f.COMMAND_PRIORITY_EDITOR)}exports.TabIndentationPlugin=function(){let [b]=d.useLexicalComposerContext();g.useEffect(()=>k(b));return null};exports.registerTabIndentation=k
@@ -3,5 +3,7 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{$filter as t,$getNearestBlockElementAncestorOrThrow as n}from"@lexical/utils";import{KEY_TAB_COMMAND as r,$getSelection as o,$isRangeSelection as c,OUTDENT_CONTENT_COMMAND as i,INDENT_CONTENT_COMMAND as s,INSERT_TAB_COMMAND as l,COMMAND_PRIORITY_EDITOR as f,$isBlockElementNode as u,$createRangeSelection as a,$normalizeSelection__EXPERIMENTAL as m}from"lexical";import{useEffect as d}from"react";function p(e){return e.registerCommand(r,(r=>{const f=o();if(!c(f))return!1;r.preventDefault();const d=function(e){const r=e.getNodes();if(t(r,(e=>u(e)&&e.canIndent()?e:null)).length>0)return!0;const o=e.anchor,c=e.focus,i=c.isBefore(o)?c:o,s=i.getNode(),l=n(s);if(l.canIndent()){const e=l.getKey();let t=a();if(t.anchor.set(e,0,"element"),t.focus.set(e,0,"element"),t=m(t),t.anchor.is(i))return!0}return!1}(f)?r.shiftKey?i:s:l;return e.dispatchCommand(d,void 0)}),f)}function h(){const[t]=e();return d((()=>p(t))),null}export{h as TabIndentationPlugin,p as registerTabIndentation};
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
  /// <reference types="react" />
9
- import type { LexicalEditor, NodeKey } from 'lexical';
10
9
  import { HeadingTagType } from '@lexical/rich-text';
10
+ import { LexicalEditor, NodeKey } from 'lexical';
11
11
  export type TableOfContentsEntry = [
12
12
  key: NodeKey,
13
13
  text: string,