@lexical/react 0.14.5 → 0.16.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 (310) hide show
  1. package/LexicalAutoEmbedPlugin.dev.js +15 -11
  2. package/LexicalAutoEmbedPlugin.dev.mjs +5 -2
  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 -5
  7. package/LexicalAutoEmbedPlugin.prod.mjs +3 -1
  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 +14 -9
  23. package/LexicalBlockWithAlignableContents.dev.mjs +11 -7
  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 +3 -1
  29. package/LexicalCharacterLimitPlugin.dev.js +17 -12
  30. package/LexicalCharacterLimitPlugin.dev.mjs +12 -8
  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 +5 -0
  37. package/LexicalCheckListPlugin.dev.mjs +5 -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 +4 -2
  42. package/LexicalCheckListPlugin.prod.mjs +3 -1
  43. package/LexicalClearEditorPlugin.dev.js +9 -2
  44. package/LexicalClearEditorPlugin.dev.mjs +11 -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.d.ts +3 -1
  51. package/LexicalClickableLinkPlugin.dev.js +17 -15
  52. package/LexicalClickableLinkPlugin.dev.mjs +16 -15
  53. package/LexicalClickableLinkPlugin.js +2 -0
  54. package/LexicalClickableLinkPlugin.js.flow +3 -1
  55. package/LexicalClickableLinkPlugin.mjs +3 -0
  56. package/LexicalClickableLinkPlugin.node.mjs +3 -0
  57. package/LexicalClickableLinkPlugin.prod.js +6 -4
  58. package/LexicalClickableLinkPlugin.prod.mjs +3 -1
  59. package/LexicalCollaborationContext.dev.js +3 -0
  60. package/LexicalCollaborationContext.dev.mjs +3 -0
  61. package/LexicalCollaborationContext.js +2 -0
  62. package/LexicalCollaborationContext.mjs +2 -0
  63. package/LexicalCollaborationContext.node.mjs +2 -0
  64. package/LexicalCollaborationContext.prod.js +2 -0
  65. package/LexicalCollaborationContext.prod.mjs +2 -0
  66. package/LexicalCollaborationPlugin.dev.js +20 -2
  67. package/LexicalCollaborationPlugin.dev.mjs +6 -1
  68. package/LexicalCollaborationPlugin.js +2 -0
  69. package/LexicalCollaborationPlugin.mjs +2 -0
  70. package/LexicalCollaborationPlugin.node.mjs +2 -0
  71. package/LexicalCollaborationPlugin.prod.js +12 -10
  72. package/LexicalCollaborationPlugin.prod.mjs +3 -1
  73. package/LexicalComposer.dev.js +17 -8
  74. package/LexicalComposer.dev.mjs +16 -8
  75. package/LexicalComposer.js +2 -0
  76. package/LexicalComposer.mjs +2 -0
  77. package/LexicalComposer.node.mjs +2 -0
  78. package/LexicalComposer.prod.js +5 -4
  79. package/LexicalComposer.prod.mjs +3 -1
  80. package/LexicalComposerContext.dev.js +3 -0
  81. package/LexicalComposerContext.dev.mjs +3 -0
  82. package/LexicalComposerContext.js +2 -0
  83. package/LexicalComposerContext.mjs +2 -0
  84. package/LexicalComposerContext.node.mjs +2 -0
  85. package/LexicalComposerContext.prod.js +4 -2
  86. package/LexicalComposerContext.prod.mjs +3 -1
  87. package/LexicalContentEditable.dev.js +24 -23
  88. package/LexicalContentEditable.dev.mjs +22 -22
  89. package/LexicalContentEditable.js +2 -0
  90. package/LexicalContentEditable.mjs +2 -0
  91. package/LexicalContentEditable.node.mjs +2 -0
  92. package/LexicalContentEditable.prod.js +5 -3
  93. package/LexicalContentEditable.prod.mjs +3 -1
  94. package/LexicalContextMenuPlugin.dev.js +29 -7
  95. package/LexicalContextMenuPlugin.dev.mjs +17 -8
  96. package/LexicalContextMenuPlugin.js +2 -0
  97. package/LexicalContextMenuPlugin.js.flow +12 -0
  98. package/LexicalContextMenuPlugin.mjs +2 -0
  99. package/LexicalContextMenuPlugin.node.mjs +2 -0
  100. package/LexicalContextMenuPlugin.prod.js +18 -16
  101. package/LexicalContextMenuPlugin.prod.mjs +3 -1
  102. package/LexicalDecoratorBlockNode.d.ts +1 -0
  103. package/LexicalDecoratorBlockNode.dev.js +6 -0
  104. package/LexicalDecoratorBlockNode.dev.mjs +6 -0
  105. package/LexicalDecoratorBlockNode.js +2 -0
  106. package/LexicalDecoratorBlockNode.mjs +2 -0
  107. package/LexicalDecoratorBlockNode.node.mjs +2 -0
  108. package/LexicalDecoratorBlockNode.prod.js +3 -1
  109. package/LexicalDecoratorBlockNode.prod.mjs +3 -1
  110. package/LexicalEditorRefPlugin.dev.js +17 -1
  111. package/LexicalEditorRefPlugin.dev.mjs +3 -0
  112. package/LexicalEditorRefPlugin.js +2 -0
  113. package/LexicalEditorRefPlugin.js.flow +19 -0
  114. package/LexicalEditorRefPlugin.mjs +2 -0
  115. package/LexicalEditorRefPlugin.node.mjs +2 -0
  116. package/LexicalEditorRefPlugin.prod.js +3 -1
  117. package/LexicalEditorRefPlugin.prod.mjs +2 -0
  118. package/LexicalErrorBoundary.d.ts +3 -1
  119. package/LexicalErrorBoundary.dev.js +30 -10
  120. package/LexicalErrorBoundary.dev.mjs +13 -7
  121. package/LexicalErrorBoundary.js +2 -0
  122. package/LexicalErrorBoundary.js.flow +4 -1
  123. package/LexicalErrorBoundary.mjs +3 -0
  124. package/LexicalErrorBoundary.node.mjs +3 -0
  125. package/LexicalErrorBoundary.prod.js +6 -4
  126. package/LexicalErrorBoundary.prod.mjs +3 -1
  127. package/LexicalHashtagPlugin.dev.js +5 -2
  128. package/LexicalHashtagPlugin.dev.mjs +5 -2
  129. package/LexicalHashtagPlugin.js +2 -0
  130. package/LexicalHashtagPlugin.mjs +2 -0
  131. package/LexicalHashtagPlugin.node.mjs +2 -0
  132. package/LexicalHashtagPlugin.prod.js +2 -0
  133. package/LexicalHashtagPlugin.prod.mjs +2 -0
  134. package/LexicalHistoryPlugin.dev.js +4 -0
  135. package/LexicalHistoryPlugin.dev.mjs +4 -0
  136. package/LexicalHistoryPlugin.js +2 -0
  137. package/LexicalHistoryPlugin.mjs +2 -0
  138. package/LexicalHistoryPlugin.node.mjs +2 -0
  139. package/LexicalHistoryPlugin.prod.js +2 -0
  140. package/LexicalHistoryPlugin.prod.mjs +2 -0
  141. package/LexicalHorizontalRuleNode.d.ts +2 -2
  142. package/LexicalHorizontalRuleNode.dev.js +23 -12
  143. package/LexicalHorizontalRuleNode.dev.mjs +21 -11
  144. package/LexicalHorizontalRuleNode.js +2 -0
  145. package/LexicalHorizontalRuleNode.mjs +2 -0
  146. package/LexicalHorizontalRuleNode.node.mjs +2 -0
  147. package/LexicalHorizontalRuleNode.prod.js +7 -5
  148. package/LexicalHorizontalRuleNode.prod.mjs +3 -1
  149. package/LexicalHorizontalRulePlugin.dev.js +3 -0
  150. package/LexicalHorizontalRulePlugin.dev.mjs +3 -0
  151. package/LexicalHorizontalRulePlugin.js +2 -0
  152. package/LexicalHorizontalRulePlugin.mjs +2 -0
  153. package/LexicalHorizontalRulePlugin.node.mjs +2 -0
  154. package/LexicalHorizontalRulePlugin.prod.js +2 -0
  155. package/LexicalHorizontalRulePlugin.prod.mjs +2 -0
  156. package/LexicalLinkPlugin.dev.js +6 -3
  157. package/LexicalLinkPlugin.dev.mjs +7 -4
  158. package/LexicalLinkPlugin.js +2 -0
  159. package/LexicalLinkPlugin.mjs +2 -0
  160. package/LexicalLinkPlugin.node.mjs +2 -0
  161. package/LexicalLinkPlugin.prod.js +3 -1
  162. package/LexicalLinkPlugin.prod.mjs +3 -1
  163. package/LexicalListPlugin.dev.js +4 -0
  164. package/LexicalListPlugin.dev.mjs +4 -0
  165. package/LexicalListPlugin.js +2 -0
  166. package/LexicalListPlugin.mjs +2 -0
  167. package/LexicalListPlugin.node.mjs +2 -0
  168. package/LexicalListPlugin.prod.js +2 -0
  169. package/LexicalListPlugin.prod.mjs +2 -0
  170. package/LexicalMarkdownShortcutPlugin.dev.js +3 -0
  171. package/LexicalMarkdownShortcutPlugin.dev.mjs +3 -0
  172. package/LexicalMarkdownShortcutPlugin.js +2 -0
  173. package/LexicalMarkdownShortcutPlugin.mjs +2 -0
  174. package/LexicalMarkdownShortcutPlugin.node.mjs +2 -0
  175. package/LexicalMarkdownShortcutPlugin.prod.js +2 -0
  176. package/LexicalMarkdownShortcutPlugin.prod.mjs +2 -0
  177. package/LexicalNestedComposer.dev.js +14 -9
  178. package/LexicalNestedComposer.dev.mjs +8 -4
  179. package/LexicalNestedComposer.js +2 -0
  180. package/LexicalNestedComposer.mjs +2 -0
  181. package/LexicalNestedComposer.node.mjs +2 -0
  182. package/LexicalNestedComposer.prod.js +7 -5
  183. package/LexicalNestedComposer.prod.mjs +3 -1
  184. package/LexicalNodeEventPlugin.dev.js +3 -0
  185. package/LexicalNodeEventPlugin.dev.mjs +3 -0
  186. package/LexicalNodeEventPlugin.js +2 -0
  187. package/LexicalNodeEventPlugin.js.flow +12 -0
  188. package/LexicalNodeEventPlugin.mjs +2 -0
  189. package/LexicalNodeEventPlugin.node.mjs +2 -0
  190. package/LexicalNodeEventPlugin.prod.js +2 -0
  191. package/LexicalNodeEventPlugin.prod.mjs +2 -0
  192. package/LexicalNodeMenuPlugin.dev.js +30 -8
  193. package/LexicalNodeMenuPlugin.dev.mjs +17 -8
  194. package/LexicalNodeMenuPlugin.js +2 -0
  195. package/LexicalNodeMenuPlugin.mjs +2 -0
  196. package/LexicalNodeMenuPlugin.node.mjs +2 -0
  197. package/LexicalNodeMenuPlugin.prod.js +17 -15
  198. package/LexicalNodeMenuPlugin.prod.mjs +3 -1
  199. package/LexicalOnChangePlugin.dev.js +9 -2
  200. package/LexicalOnChangePlugin.dev.mjs +11 -4
  201. package/LexicalOnChangePlugin.js +2 -0
  202. package/LexicalOnChangePlugin.mjs +2 -0
  203. package/LexicalOnChangePlugin.node.mjs +2 -0
  204. package/LexicalOnChangePlugin.prod.js +3 -1
  205. package/LexicalOnChangePlugin.prod.mjs +3 -1
  206. package/LexicalPlainTextPlugin.dev.js +34 -19
  207. package/LexicalPlainTextPlugin.dev.mjs +31 -17
  208. package/LexicalPlainTextPlugin.js +2 -0
  209. package/LexicalPlainTextPlugin.js.flow +1 -1
  210. package/LexicalPlainTextPlugin.mjs +2 -0
  211. package/LexicalPlainTextPlugin.node.mjs +2 -0
  212. package/LexicalPlainTextPlugin.prod.js +6 -4
  213. package/LexicalPlainTextPlugin.prod.mjs +3 -1
  214. package/LexicalRichTextPlugin.dev.js +34 -19
  215. package/LexicalRichTextPlugin.dev.mjs +31 -17
  216. package/LexicalRichTextPlugin.js +2 -0
  217. package/LexicalRichTextPlugin.js.flow +1 -1
  218. package/LexicalRichTextPlugin.mjs +2 -0
  219. package/LexicalRichTextPlugin.node.mjs +2 -0
  220. package/LexicalRichTextPlugin.prod.js +6 -4
  221. package/LexicalRichTextPlugin.prod.mjs +3 -1
  222. package/LexicalTabIndentationPlugin.dev.js +5 -2
  223. package/LexicalTabIndentationPlugin.dev.mjs +5 -2
  224. package/LexicalTabIndentationPlugin.js +2 -0
  225. package/LexicalTabIndentationPlugin.mjs +2 -0
  226. package/LexicalTabIndentationPlugin.node.mjs +2 -0
  227. package/LexicalTabIndentationPlugin.prod.js +2 -0
  228. package/LexicalTabIndentationPlugin.prod.mjs +2 -0
  229. package/LexicalTableOfContents.d.ts +6 -13
  230. package/LexicalTableOfContents.dev.js +57 -10
  231. package/LexicalTableOfContents.dev.mjs +58 -11
  232. package/LexicalTableOfContents.js +2 -0
  233. package/LexicalTableOfContents.js.flow +3 -7
  234. package/LexicalTableOfContents.mjs +2 -0
  235. package/LexicalTableOfContents.node.mjs +2 -0
  236. package/LexicalTableOfContents.prod.js +6 -4
  237. package/LexicalTableOfContents.prod.mjs +3 -1
  238. package/LexicalTableOfContentsPlugin.d.ts +20 -0
  239. package/LexicalTableOfContentsPlugin.dev.js +198 -0
  240. package/LexicalTableOfContentsPlugin.dev.mjs +196 -0
  241. package/LexicalTableOfContentsPlugin.js +11 -0
  242. package/LexicalTableOfContentsPlugin.js.flow +18 -0
  243. package/LexicalTableOfContentsPlugin.mjs +12 -0
  244. package/LexicalTableOfContentsPlugin.node.mjs +10 -0
  245. package/LexicalTableOfContentsPlugin.prod.js +12 -0
  246. package/LexicalTableOfContentsPlugin.prod.mjs +9 -0
  247. package/LexicalTablePlugin.dev.js +28 -2
  248. package/LexicalTablePlugin.dev.mjs +31 -5
  249. package/LexicalTablePlugin.js +2 -0
  250. package/LexicalTablePlugin.mjs +2 -0
  251. package/LexicalTablePlugin.node.mjs +2 -0
  252. package/LexicalTablePlugin.prod.js +9 -5
  253. package/LexicalTablePlugin.prod.mjs +3 -1
  254. package/LexicalTreeView.d.ts +3 -1
  255. package/LexicalTreeView.dev.js +22 -4
  256. package/LexicalTreeView.dev.mjs +8 -3
  257. package/LexicalTreeView.js +2 -0
  258. package/LexicalTreeView.js.flow +2 -0
  259. package/LexicalTreeView.mjs +2 -0
  260. package/LexicalTreeView.node.mjs +2 -0
  261. package/LexicalTreeView.prod.js +5 -3
  262. package/LexicalTreeView.prod.mjs +3 -1
  263. package/LexicalTypeaheadMenuPlugin.dev.js +30 -8
  264. package/LexicalTypeaheadMenuPlugin.dev.mjs +17 -8
  265. package/LexicalTypeaheadMenuPlugin.js +2 -0
  266. package/LexicalTypeaheadMenuPlugin.mjs +2 -0
  267. package/LexicalTypeaheadMenuPlugin.node.mjs +2 -0
  268. package/LexicalTypeaheadMenuPlugin.prod.js +21 -19
  269. package/LexicalTypeaheadMenuPlugin.prod.mjs +3 -1
  270. package/package.json +50 -20
  271. package/shared/useCharacterLimit.d.ts +1 -1
  272. package/useLexicalEditable.d.ts +11 -1
  273. package/useLexicalEditable.dev.js +22 -3
  274. package/useLexicalEditable.dev.mjs +23 -5
  275. package/useLexicalEditable.js +2 -0
  276. package/useLexicalEditable.js.flow +4 -1
  277. package/useLexicalEditable.mjs +4 -1
  278. package/useLexicalEditable.node.mjs +4 -1
  279. package/useLexicalEditable.prod.js +4 -2
  280. package/useLexicalEditable.prod.mjs +3 -1
  281. package/useLexicalIsTextContentEmpty.dev.js +9 -2
  282. package/useLexicalIsTextContentEmpty.dev.mjs +11 -4
  283. package/useLexicalIsTextContentEmpty.js +2 -0
  284. package/useLexicalIsTextContentEmpty.mjs +2 -0
  285. package/useLexicalIsTextContentEmpty.node.mjs +2 -0
  286. package/useLexicalIsTextContentEmpty.prod.js +3 -1
  287. package/useLexicalIsTextContentEmpty.prod.mjs +3 -1
  288. package/useLexicalNodeSelection.dev.js +3 -0
  289. package/useLexicalNodeSelection.dev.mjs +4 -1
  290. package/useLexicalNodeSelection.js +2 -0
  291. package/useLexicalNodeSelection.mjs +2 -0
  292. package/useLexicalNodeSelection.node.mjs +2 -0
  293. package/useLexicalNodeSelection.prod.js +2 -0
  294. package/useLexicalNodeSelection.prod.mjs +3 -1
  295. package/useLexicalSubscription.d.ts +4 -1
  296. package/useLexicalSubscription.dev.js +12 -3
  297. package/useLexicalSubscription.dev.mjs +13 -5
  298. package/useLexicalSubscription.js +2 -0
  299. package/useLexicalSubscription.js.flow +4 -1
  300. package/useLexicalSubscription.mjs +4 -1
  301. package/useLexicalSubscription.node.mjs +4 -1
  302. package/useLexicalSubscription.prod.js +4 -2
  303. package/useLexicalSubscription.prod.mjs +3 -1
  304. package/useLexicalTextEntity.dev.js +3 -0
  305. package/useLexicalTextEntity.dev.mjs +3 -0
  306. package/useLexicalTextEntity.js +2 -0
  307. package/useLexicalTextEntity.mjs +2 -0
  308. package/useLexicalTextEntity.node.mjs +2 -0
  309. package/useLexicalTextEntity.prod.js +2 -0
  310. package/useLexicalTextEntity.prod.mjs +2 -0
@@ -3,13 +3,29 @@
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');
10
12
  var utils = require('@lexical/utils');
11
13
  var lexical = require('lexical');
12
14
  var React = require('react');
15
+ var jsxRuntime = require('react/jsx-runtime');
16
+
17
+ function _interopNamespaceDefault(e) {
18
+ var n = Object.create(null);
19
+ if (e) {
20
+ for (var k in e) {
21
+ n[k] = e[k];
22
+ }
23
+ }
24
+ n.default = e;
25
+ return n;
26
+ }
27
+
28
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
13
29
 
14
30
  /**
15
31
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -28,8 +44,12 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
28
44
  * LICENSE file in the root directory of this source tree.
29
45
  *
30
46
  */
47
+
48
+
49
+ // This workaround is no longer necessary in React 19,
50
+ // but we currently support React >=17.x
51
+ // https://github.com/facebook/react/pull/26395
31
52
  const useLayoutEffectImpl = CAN_USE_DOM ? React.useLayoutEffect : React.useEffect;
32
- var useLayoutEffect = useLayoutEffectImpl;
33
53
 
34
54
  /**
35
55
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -38,6 +58,7 @@ var useLayoutEffect = useLayoutEffectImpl;
38
58
  * LICENSE file in the root directory of this source tree.
39
59
  *
40
60
  */
61
+
41
62
  class MenuOption {
42
63
  constructor(key) {
43
64
  this.key = key;
@@ -125,7 +146,7 @@ function $splitNodeContainingQuery(match) {
125
146
  function getScrollParent(element, includeHidden) {
126
147
  let style = getComputedStyle(element);
127
148
  const excludeStaticParent = style.position === 'absolute';
128
- const overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/;
149
+ const overflowRegex = /(auto|scroll)/;
129
150
  if (style.position === 'fixed') {
130
151
  return document.body;
131
152
  }
@@ -152,7 +173,7 @@ function useDynamicPositioning(resolution, targetElement, onReposition, onVisibi
152
173
  React.useEffect(() => {
153
174
  if (targetElement != null && resolution != null) {
154
175
  const rootElement = editor.getRootElement();
155
- const rootScrollParent = rootElement != null ? getScrollParent(rootElement, false) : document.body;
176
+ const rootScrollParent = rootElement != null ? getScrollParent(rootElement) : document.body;
156
177
  let ticking = false;
157
178
  let previousIsInView = isTriggerVisibleInNearestScrollContainer(targetElement, rootScrollParent);
158
179
  const handleScroll = function () {
@@ -224,7 +245,7 @@ function LexicalMenu({
224
245
  }
225
246
  };
226
247
  }, [editor]);
227
- useLayoutEffect(() => {
248
+ useLayoutEffectImpl(() => {
228
249
  if (options === null) {
229
250
  setHighlightedIndex(null);
230
251
  } else if (selectedIndex === null) {
@@ -336,7 +357,7 @@ function useMenuAnchorRef(resolution, setResolution, className, parent = documen
336
357
  if (left + menuWidth > rootElementRect.right) {
337
358
  containerDiv.style.left = `${rootElementRect.right - menuWidth + window.pageXOffset}px`;
338
359
  }
339
- if ((top + menuHeight > window.innerHeight || top + menuHeight > rootElementRect.bottom) && top - rootElementRect.top > menuHeight) {
360
+ if ((top + menuHeight > window.innerHeight || top + menuHeight > rootElementRect.bottom) && top - rootElementRect.top > menuHeight + height) {
340
361
  containerDiv.style.top = `${top - menuHeight + window.pageYOffset - height}px`;
341
362
  }
342
363
  }
@@ -388,6 +409,7 @@ function useMenuAnchorRef(resolution, setResolution, className, parent = documen
388
409
  * LICENSE file in the root directory of this source tree.
389
410
  *
390
411
  */
412
+
391
413
  const PRE_PORTAL_DIV_SIZE = 1;
392
414
  function LexicalContextMenuPlugin({
393
415
  options,
@@ -402,7 +424,7 @@ function LexicalContextMenuPlugin({
402
424
  }) {
403
425
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
404
426
  const [resolution, setResolution] = React.useState(null);
405
- const menuRef = React.useRef(null);
427
+ const menuRef = React__namespace.useRef(null);
406
428
  const anchorElementRef = useMenuAnchorRef(resolution, setResolution, anchorClassName, parent);
407
429
  const closeNodeMenu = React.useCallback(() => {
408
430
  setResolution(null);
@@ -442,7 +464,7 @@ function LexicalContextMenuPlugin({
442
464
  document.addEventListener('click', handleClick);
443
465
  return () => document.removeEventListener('click', handleClick);
444
466
  }, [editor, handleClick]);
445
- return resolution === null || editor === null ? null : /*#__PURE__*/React.createElement(LexicalMenu, {
467
+ return resolution === null || editor === null ? null : /*#__PURE__*/jsxRuntime.jsx(LexicalMenu, {
446
468
  close: closeNodeMenu,
447
469
  resolution: resolution,
448
470
  editor: editor,
@@ -3,12 +3,15 @@
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 { mergeRegister, calculateZoomLevel } from '@lexical/utils';
9
11
  import { createCommand, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND, KEY_ENTER_COMMAND, COMMAND_PRIORITY_LOW, $getSelection, $isRangeSelection } from 'lexical';
10
12
  import * as React from 'react';
11
- import { useLayoutEffect as useLayoutEffect$1, useEffect, useState, useCallback, useMemo, useRef } from 'react';
13
+ import { useLayoutEffect, useEffect, useState, useCallback, useMemo, useRef } from 'react';
14
+ import { jsx } from 'react/jsx-runtime';
12
15
 
13
16
  /**
14
17
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -27,8 +30,12 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
27
30
  * LICENSE file in the root directory of this source tree.
28
31
  *
29
32
  */
30
- const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect$1 : useEffect;
31
- var useLayoutEffect = useLayoutEffectImpl;
33
+
34
+
35
+ // This workaround is no longer necessary in React 19,
36
+ // but we currently support React >=17.x
37
+ // https://github.com/facebook/react/pull/26395
38
+ const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
32
39
 
33
40
  /**
34
41
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -37,6 +44,7 @@ var useLayoutEffect = useLayoutEffectImpl;
37
44
  * LICENSE file in the root directory of this source tree.
38
45
  *
39
46
  */
47
+
40
48
  class MenuOption {
41
49
  constructor(key) {
42
50
  this.key = key;
@@ -124,7 +132,7 @@ function $splitNodeContainingQuery(match) {
124
132
  function getScrollParent(element, includeHidden) {
125
133
  let style = getComputedStyle(element);
126
134
  const excludeStaticParent = style.position === 'absolute';
127
- const overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/;
135
+ const overflowRegex = /(auto|scroll)/;
128
136
  if (style.position === 'fixed') {
129
137
  return document.body;
130
138
  }
@@ -151,7 +159,7 @@ function useDynamicPositioning(resolution, targetElement, onReposition, onVisibi
151
159
  useEffect(() => {
152
160
  if (targetElement != null && resolution != null) {
153
161
  const rootElement = editor.getRootElement();
154
- const rootScrollParent = rootElement != null ? getScrollParent(rootElement, false) : document.body;
162
+ const rootScrollParent = rootElement != null ? getScrollParent(rootElement) : document.body;
155
163
  let ticking = false;
156
164
  let previousIsInView = isTriggerVisibleInNearestScrollContainer(targetElement, rootScrollParent);
157
165
  const handleScroll = function () {
@@ -223,7 +231,7 @@ function LexicalMenu({
223
231
  }
224
232
  };
225
233
  }, [editor]);
226
- useLayoutEffect(() => {
234
+ useLayoutEffectImpl(() => {
227
235
  if (options === null) {
228
236
  setHighlightedIndex(null);
229
237
  } else if (selectedIndex === null) {
@@ -335,7 +343,7 @@ function useMenuAnchorRef(resolution, setResolution, className, parent = documen
335
343
  if (left + menuWidth > rootElementRect.right) {
336
344
  containerDiv.style.left = `${rootElementRect.right - menuWidth + window.pageXOffset}px`;
337
345
  }
338
- if ((top + menuHeight > window.innerHeight || top + menuHeight > rootElementRect.bottom) && top - rootElementRect.top > menuHeight) {
346
+ if ((top + menuHeight > window.innerHeight || top + menuHeight > rootElementRect.bottom) && top - rootElementRect.top > menuHeight + height) {
339
347
  containerDiv.style.top = `${top - menuHeight + window.pageYOffset - height}px`;
340
348
  }
341
349
  }
@@ -387,6 +395,7 @@ function useMenuAnchorRef(resolution, setResolution, className, parent = documen
387
395
  * LICENSE file in the root directory of this source tree.
388
396
  *
389
397
  */
398
+
390
399
  const PRE_PORTAL_DIV_SIZE = 1;
391
400
  function LexicalContextMenuPlugin({
392
401
  options,
@@ -441,7 +450,7 @@ function LexicalContextMenuPlugin({
441
450
  document.addEventListener('click', handleClick);
442
451
  return () => document.removeEventListener('click', handleClick);
443
452
  }, [editor, handleClick]);
444
- return resolution === null || editor === null ? null : /*#__PURE__*/React.createElement(LexicalMenu, {
453
+ return resolution === null || editor === null ? null : /*#__PURE__*/jsx(LexicalMenu, {
445
454
  close: closeNodeMenu,
446
455
  resolution: resolution,
447
456
  editor: editor,
@@ -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 LexicalContextMenuPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalContextMenuPlugin.dev.js') : require('./LexicalContextMenuPlugin.prod.js');
9
11
  module.exports = LexicalContextMenuPlugin;
@@ -0,0 +1,12 @@
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
+ * @flow strict
8
+ */
9
+
10
+ /**
11
+ * LexicalContextMenuPlugin
12
+ */
@@ -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 './LexicalContextMenuPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalContextMenuPlugin.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('./LexicalContextMenuPlugin.dev.mjs') : import('./LexicalContextMenuPlugin.prod.mjs'));
8
10
  export const LexicalContextMenuPlugin = mod.LexicalContextMenuPlugin;
9
11
  export const MenuOption = mod.MenuOption;
@@ -3,20 +3,22 @@
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 h=require("@lexical/react/LexicalComposerContext"),w=require("@lexical/utils"),z=require("lexical"),A=require("react"),B="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?A.useLayoutEffect:A.useEffect;class C{constructor(c){this.key=c;this.ref={current:null};this.setRefElement=this.setRefElement.bind(this)}setRefElement(c){this.ref={current:c}}}
8
- let D=c=>{const a=document.getElementById("typeahead-menu");if(a){var d=a.getBoundingClientRect();d.top+d.height>window.innerHeight&&a.scrollIntoView({block:"center"});0>d.top&&a.scrollIntoView({block:"center"});c.scrollIntoView({block:"nearest"})}};
9
- function E(c){var a=z.$getSelection();if(!z.$isRangeSelection(a)||!a.isCollapsed())return null;var d=a.anchor;if("text"!==d.type)return null;a=d.getNode();if(!a.isSimpleText())return null;d=d.offset;let k=a.getTextContent().slice(0,d);var e=c.matchingString;c=c.replaceableString.length;for(let n=c;n<=e.length;n++)k.substr(-n)===e.substr(0,n)&&(c=n);c=d-c;if(0>c)return null;let p;0===c?[p]=a.splitText(d):[,p]=a.splitText(c,d);return p}
10
- function F(c,a){let d=getComputedStyle(c),k="absolute"===d.position;a=a?/(auto|scroll|hidden)/:/(auto|scroll)/;if("fixed"===d.position)return document.body;for(;c=c.parentElement;)if(d=getComputedStyle(c),(!k||"static"!==d.position)&&a.test(d.overflow+d.overflowY+d.overflowX))return c;return document.body}function G(c,a){c=c.getBoundingClientRect();a=a.getBoundingClientRect();return c.top>a.top&&c.top<a.bottom}
11
- function H(c,a,d,k){let [e]=h.useLexicalComposerContext();A.useEffect(()=>{if(null!=a&&null!=c){let p=e.getRootElement(),n=null!=p?F(p,!1):document.body,x=!1,l=G(a,n),b=function(){x||(window.requestAnimationFrame(function(){d();x=!1}),x=!0);const q=G(a,n);q!==l&&(l=q,null!=k&&k(q))},g=new ResizeObserver(d);window.addEventListener("resize",d);document.addEventListener("scroll",b,{capture:!0,passive:!0});g.observe(a);return()=>{g.unobserve(a);window.removeEventListener("resize",d);document.removeEventListener("scroll",
12
- b,!0)}}},[a,e,k,d,c])}let I=z.createCommand("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");
13
- function J({close:c,editor:a,anchorElementRef:d,resolution:k,options:e,menuRenderFn:p,onSelectOption:n,shouldSplitNodeWithQuery:x=!1,commandPriority:l=z.COMMAND_PRIORITY_LOW}){let [b,g]=A.useState(null);A.useEffect(()=>{g(0)},[k.match&&k.match.matchingString]);let q=A.useCallback(f=>{a.update(()=>{const m=null!=k.match&&x?E(k.match):null;n(f,m,c,k.match?k.match.matchingString:"")})},[a,x,k.match,n,c]),t=A.useCallback(f=>{const m=a.getRootElement();null!==m&&(m.setAttribute("aria-activedescendant",
14
- "typeahead-item-"+f),g(f))},[a]);A.useEffect(()=>()=>{let f=a.getRootElement();null!==f&&f.removeAttribute("aria-activedescendant")},[a]);B(()=>{null===e?g(null):null===b&&t(0)},[e,b,t]);A.useEffect(()=>w.mergeRegister(a.registerCommand(I,({option:f})=>f.ref&&null!=f.ref.current?(D(f.ref.current),!0):!1,l)),[a,t,l]);A.useEffect(()=>w.mergeRegister(a.registerCommand(z.KEY_ARROW_DOWN_COMMAND,f=>{if(null!==e&&e.length&&null!==b){let m=b!==e.length-1?b+1:0;t(m);let u=e[m];null!=u.ref&&u.ref.current&&
15
- a.dispatchCommand(I,{index:m,option:u});f.preventDefault();f.stopImmediatePropagation()}return!0},l),a.registerCommand(z.KEY_ARROW_UP_COMMAND,f=>{if(null!==e&&e.length&&null!==b){var m=0!==b?b-1:e.length-1;t(m);m=e[m];null!=m.ref&&m.ref.current&&D(m.ref.current);f.preventDefault();f.stopImmediatePropagation()}return!0},l),a.registerCommand(z.KEY_ESCAPE_COMMAND,f=>{f.preventDefault();f.stopImmediatePropagation();c();return!0},l),a.registerCommand(z.KEY_TAB_COMMAND,f=>{if(null===e||null===b||null==
16
- e[b])return!1;f.preventDefault();f.stopImmediatePropagation();q(e[b]);return!0},l),a.registerCommand(z.KEY_ENTER_COMMAND,f=>{if(null===e||null===b||null==e[b])return!1;null!==f&&(f.preventDefault(),f.stopImmediatePropagation());q(e[b]);return!0},l)),[q,c,a,e,b,t,l]);let v=A.useMemo(()=>({options:e,selectOptionAndCleanUp:q,selectedIndex:b,setHighlightedIndex:g}),[q,b,e]);return p(d,v,k.match?k.match.matchingString:"")}
17
- function K(c,a,d,k=document.body){let [e]=h.useLexicalComposerContext(),p=A.useRef(document.createElement("div")),n=A.useCallback(()=>{p.current.style.top=p.current.style.bottom;const l=e.getRootElement(),b=p.current;var g=b.firstChild;if(null!==l&&null!==c){const {left:t,top:v,width:f,height:m}=c.getRect();b.style.top=`${v+window.pageYOffset+p.current.offsetHeight+3}px`;b.style.left=`${t+window.pageXOffset}px`;b.style.height=`${m}px`;b.style.width=`${f}px`;if(null!==g){g.style.top=`${v}`;var q=g.getBoundingClientRect();
18
- g=q.height;q=q.width;const u=l.getBoundingClientRect();t+q>u.right&&(b.style.left=`${u.right-q+window.pageXOffset}px`);(v+g>window.innerHeight||v+g>u.bottom)&&v-u.top>g&&(b.style.top=`${v-g+window.pageYOffset-m}px`)}b.isConnected||(null!=d&&(b.className=d),b.setAttribute("aria-label","Typeahead menu"),b.setAttribute("id","typeahead-menu"),b.setAttribute("role","listbox"),b.style.display="block",b.style.position="absolute",k.append(b));p.current=b;l.setAttribute("aria-controls","typeahead-menu")}},
19
- [e,c,d,k]);A.useEffect(()=>{let l=e.getRootElement();if(null!==c)return n(),()=>{null!==l&&l.removeAttribute("aria-controls");let b=p.current;null!==b&&b.isConnected&&b.remove()}},[e,n,c]);let x=A.useCallback(l=>{null!==c&&(l||a(null))},[c,a]);H(c,p.current,n,x);return p}
20
- exports.LexicalContextMenuPlugin=function({options:c,onWillOpen:a,onClose:d,onOpen:k,onSelectOption:e,menuRenderFn:p,anchorClassName:n,commandPriority:x=z.COMMAND_PRIORITY_LOW,parent:l}){let [b]=h.useLexicalComposerContext(),[g,q]=A.useState(null),t=A.useRef(null);n=K(g,q,n,l);let v=A.useCallback(()=>{q(null);null!=d&&null!==g&&d()},[d,g]),f=A.useCallback(r=>{q(r);null!=k&&null===g&&k(r)},[k,g]),m=A.useCallback(r=>{r.preventDefault();null!=a&&a(r);const y=w.calculateZoomLevel(r.target);f({getRect:()=>
21
- new DOMRect(r.clientX/y,r.clientY/y,1,1)})},[f,a]),u=A.useCallback(r=>{null===g||null==t.current||null==r.target||t.current.contains(r.target)||v()},[v,g]);A.useEffect(()=>{let r=b.getRootElement();if(r)return r.addEventListener("contextmenu",m),()=>r.removeEventListener("contextmenu",m)},[b,m]);A.useEffect(()=>{document.addEventListener("click",u);return()=>document.removeEventListener("click",u)},[b,u]);return null===g||null===b?null:A.createElement(J,{close:v,resolution:g,editor:b,anchorElementRef:n,
22
- options:c,menuRenderFn:(r,y)=>p(r,y,{setMenuRef:L=>{t.current=L}}),onSelectOption:e,commandPriority:x})};exports.MenuOption=C
8
+
9
+ 'use strict';var g=require("@lexical/react/LexicalComposerContext"),w=require("@lexical/utils"),z=require("lexical"),A=require("react"),B=require("react/jsx-runtime"),C=Object.create(null);if(A)for(var D in A)C[D]=A[D];C.default=A;let E="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?A.useLayoutEffect:A.useEffect;
10
+ class F{constructor(c){this.key=c;this.ref={current:null};this.setRefElement=this.setRefElement.bind(this)}setRefElement(c){this.ref={current:c}}}let G=c=>{const a=document.getElementById("typeahead-menu");if(a){var f=a.getBoundingClientRect();f.top+f.height>window.innerHeight&&a.scrollIntoView({block:"center"});0>f.top&&a.scrollIntoView({block:"center"});c.scrollIntoView({block:"nearest"})}};
11
+ function H(c){var a=z.$getSelection();if(!z.$isRangeSelection(a)||!a.isCollapsed())return null;var f=a.anchor;if("text"!==f.type)return null;a=f.getNode();if(!a.isSimpleText())return null;f=f.offset;let k=a.getTextContent().slice(0,f);var d=c.matchingString;c=c.replaceableString.length;for(let n=c;n<=d.length;n++)k.substr(-n)===d.substr(0,n)&&(c=n);c=f-c;if(0>c)return null;let p;0===c?[p]=a.splitText(f):[,p]=a.splitText(c,f);return p}
12
+ function I(c){let a=getComputedStyle(c),f="absolute"===a.position,k=/(auto|scroll)/;if("fixed"===a.position)return document.body;for(;c=c.parentElement;)if(a=getComputedStyle(c),(!f||"static"!==a.position)&&k.test(a.overflow+a.overflowY+a.overflowX))return c;return document.body}function J(c,a){c=c.getBoundingClientRect();a=a.getBoundingClientRect();return c.top>a.top&&c.top<a.bottom}
13
+ function K(c,a,f,k){let [d]=g.useLexicalComposerContext();A.useEffect(()=>{if(null!=a&&null!=c){let p=d.getRootElement(),n=null!=p?I(p):document.body,x=!1,m=J(a,n),b=function(){x||(window.requestAnimationFrame(function(){f();x=!1}),x=!0);const q=J(a,n);q!==m&&(m=q,null!=k&&k(q))},h=new ResizeObserver(f);window.addEventListener("resize",f);document.addEventListener("scroll",b,{capture:!0,passive:!0});h.observe(a);return()=>{h.unobserve(a);window.removeEventListener("resize",f);document.removeEventListener("scroll",
14
+ b,!0)}}},[a,d,k,f,c])}let L=z.createCommand("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");
15
+ function M({close:c,editor:a,anchorElementRef:f,resolution:k,options:d,menuRenderFn:p,onSelectOption:n,shouldSplitNodeWithQuery:x=!1,commandPriority:m=z.COMMAND_PRIORITY_LOW}){let [b,h]=A.useState(null);A.useEffect(()=>{h(0)},[k.match&&k.match.matchingString]);let q=A.useCallback(e=>{a.update(()=>{const l=null!=k.match&&x?H(k.match):null;n(e,l,c,k.match?k.match.matchingString:"")})},[a,x,k.match,n,c]),t=A.useCallback(e=>{const l=a.getRootElement();null!==l&&(l.setAttribute("aria-activedescendant",
16
+ "typeahead-item-"+e),h(e))},[a]);A.useEffect(()=>()=>{let e=a.getRootElement();null!==e&&e.removeAttribute("aria-activedescendant")},[a]);E(()=>{null===d?h(null):null===b&&t(0)},[d,b,t]);A.useEffect(()=>w.mergeRegister(a.registerCommand(L,({option:e})=>e.ref&&null!=e.ref.current?(G(e.ref.current),!0):!1,m)),[a,t,m]);A.useEffect(()=>w.mergeRegister(a.registerCommand(z.KEY_ARROW_DOWN_COMMAND,e=>{if(null!==d&&d.length&&null!==b){let l=b!==d.length-1?b+1:0;t(l);let u=d[l];null!=u.ref&&u.ref.current&&
17
+ a.dispatchCommand(L,{index:l,option:u});e.preventDefault();e.stopImmediatePropagation()}return!0},m),a.registerCommand(z.KEY_ARROW_UP_COMMAND,e=>{if(null!==d&&d.length&&null!==b){var l=0!==b?b-1:d.length-1;t(l);l=d[l];null!=l.ref&&l.ref.current&&G(l.ref.current);e.preventDefault();e.stopImmediatePropagation()}return!0},m),a.registerCommand(z.KEY_ESCAPE_COMMAND,e=>{e.preventDefault();e.stopImmediatePropagation();c();return!0},m),a.registerCommand(z.KEY_TAB_COMMAND,e=>{if(null===d||null===b||null==
18
+ d[b])return!1;e.preventDefault();e.stopImmediatePropagation();q(d[b]);return!0},m),a.registerCommand(z.KEY_ENTER_COMMAND,e=>{if(null===d||null===b||null==d[b])return!1;null!==e&&(e.preventDefault(),e.stopImmediatePropagation());q(d[b]);return!0},m)),[q,c,a,d,b,t,m]);let v=A.useMemo(()=>({options:d,selectOptionAndCleanUp:q,selectedIndex:b,setHighlightedIndex:h}),[q,b,d]);return p(f,v,k.match?k.match.matchingString:"")}
19
+ function N(c,a,f,k=document.body){let [d]=g.useLexicalComposerContext(),p=A.useRef(document.createElement("div")),n=A.useCallback(()=>{p.current.style.top=p.current.style.bottom;const m=d.getRootElement(),b=p.current;var h=b.firstChild;if(null!==m&&null!==c){const {left:t,top:v,width:e,height:l}=c.getRect();b.style.top=`${v+window.pageYOffset+p.current.offsetHeight+3}px`;b.style.left=`${t+window.pageXOffset}px`;b.style.height=`${l}px`;b.style.width=`${e}px`;if(null!==h){h.style.top=`${v}`;var q=h.getBoundingClientRect();
20
+ h=q.height;q=q.width;const u=m.getBoundingClientRect();t+q>u.right&&(b.style.left=`${u.right-q+window.pageXOffset}px`);(v+h>window.innerHeight||v+h>u.bottom)&&v-u.top>h+l&&(b.style.top=`${v-h+window.pageYOffset-l}px`)}b.isConnected||(null!=f&&(b.className=f),b.setAttribute("aria-label","Typeahead menu"),b.setAttribute("id","typeahead-menu"),b.setAttribute("role","listbox"),b.style.display="block",b.style.position="absolute",k.append(b));p.current=b;m.setAttribute("aria-controls","typeahead-menu")}},
21
+ [d,c,f,k]);A.useEffect(()=>{let m=d.getRootElement();if(null!==c)return n(),()=>{null!==m&&m.removeAttribute("aria-controls");let b=p.current;null!==b&&b.isConnected&&b.remove()}},[d,n,c]);let x=A.useCallback(m=>{null!==c&&(m||a(null))},[c,a]);K(c,p.current,n,x);return p}
22
+ exports.LexicalContextMenuPlugin=function({options:c,onWillOpen:a,onClose:f,onOpen:k,onSelectOption:d,menuRenderFn:p,anchorClassName:n,commandPriority:x=z.COMMAND_PRIORITY_LOW,parent:m}){let [b]=g.useLexicalComposerContext(),[h,q]=A.useState(null),t=C.useRef(null);n=N(h,q,n,m);let v=A.useCallback(()=>{q(null);null!=f&&null!==h&&f()},[f,h]),e=A.useCallback(r=>{q(r);null!=k&&null===h&&k(r)},[k,h]),l=A.useCallback(r=>{r.preventDefault();null!=a&&a(r);const y=w.calculateZoomLevel(r.target);e({getRect:()=>
23
+ new DOMRect(r.clientX/y,r.clientY/y,1,1)})},[e,a]),u=A.useCallback(r=>{null===h||null==t.current||null==r.target||t.current.contains(r.target)||v()},[v,h]);A.useEffect(()=>{let r=b.getRootElement();if(r)return r.addEventListener("contextmenu",l),()=>r.removeEventListener("contextmenu",l)},[b,l]);A.useEffect(()=>{document.addEventListener("click",u);return()=>document.removeEventListener("click",u)},[b,u]);return null===h||null===b?null:B.jsx(M,{close:v,resolution:h,editor:b,anchorElementRef:n,options:c,
24
+ menuRenderFn:(r,y)=>p(r,y,{setMenuRef:O=>{t.current=O}}),onSelectOption:d,commandPriority:x})};exports.MenuOption=F
@@ -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 t}from"@lexical/react/LexicalComposerContext";import{mergeRegister as e,calculateZoomLevel as n}from"@lexical/utils";import{createCommand as o,KEY_ARROW_DOWN_COMMAND as l,KEY_ARROW_UP_COMMAND as r,KEY_ESCAPE_COMMAND as i,KEY_TAB_COMMAND as u,KEY_ENTER_COMMAND as c,COMMAND_PRIORITY_LOW as s,$getSelection as a,$isRangeSelection as m}from"lexical";import*as d from"react";import{useLayoutEffect as p,useEffect as f,useState as g,useCallback as h,useMemo as w,useRef as v}from"react";var y="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?p:f;class b{constructor(t){this.key=t,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(t){this.ref={current:t}}}const E=t=>{const e=document.getElementById("typeahead-menu");if(!e)return;const n=e.getBoundingClientRect();n.top+n.height>window.innerHeight&&e.scrollIntoView({block:"center"}),n.top<0&&e.scrollIntoView({block:"center"}),t.scrollIntoView({block:"nearest"})};function C(t,e){const n=t.getBoundingClientRect(),o=e.getBoundingClientRect();return n.top>o.top&&n.top<o.bottom}function R(e,n,o,l){const[r]=t();f((()=>{if(null!=n&&null!=e){const t=r.getRootElement(),e=null!=t?function(t,e){let n=getComputedStyle(t);const o="absolute"===n.position,l=e?/(auto|scroll|hidden)/:/(auto|scroll)/;if("fixed"===n.position)return document.body;for(let e=t;e=e.parentElement;)if(n=getComputedStyle(e),(!o||"static"!==n.position)&&l.test(n.overflow+n.overflowY+n.overflowX))return e;return document.body}(t,!1):document.body;let i=!1,u=C(n,e);const c=function(){i||(window.requestAnimationFrame((function(){o(),i=!1})),i=!0);const t=C(n,e);t!==u&&(u=t,null!=l&&l(t))},s=new ResizeObserver(o);return window.addEventListener("resize",o),document.addEventListener("scroll",c,{capture:!0,passive:!0}),s.observe(n),()=>{s.unobserve(n),window.removeEventListener("resize",o),document.removeEventListener("scroll",c,!0)}}}),[n,r,l,o,e])}const x=o("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function O({close:t,editor:n,anchorElementRef:o,resolution:d,options:p,menuRenderFn:v,onSelectOption:b,shouldSplitNodeWithQuery:C=!1,commandPriority:R=s}){const[O,I]=g(null),S=d.match&&d.match.matchingString;f((()=>{I(0)}),[S]);const A=h((e=>{n.update((()=>{const n=null!=d.match&&C?function(t){const e=a();if(!m(e)||!e.isCollapsed())return null;const n=e.anchor;if("text"!==n.type)return null;const o=n.getNode();if(!o.isSimpleText())return null;const l=n.offset,r=o.getTextContent().slice(0,l),i=t.replaceableString.length,u=l-function(t,e,n){let o=n;for(let n=o;n<=e.length;n++)t.substr(-n)===e.substr(0,n)&&(o=n);return o}(r,t.matchingString,i);if(u<0)return null;let c;return 0===u?[c]=o.splitText(l):[,c]=o.splitText(u,l),c}(d.match):null;b(e,n,t,d.match?d.match.matchingString:"")}))}),[n,C,d.match,b,t]),L=h((t=>{const e=n.getRootElement();null!==e&&(e.setAttribute("aria-activedescendant","typeahead-item-"+t),I(t))}),[n]);f((()=>()=>{const t=n.getRootElement();null!==t&&t.removeAttribute("aria-activedescendant")}),[n]),y((()=>{null===p?I(null):null===O&&L(0)}),[p,O,L]),f((()=>e(n.registerCommand(x,(({option:t})=>!(!t.ref||null==t.ref.current)&&(E(t.ref.current),!0)),R))),[n,L,R]),f((()=>e(n.registerCommand(l,(t=>{const e=t;if(null!==p&&p.length&&null!==O){const t=O!==p.length-1?O+1:0;L(t);const o=p[t];null!=o.ref&&o.ref.current&&n.dispatchCommand(x,{index:t,option:o}),e.preventDefault(),e.stopImmediatePropagation()}return!0}),R),n.registerCommand(r,(t=>{const e=t;if(null!==p&&p.length&&null!==O){const t=0!==O?O-1:p.length-1;L(t);const n=p[t];null!=n.ref&&n.ref.current&&E(n.ref.current),e.preventDefault(),e.stopImmediatePropagation()}return!0}),R),n.registerCommand(i,(e=>{const n=e;return n.preventDefault(),n.stopImmediatePropagation(),t(),!0}),R),n.registerCommand(u,(t=>{const e=t;return null!==p&&null!==O&&null!=p[O]&&(e.preventDefault(),e.stopImmediatePropagation(),A(p[O]),!0)}),R),n.registerCommand(c,(t=>null!==p&&null!==O&&null!=p[O]&&(null!==t&&(t.preventDefault(),t.stopImmediatePropagation()),A(p[O]),!0)),R))),[A,t,n,p,O,L,R]);return v(o,w((()=>({options:p,selectOptionAndCleanUp:A,selectedIndex:O,setHighlightedIndex:I})),[A,O,p]),d.match?d.match.matchingString:"")}function I({options:e,onWillOpen:o,onClose:l,onOpen:r,onSelectOption:i,menuRenderFn:u,anchorClassName:c,commandPriority:a=s,parent:m}){const[p]=t(),[w,y]=g(null),b=d.useRef(null),E=function(e,n,o,l=document.body){const[r]=t(),i=v(document.createElement("div")),u=h((()=>{i.current.style.top=i.current.style.bottom;const t=r.getRootElement(),n=i.current,u=n.firstChild;if(null!==t&&null!==e){const{left:r,top:c,width:s,height:a}=e.getRect(),m=i.current.offsetHeight;if(n.style.top=`${c+window.pageYOffset+m+3}px`,n.style.left=`${r+window.pageXOffset}px`,n.style.height=`${a}px`,n.style.width=`${s}px`,null!==u){u.style.top=`${c}`;const e=u.getBoundingClientRect(),o=e.height,l=e.width,i=t.getBoundingClientRect();r+l>i.right&&(n.style.left=`${i.right-l+window.pageXOffset}px`),(c+o>window.innerHeight||c+o>i.bottom)&&c-i.top>o&&(n.style.top=c-o+window.pageYOffset-a+"px")}n.isConnected||(null!=o&&(n.className=o),n.setAttribute("aria-label","Typeahead menu"),n.setAttribute("id","typeahead-menu"),n.setAttribute("role","listbox"),n.style.display="block",n.style.position="absolute",l.append(n)),i.current=n,t.setAttribute("aria-controls","typeahead-menu")}}),[r,e,o,l]);f((()=>{const t=r.getRootElement();if(null!==e)return u(),()=>{null!==t&&t.removeAttribute("aria-controls");const e=i.current;null!==e&&e.isConnected&&e.remove()}}),[r,u,e]);const c=h((t=>{null!==e&&(t||n(null))}),[e,n]);return R(e,i.current,u,c),i}(w,y,c,m),C=h((()=>{y(null),null!=l&&null!==w&&l()}),[l,w]),x=h((t=>{y(t),null!=r&&null===w&&r(t)}),[r,w]),I=h((t=>{t.preventDefault(),null!=o&&o(t);const e=n(t.target);x({getRect:()=>new DOMRect(t.clientX/e,t.clientY/e,1,1)})}),[x,o]),S=h((t=>{null===w||null==b.current||null==t.target||b.current.contains(t.target)||C()}),[C,w]);return f((()=>{const t=p.getRootElement();if(t)return t.addEventListener("contextmenu",I),()=>t.removeEventListener("contextmenu",I)}),[p,I]),f((()=>(document.addEventListener("click",S),()=>document.removeEventListener("click",S))),[p,S]),null===w||null===p?null:d.createElement(O,{close:C,resolution:w,editor:p,anchorElementRef:E,options:e,menuRenderFn:(t,e)=>u(t,e,{setMenuRef:t=>{b.current=t}}),onSelectOption:i,commandPriority:a})}export{I as LexicalContextMenuPlugin,b as MenuOption};
8
+
9
+ import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{mergeRegister as e,calculateZoomLevel as n}from"@lexical/utils";import{createCommand as o,KEY_ARROW_DOWN_COMMAND as l,KEY_ARROW_UP_COMMAND as r,KEY_ESCAPE_COMMAND as i,KEY_TAB_COMMAND as u,KEY_ENTER_COMMAND as c,COMMAND_PRIORITY_LOW as s,$getSelection as a,$isRangeSelection as m}from"lexical";import*as d from"react";import{useLayoutEffect as p,useEffect as f,useState as g,useCallback as h,useMemo as w,useRef as v}from"react";import{jsx as y}from"react/jsx-runtime";const b="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?p:f;class C{constructor(t){this.key=t,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(t){this.ref={current:t}}}const E=t=>{const e=document.getElementById("typeahead-menu");if(!e)return;const n=e.getBoundingClientRect();n.top+n.height>window.innerHeight&&e.scrollIntoView({block:"center"}),n.top<0&&e.scrollIntoView({block:"center"}),t.scrollIntoView({block:"nearest"})};function R(t,e){const n=t.getBoundingClientRect(),o=e.getBoundingClientRect();return n.top>o.top&&n.top<o.bottom}function x(e,n,o,l){const[r]=t();f((()=>{if(null!=n&&null!=e){const t=r.getRootElement(),e=null!=t?function(t,e){let n=getComputedStyle(t);const o="absolute"===n.position,l=/(auto|scroll)/;if("fixed"===n.position)return document.body;for(let e=t;e=e.parentElement;)if(n=getComputedStyle(e),(!o||"static"!==n.position)&&l.test(n.overflow+n.overflowY+n.overflowX))return e;return document.body}(t):document.body;let i=!1,u=R(n,e);const c=function(){i||(window.requestAnimationFrame((function(){o(),i=!1})),i=!0);const t=R(n,e);t!==u&&(u=t,null!=l&&l(t))},s=new ResizeObserver(o);return window.addEventListener("resize",o),document.addEventListener("scroll",c,{capture:!0,passive:!0}),s.observe(n),()=>{s.unobserve(n),window.removeEventListener("resize",o),document.removeEventListener("scroll",c,!0)}}}),[n,r,l,o,e])}const O=o("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function I({close:t,editor:n,anchorElementRef:o,resolution:d,options:p,menuRenderFn:v,onSelectOption:y,shouldSplitNodeWithQuery:C=!1,commandPriority:R=s}){const[x,I]=g(null),S=d.match&&d.match.matchingString;f((()=>{I(0)}),[S]);const A=h((e=>{n.update((()=>{const n=null!=d.match&&C?function(t){const e=a();if(!m(e)||!e.isCollapsed())return null;const n=e.anchor;if("text"!==n.type)return null;const o=n.getNode();if(!o.isSimpleText())return null;const l=n.offset,r=o.getTextContent().slice(0,l),i=t.replaceableString.length,u=l-function(t,e,n){let o=n;for(let n=o;n<=e.length;n++)t.substr(-n)===e.substr(0,n)&&(o=n);return o}(r,t.matchingString,i);if(u<0)return null;let c;return 0===u?[c]=o.splitText(l):[,c]=o.splitText(u,l),c}(d.match):null;y(e,n,t,d.match?d.match.matchingString:"")}))}),[n,C,d.match,y,t]),L=h((t=>{const e=n.getRootElement();null!==e&&(e.setAttribute("aria-activedescendant","typeahead-item-"+t),I(t))}),[n]);f((()=>()=>{const t=n.getRootElement();null!==t&&t.removeAttribute("aria-activedescendant")}),[n]),b((()=>{null===p?I(null):null===x&&L(0)}),[p,x,L]),f((()=>e(n.registerCommand(O,(({option:t})=>!(!t.ref||null==t.ref.current)&&(E(t.ref.current),!0)),R))),[n,L,R]),f((()=>e(n.registerCommand(l,(t=>{const e=t;if(null!==p&&p.length&&null!==x){const t=x!==p.length-1?x+1:0;L(t);const o=p[t];null!=o.ref&&o.ref.current&&n.dispatchCommand(O,{index:t,option:o}),e.preventDefault(),e.stopImmediatePropagation()}return!0}),R),n.registerCommand(r,(t=>{const e=t;if(null!==p&&p.length&&null!==x){const t=0!==x?x-1:p.length-1;L(t);const n=p[t];null!=n.ref&&n.ref.current&&E(n.ref.current),e.preventDefault(),e.stopImmediatePropagation()}return!0}),R),n.registerCommand(i,(e=>{const n=e;return n.preventDefault(),n.stopImmediatePropagation(),t(),!0}),R),n.registerCommand(u,(t=>{const e=t;return null!==p&&null!==x&&null!=p[x]&&(e.preventDefault(),e.stopImmediatePropagation(),A(p[x]),!0)}),R),n.registerCommand(c,(t=>null!==p&&null!==x&&null!=p[x]&&(null!==t&&(t.preventDefault(),t.stopImmediatePropagation()),A(p[x]),!0)),R))),[A,t,n,p,x,L,R]);return v(o,w((()=>({options:p,selectOptionAndCleanUp:A,selectedIndex:x,setHighlightedIndex:I})),[A,x,p]),d.match?d.match.matchingString:"")}function S({options:e,onWillOpen:o,onClose:l,onOpen:r,onSelectOption:i,menuRenderFn:u,anchorClassName:c,commandPriority:a=s,parent:m}){const[p]=t(),[w,b]=g(null),C=d.useRef(null),E=function(e,n,o,l=document.body){const[r]=t(),i=v(document.createElement("div")),u=h((()=>{i.current.style.top=i.current.style.bottom;const t=r.getRootElement(),n=i.current,u=n.firstChild;if(null!==t&&null!==e){const{left:r,top:c,width:s,height:a}=e.getRect(),m=i.current.offsetHeight;if(n.style.top=`${c+window.pageYOffset+m+3}px`,n.style.left=`${r+window.pageXOffset}px`,n.style.height=`${a}px`,n.style.width=`${s}px`,null!==u){u.style.top=`${c}`;const e=u.getBoundingClientRect(),o=e.height,l=e.width,i=t.getBoundingClientRect();r+l>i.right&&(n.style.left=`${i.right-l+window.pageXOffset}px`),(c+o>window.innerHeight||c+o>i.bottom)&&c-i.top>o+a&&(n.style.top=c-o+window.pageYOffset-a+"px")}n.isConnected||(null!=o&&(n.className=o),n.setAttribute("aria-label","Typeahead menu"),n.setAttribute("id","typeahead-menu"),n.setAttribute("role","listbox"),n.style.display="block",n.style.position="absolute",l.append(n)),i.current=n,t.setAttribute("aria-controls","typeahead-menu")}}),[r,e,o,l]);f((()=>{const t=r.getRootElement();if(null!==e)return u(),()=>{null!==t&&t.removeAttribute("aria-controls");const e=i.current;null!==e&&e.isConnected&&e.remove()}}),[r,u,e]);const c=h((t=>{null!==e&&(t||n(null))}),[e,n]);return x(e,i.current,u,c),i}(w,b,c,m),R=h((()=>{b(null),null!=l&&null!==w&&l()}),[l,w]),O=h((t=>{b(t),null!=r&&null===w&&r(t)}),[r,w]),S=h((t=>{t.preventDefault(),null!=o&&o(t);const e=n(t.target);O({getRect:()=>new DOMRect(t.clientX/e,t.clientY/e,1,1)})}),[O,o]),A=h((t=>{null===w||null==C.current||null==t.target||C.current.contains(t.target)||R()}),[R,w]);return f((()=>{const t=p.getRootElement();if(t)return t.addEventListener("contextmenu",S),()=>t.removeEventListener("contextmenu",S)}),[p,S]),f((()=>(document.addEventListener("click",A),()=>document.removeEventListener("click",A))),[p,A]),null===w||null===p?null:y(I,{close:R,resolution:w,editor:p,anchorElementRef:E,options:e,menuRenderFn:(t,e)=>u(t,e,{setMenuRef:t=>{C.current=t}}),onSelectOption:i,commandPriority:a})}export{S as LexicalContextMenuPlugin,C as MenuOption};
@@ -15,6 +15,7 @@ export declare class DecoratorBlockNode extends DecoratorNode<JSX.Element> {
15
15
  __format: ElementFormatType;
16
16
  constructor(format?: ElementFormatType, key?: NodeKey);
17
17
  exportJSON(): SerializedDecoratorBlockNode;
18
+ canIndent(): false;
18
19
  createDOM(): HTMLElement;
19
20
  updateDOM(): false;
20
21
  setFormat(format: ElementFormatType): void;
@@ -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 lexical = require('lexical');
@@ -15,6 +17,7 @@ var lexical = require('lexical');
15
17
  * LICENSE file in the root directory of this source tree.
16
18
  *
17
19
  */
20
+
18
21
  class DecoratorBlockNode extends lexical.DecoratorNode {
19
22
  constructor(format, key) {
20
23
  super(key);
@@ -27,6 +30,9 @@ class DecoratorBlockNode extends lexical.DecoratorNode {
27
30
  version: 1
28
31
  };
29
32
  }
33
+ canIndent() {
34
+ return false;
35
+ }
30
36
  createDOM() {
31
37
  return document.createElement('div');
32
38
  }
@@ -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 { DecoratorNode } from 'lexical';
8
10
 
9
11
  /**
@@ -13,6 +15,7 @@ import { DecoratorNode } from 'lexical';
13
15
  * LICENSE file in the root directory of this source tree.
14
16
  *
15
17
  */
18
+
16
19
  class DecoratorBlockNode extends DecoratorNode {
17
20
  constructor(format, key) {
18
21
  super(key);
@@ -25,6 +28,9 @@ class DecoratorBlockNode extends DecoratorNode {
25
28
  version: 1
26
29
  };
27
30
  }
31
+ canIndent() {
32
+ return false;
33
+ }
28
34
  createDOM() {
29
35
  return document.createElement('div');
30
36
  }
@@ -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 LexicalDecoratorBlockNode = process.env.NODE_ENV === 'development' ? require('./LexicalDecoratorBlockNode.dev.js') : require('./LexicalDecoratorBlockNode.prod.js');
9
11
  module.exports = LexicalDecoratorBlockNode;
@@ -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 './LexicalDecoratorBlockNode.dev.mjs';
8
10
  import * as modProd from './LexicalDecoratorBlockNode.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('./LexicalDecoratorBlockNode.dev.mjs') : import('./LexicalDecoratorBlockNode.prod.mjs'));
8
10
  export const $isDecoratorBlockNode = mod.$isDecoratorBlockNode;
9
11
  export const DecoratorBlockNode = mod.DecoratorBlockNode;
@@ -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
- 'use strict';var b=require("lexical");class c extends b.DecoratorNode{constructor(a,d){super(d);this.__format=a||""}exportJSON(){return{format:this.__format||"",type:"decorator-block",version:1}}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(a){this.getWritable().__format=a}isInline(){return!1}}exports.$isDecoratorBlockNode=function(a){return a instanceof c};exports.DecoratorBlockNode=c
8
+
9
+ 'use strict';var b=require("lexical");class c extends b.DecoratorNode{constructor(a,d){super(d);this.__format=a||""}exportJSON(){return{format:this.__format||"",type:"decorator-block",version:1}}canIndent(){return!1}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(a){this.getWritable().__format=a}isInline(){return!1}}exports.$isDecoratorBlockNode=function(a){return a instanceof c};exports.DecoratorBlockNode=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{DecoratorNode as t}from"lexical";class r extends t{constructor(t,r){super(r),this.__format=t||""}exportJSON(){return{format:this.__format||"",type:"decorator-block",version:1}}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(t){this.getWritable().__format=t}isInline(){return!1}}function e(t){return t instanceof r}export{e as $isDecoratorBlockNode,r as DecoratorBlockNode};
8
+
9
+ import{DecoratorNode as t}from"lexical";class r extends t{constructor(t,r){super(r),this.__format=t||""}exportJSON(){return{format:this.__format||"",type:"decorator-block",version:1}}canIndent(){return!1}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(t){this.getWritable().__format=t}isInline(){return!1}}function e(t){return t instanceof r}export{e as $isDecoratorBlockNode,r as DecoratorBlockNode};
@@ -3,12 +3,27 @@
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');
10
12
  var React = require('react');
11
13
 
14
+ function _interopNamespaceDefault(e) {
15
+ var n = Object.create(null);
16
+ if (e) {
17
+ for (var k in e) {
18
+ n[k] = e[k];
19
+ }
20
+ }
21
+ n.default = e;
22
+ return n;
23
+ }
24
+
25
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
26
+
12
27
  /**
13
28
  * Copyright (c) Meta Platforms, Inc. and affiliates.
14
29
  *
@@ -17,6 +32,7 @@ var React = require('react');
17
32
  *
18
33
  */
19
34
 
35
+
20
36
  /**
21
37
  *
22
38
  * Use this plugin to access the editor instance outside of the
@@ -28,7 +44,7 @@ function EditorRefPlugin({
28
44
  editorRef
29
45
  }) {
30
46
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
31
- React.useEffect(() => {
47
+ React__namespace.useEffect(() => {
32
48
  if (typeof editorRef === 'function') {
33
49
  editorRef(editor);
34
50
  } else if (typeof editorRef === 'object') {
@@ -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 * as React from 'react';
9
11
 
@@ -15,6 +17,7 @@ import * as React from 'react';
15
17
  *
16
18
  */
17
19
 
20
+
18
21
  /**
19
22
  *
20
23
  * Use this plugin to access the editor instance outside of the
@@ -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 LexicalEditorRefPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalEditorRefPlugin.dev.js') : require('./LexicalEditorRefPlugin.prod.js');
9
11
  module.exports = LexicalEditorRefPlugin;
@@ -0,0 +1,19 @@
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
+ * @flow strict
8
+ */
9
+
10
+ import type {LexicalEditor} from 'lexical';
11
+ // $FlowFixMe - Not able to type this with a flow extension
12
+ import type {TRefFor} from 'CoreTypes.flow';
13
+
14
+
15
+ type Props = $ReadOnly<{
16
+ editorRef: TRefFor<LexicalEditor>,
17
+ }>;
18
+
19
+ declare export function EditorRefPlugin(props: Props): null;
@@ -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 './LexicalEditorRefPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalEditorRefPlugin.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('./LexicalEditorRefPlugin.dev.mjs') : import('./LexicalEditorRefPlugin.prod.mjs'));
8
10
  export const EditorRefPlugin = mod.EditorRefPlugin;
@@ -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
- 'use strict';var c=require("@lexical/react/LexicalComposerContext"),d=require("react");exports.EditorRefPlugin=function({editorRef:a}){let [b]=c.useLexicalComposerContext();d.useEffect(()=>{"function"===typeof a?a(b):"object"===typeof a&&(a.current=b)},[b]);return null}
8
+
9
+ 'use strict';var a=require("@lexical/react/LexicalComposerContext"),c=require("react"),e=Object.create(null);if(c)for(var f in c)e[f]=c[f];e.default=c;exports.EditorRefPlugin=function({editorRef:b}){let [d]=a.useLexicalComposerContext();e.useEffect(()=>{"function"===typeof b?b(d):"object"===typeof b&&(b.current=d)},[d]);return null}
@@ -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 t}from"@lexical/react/LexicalComposerContext";import*as e from"react";function o({editorRef:o}){const[r]=t();return e.useEffect((()=>{"function"==typeof o?o(r):"object"==typeof o&&(o.current=r)}),[r]),null}export{o as EditorRefPlugin};
@@ -10,4 +10,6 @@ export type LexicalErrorBoundaryProps = {
10
10
  children: JSX.Element;
11
11
  onError: (error: Error) => void;
12
12
  };
13
- export default function LexicalErrorBoundary({ children, onError, }: LexicalErrorBoundaryProps): JSX.Element;
13
+ export declare function LexicalErrorBoundary({ children, onError, }: LexicalErrorBoundaryProps): JSX.Element;
14
+ /** @deprecated use the named export {@link LexicalErrorBoundary} */
15
+ export default LexicalErrorBoundary;