@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,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
  'use strict';
8
10
 
9
11
  var LexicalCollaborationContext = require('@lexical/react/LexicalCollaborationContext');
10
12
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
11
- var React = require('react');
13
+ var react = require('react');
14
+ var jsxRuntime = require('react/jsx-runtime');
12
15
 
13
16
  /**
14
17
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -17,6 +20,7 @@ var React = require('react');
17
20
  * LICENSE file in the root directory of this source tree.
18
21
  *
19
22
  */
23
+
20
24
  function getTransformSetFromKlass(klass) {
21
25
  const transform = klass.transform();
22
26
  return transform !== null ? new Set([transform]) : new Set();
@@ -28,8 +32,8 @@ function LexicalNestedComposer({
28
32
  initialTheme,
29
33
  skipCollabChecks
30
34
  }) {
31
- const wasCollabPreviouslyReadyRef = React.useRef(false);
32
- const parentContext = React.useContext(LexicalComposerContext.LexicalComposerContext);
35
+ const wasCollabPreviouslyReadyRef = react.useRef(false);
36
+ const parentContext = react.useContext(LexicalComposerContext.LexicalComposerContext);
33
37
  if (parentContext == null) {
34
38
  {
35
39
  throw Error(`Unexpected parent context null on a nested composer`);
@@ -38,7 +42,7 @@ function LexicalNestedComposer({
38
42
  const [parentEditor, {
39
43
  getTheme: getParentTheme
40
44
  }] = parentContext;
41
- const composerContext = React.useMemo(() => {
45
+ const composerContext = react.useMemo(() => {
42
46
  const composerTheme = initialTheme || getParentTheme() || undefined;
43
47
  const context = LexicalComposerContext.createLexicalComposerContext(parentContext, composerTheme);
44
48
  if (composerTheme !== undefined) {
@@ -90,21 +94,22 @@ function LexicalNestedComposer({
90
94
  yjsDocMap
91
95
  } = LexicalCollaborationContext.useCollaborationContext();
92
96
  const isCollabReady = skipCollabChecks || wasCollabPreviouslyReadyRef.current || yjsDocMap.has(initialEditor.getKey());
93
- React.useEffect(() => {
97
+ react.useEffect(() => {
94
98
  if (isCollabReady) {
95
99
  wasCollabPreviouslyReadyRef.current = true;
96
100
  }
97
101
  }, [isCollabReady]);
98
102
 
99
103
  // Update `isEditable` state of nested editor in response to the same change on parent editor.
100
- React.useEffect(() => {
104
+ react.useEffect(() => {
101
105
  return parentEditor.registerEditableListener(editable => {
102
106
  initialEditor.setEditable(editable);
103
107
  });
104
108
  }, [initialEditor, parentEditor]);
105
- return /*#__PURE__*/React.createElement(LexicalComposerContext.LexicalComposerContext.Provider, {
106
- value: composerContext
107
- }, !isCollabActive || isCollabReady ? children : null);
109
+ return /*#__PURE__*/jsxRuntime.jsx(LexicalComposerContext.LexicalComposerContext.Provider, {
110
+ value: composerContext,
111
+ children: !isCollabActive || isCollabReady ? children : null
112
+ });
108
113
  }
109
114
 
110
115
  exports.LexicalNestedComposer = LexicalNestedComposer;
@@ -3,11 +3,13 @@
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 { useCollaborationContext } from '@lexical/react/LexicalCollaborationContext';
8
10
  import { LexicalComposerContext, createLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
- import * as React from 'react';
10
11
  import { useRef, useContext, useMemo, useEffect } from 'react';
12
+ import { jsx } from 'react/jsx-runtime';
11
13
 
12
14
  /**
13
15
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -16,6 +18,7 @@ import { useRef, useContext, useMemo, useEffect } from 'react';
16
18
  * LICENSE file in the root directory of this source tree.
17
19
  *
18
20
  */
21
+
19
22
  function getTransformSetFromKlass(klass) {
20
23
  const transform = klass.transform();
21
24
  return transform !== null ? new Set([transform]) : new Set();
@@ -101,9 +104,10 @@ function LexicalNestedComposer({
101
104
  initialEditor.setEditable(editable);
102
105
  });
103
106
  }, [initialEditor, parentEditor]);
104
- return /*#__PURE__*/React.createElement(LexicalComposerContext.Provider, {
105
- value: composerContext
106
- }, !isCollabActive || isCollabReady ? children : null);
107
+ return /*#__PURE__*/jsx(LexicalComposerContext.Provider, {
108
+ value: composerContext,
109
+ children: !isCollabActive || isCollabReady ? children : null
110
+ });
107
111
  }
108
112
 
109
113
  export { LexicalNestedComposer };
@@ -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 LexicalNestedComposer = process.env.NODE_ENV === 'development' ? require('./LexicalNestedComposer.dev.js') : require('./LexicalNestedComposer.prod.js');
9
11
  module.exports = LexicalNestedComposer;
@@ -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 './LexicalNestedComposer.dev.mjs';
8
10
  import * as modProd from './LexicalNestedComposer.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('./LexicalNestedComposer.dev.mjs') : import('./LexicalNestedComposer.prod.mjs'));
8
10
  export const LexicalNestedComposer = mod.LexicalNestedComposer;
@@ -3,9 +3,11 @@
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 d=require("@lexical/react/LexicalCollaborationContext"),m=require("@lexical/react/LexicalComposerContext"),q=require("react");function t(a){let h=new URLSearchParams;h.append("code",a);for(let e=1;e<arguments.length;e++)h.append("v",arguments[e]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${h} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
8
- function u(a){a=a.transform();return null!==a?new Set([a]):new Set}
9
- exports.LexicalNestedComposer=function({initialEditor:a,children:h,initialNodes:e,initialTheme:v,skipCollabChecks:w}){let r=q.useRef(!1),n=q.useContext(m.LexicalComposerContext);null==n&&t(9);let [f,{getTheme:x}]=n,z=q.useMemo(()=>{var c=v||x()||void 0;const y=m.createLexicalComposerContext(n,c);void 0!==c&&(a._config.theme=c);a._parentEditor=f;if(e)for(var b of e){var g=c=null;"function"!==typeof b&&(g=b,b=g.replace,c=g.with,g=g.withKlass||null);const l=a._nodes.get(b.getType());a._nodes.set(b.getType(),
10
- {exportDOM:l?l.exportDOM:void 0,klass:b,replace:c,replaceWithKlass:g,transforms:u(b)})}else{b=a._nodes=new Map(f._nodes);for(const [l,k]of b)a._nodes.set(l,{exportDOM:k.exportDOM,klass:k.klass,replace:k.replace,replaceWithKlass:k.replaceWithKlass,transforms:u(k.klass)})}a._config.namespace=f._config.namespace;a._editable=f._editable;return[a,y]},[]),{isCollabActive:A,yjsDocMap:B}=d.useCollaborationContext(),p=w||r.current||B.has(a.getKey());q.useEffect(()=>{p&&(r.current=!0)},[p]);q.useEffect(()=>
11
- f.registerEditableListener(c=>{a.setEditable(c)}),[a,f]);return q.createElement(m.LexicalComposerContext.Provider,{value:z},!A||p?h:null)}
8
+
9
+ 'use strict';var g=require("@lexical/react/LexicalCollaborationContext"),h=require("@lexical/react/LexicalComposerContext"),n=require("react"),r=require("react/jsx-runtime"),t;function v(a){let k=new URLSearchParams;k.append("code",a);for(let d=1;d<arguments.length;d++)k.append("v",arguments[d]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${k} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
10
+ t=v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v["default"]:v;function w(a){a=a.transform();return null!==a?new Set([a]):new Set}
11
+ exports.LexicalNestedComposer=function({initialEditor:a,children:k,initialNodes:d,initialTheme:x,skipCollabChecks:y}){let u=n.useRef(!1),p=n.useContext(h.LexicalComposerContext);null==p&&t(9);let [e,{getTheme:z}]=p,B=n.useMemo(()=>{var c=x||z()||void 0;const A=h.createLexicalComposerContext(p,c);void 0!==c&&(a._config.theme=c);a._parentEditor=e;if(d)for(var b of d){var f=c=null;"function"!==typeof b&&(f=b,b=f.replace,c=f.with,f=f.withKlass||null);const m=a._nodes.get(b.getType());a._nodes.set(b.getType(),
12
+ {exportDOM:m?m.exportDOM:void 0,klass:b,replace:c,replaceWithKlass:f,transforms:w(b)})}else{b=a._nodes=new Map(e._nodes);for(const [m,l]of b)a._nodes.set(m,{exportDOM:l.exportDOM,klass:l.klass,replace:l.replace,replaceWithKlass:l.replaceWithKlass,transforms:w(l.klass)})}a._config.namespace=e._config.namespace;a._editable=e._editable;return[a,A]},[]),{isCollabActive:C,yjsDocMap:D}=g.useCollaborationContext(),q=y||u.current||D.has(a.getKey());n.useEffect(()=>{q&&(u.current=!0)},[q]);n.useEffect(()=>
13
+ e.registerEditableListener(c=>{a.setEditable(c)}),[a,e]);return r.jsx(h.LexicalComposerContext.Provider,{value:B,children:!C||q?k: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
  */
7
- import{useCollaborationContext as e}from"@lexical/react/LexicalCollaborationContext";import{LexicalComposerContext as t,createLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import*as o from"react";import{useRef as n,useContext as l,useMemo as i,useEffect as a}from"react";var s=function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)};function c(e){const t=e.transform();return null!==t?new Set([t]):new Set}function p({initialEditor:p,children:f,initialNodes:d,initialTheme:m,skipCollabChecks:u}){const h=n(!1),x=l(t);null==x&&s(9);const[g,{getTheme:v}]=x,_=i((()=>{const e=m||v()||void 0,t=r(x,e);if(void 0!==e&&(p._config.theme=e),p._parentEditor=g,d)for(let e of d){let t=null,r=null;if("function"!=typeof e){const o=e;e=o.replace,t=o.with,r=o.withKlass||null}const o=p._nodes.get(e.getType());p._nodes.set(e.getType(),{exportDOM:o?o.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:r,transforms:c(e)})}else{const e=p._nodes=new Map(g._nodes);for(const[t,r]of e)p._nodes.set(t,{exportDOM:r.exportDOM,klass:r.klass,replace:r.replace,replaceWithKlass:r.replaceWithKlass,transforms:c(r.klass)})}return p._config.namespace=g._config.namespace,p._editable=g._editable,[p,t]}),[]),{isCollabActive:w,yjsDocMap:b}=e(),C=u||h.current||b.has(p.getKey());return a((()=>{C&&(h.current=!0)}),[C]),a((()=>g.registerEditableListener((e=>{p.setEditable(e)}))),[p,g]),o.createElement(t.Provider,{value:_},!w||C?f:null)}export{p as LexicalNestedComposer};
8
+
9
+ import{useCollaborationContext as e}from"@lexical/react/LexicalCollaborationContext";import{LexicalComposerContext as t,createLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{useRef as o,useContext as n,useMemo as l,useEffect as i}from"react";import{jsx as a}from"react/jsx-runtime";function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c=s((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));function p(e){const t=e.transform();return null!==t?new Set([t]):new Set}function d({initialEditor:s,children:d,initialNodes:f,initialTheme:u,skipCollabChecks:m}){const h=o(!1),x=n(t);null==x&&c(9);const[_,{getTheme:g}]=x,v=l((()=>{const e=u||g()||void 0,t=r(x,e);if(void 0!==e&&(s._config.theme=e),s._parentEditor=_,f)for(let e of f){let t=null,r=null;if("function"!=typeof e){const o=e;e=o.replace,t=o.with,r=o.withKlass||null}const o=s._nodes.get(e.getType());s._nodes.set(e.getType(),{exportDOM:o?o.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:r,transforms:p(e)})}else{const e=s._nodes=new Map(_._nodes);for(const[t,r]of e)s._nodes.set(t,{exportDOM:r.exportDOM,klass:r.klass,replace:r.replace,replaceWithKlass:r.replaceWithKlass,transforms:p(r.klass)})}return s._config.namespace=_._config.namespace,s._editable=_._editable,[s,t]}),[]),{isCollabActive:w,yjsDocMap:b}=e(),M=m||h.current||b.has(s.getKey());return i((()=>{M&&(h.current=!0)}),[M]),i((()=>_.registerEditableListener((e=>{s.setEditable(e)}))),[s,_]),a(t.Provider,{value:v,children:!w||M?d:null})}export{d as LexicalNestedComposer};
@@ -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,6 +20,7 @@ var react = require('react');
18
20
  * LICENSE file in the root directory of this source tree.
19
21
  *
20
22
  */
23
+
21
24
  const capturedEvents = new Set(['mouseenter', 'mouseleave']);
22
25
  function NodeEventPlugin({
23
26
  nodeType,
@@ -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 { $findMatchingParent } from '@lexical/utils';
9
11
  import { $getNearestNodeFromDOMNode } from 'lexical';
@@ -16,6 +18,7 @@ import { useRef, useEffect } from 'react';
16
18
  * LICENSE file in the root directory of this source tree.
17
19
  *
18
20
  */
21
+
19
22
  const capturedEvents = new Set(['mouseenter', 'mouseleave']);
20
23
  function NodeEventPlugin({
21
24
  nodeType,
@@ -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 LexicalNodeEventPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalNodeEventPlugin.dev.js') : require('./LexicalNodeEventPlugin.prod.js');
9
11
  module.exports = LexicalNodeEventPlugin;
@@ -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
+ * LexicalNodeEventPlugin
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 './LexicalNodeEventPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalNodeEventPlugin.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('./LexicalNodeEventPlugin.dev.mjs') : import('./LexicalNodeEventPlugin.prod.mjs'));
8
10
  export const NodeEventPlugin = mod.NodeEventPlugin;
@@ -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
  'use strict';var g=require("@lexical/react/LexicalComposerContext"),m=require("@lexical/utils"),n=require("lexical"),p=require("react");let q=new Set(["mouseenter","mouseleave"]);
8
10
  exports.NodeEventPlugin=function({nodeType:d,eventType:e,eventListener:h}){let [c]=g.useLexicalComposerContext(),k=p.useRef(h);k.current=h;p.useEffect(()=>{let f=q.has(e),l=b=>{c.update(()=>{var a=n.$getNearestNodeFromDOMNode(b.target);null!==a&&(a=f?a instanceof d?a:null:m.$findMatchingParent(a,r=>r instanceof d),null!==a&&k.current(b,c,a.getKey()))})};return c.registerRootListener((b,a)=>{b&&b.addEventListener(e,l,f);a&&a.removeEventListener(e,l,f)})},[c,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 e}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as t}from"@lexical/utils";import{$getNearestNodeFromDOMNode as n}from"lexical";import{useRef as r,useEffect as o}from"react";const i=new Set(["mouseenter","mouseleave"]);function l({nodeType:l,eventType:s,eventListener:c}){const[u]=e(),a=r(c);return a.current=c,o((()=>{const e=i.has(s),r=r=>{u.update((()=>{const o=n(r.target);if(null!==o){const n=e?o instanceof l?o:null:t(o,(e=>e instanceof l));if(null!==n)return void a.current(r,u,n.getKey())}}))};return u.registerRootListener(((t,n)=>{t&&t.addEventListener(s,r,e),n&&n.removeEventListener(s,r,e)}))}),[u,l]),null}export{l as NodeEventPlugin};
@@ -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 lexical = require('lexical');
11
13
  var React = require('react');
12
14
  var utils = require('@lexical/utils');
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,9 +409,10 @@ 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
  function startTransition(callback) {
392
- if (React.startTransition) {
393
- React.startTransition(callback);
414
+ if (React__namespace.startTransition) {
415
+ React__namespace.startTransition(callback);
394
416
  } else {
395
417
  callback();
396
418
  }
@@ -452,7 +474,7 @@ function LexicalNodeMenuPlugin({
452
474
  });
453
475
  }
454
476
  }, [editor, positionOrCloseMenu, nodeKey]);
455
- return resolution === null || editor === null ? null : /*#__PURE__*/React.createElement(LexicalMenu, {
477
+ return resolution === null || editor === null ? null : /*#__PURE__*/jsxRuntime.jsx(LexicalMenu, {
456
478
  close: closeNodeMenu,
457
479
  resolution: resolution,
458
480
  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 { createCommand, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND, KEY_ENTER_COMMAND, COMMAND_PRIORITY_LOW, $getSelection, $isRangeSelection, $getNodeByKey } from 'lexical';
9
11
  import * as React from 'react';
10
- import { useLayoutEffect as useLayoutEffect$1, useEffect, useState, useCallback, useMemo, useRef } from 'react';
12
+ import { useLayoutEffect, useEffect, useState, useCallback, useMemo, useRef } from 'react';
11
13
  import { mergeRegister } from '@lexical/utils';
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
  function startTransition(callback) {
391
400
  if (React.startTransition) {
392
401
  React.startTransition(callback);
@@ -451,7 +460,7 @@ function LexicalNodeMenuPlugin({
451
460
  });
452
461
  }
453
462
  }, [editor, positionOrCloseMenu, nodeKey]);
454
- return resolution === null || editor === null ? null : /*#__PURE__*/React.createElement(LexicalMenu, {
463
+ return resolution === null || editor === null ? null : /*#__PURE__*/jsx(LexicalMenu, {
455
464
  close: closeNodeMenu,
456
465
  resolution: resolution,
457
466
  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 LexicalNodeMenuPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalNodeMenuPlugin.dev.js') : require('./LexicalNodeMenuPlugin.prod.js');
9
11
  module.exports = LexicalNodeMenuPlugin;
@@ -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 './LexicalNodeMenuPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalNodeMenuPlugin.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('./LexicalNodeMenuPlugin.dev.mjs') : import('./LexicalNodeMenuPlugin.prod.mjs'));
8
10
  export const LexicalNodeMenuPlugin = mod.LexicalNodeMenuPlugin;
9
11
  export const MenuOption = mod.MenuOption;
@@ -3,19 +3,21 @@
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 k=require("@lexical/react/LexicalComposerContext"),t=require("lexical"),x=require("react"),y=require("@lexical/utils"),z="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?x.useLayoutEffect:x.useEffect;class A{constructor(b){this.key=b;this.ref={current:null};this.setRefElement=this.setRefElement.bind(this)}setRefElement(b){this.ref={current:b}}}
8
- let B=b=>{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"});b.scrollIntoView({block:"nearest"})}};
9
- function C(b){var a=t.$getSelection();if(!t.$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 l=a.getTextContent().slice(0,d);var f=b.matchingString;b=b.replaceableString.length;for(let n=b;n<=f.length;n++)l.substr(-n)===f.substr(0,n)&&(b=n);b=d-b;if(0>b)return null;let p;0===b?[p]=a.splitText(d):[,p]=a.splitText(b,d);return p}
10
- function D(b,a){let d=getComputedStyle(b),l="absolute"===d.position;a=a?/(auto|scroll|hidden)/:/(auto|scroll)/;if("fixed"===d.position)return document.body;for(;b=b.parentElement;)if(d=getComputedStyle(b),(!l||"static"!==d.position)&&a.test(d.overflow+d.overflowY+d.overflowX))return b;return document.body}function E(b,a){b=b.getBoundingClientRect();a=a.getBoundingClientRect();return b.top>a.top&&b.top<a.bottom}
11
- function F(b,a,d,l){let [f]=k.useLexicalComposerContext();x.useEffect(()=>{if(null!=a&&null!=b){let p=f.getRootElement(),n=null!=p?D(p,!1):document.body,w=!1,m=E(a,n),c=function(){w||(window.requestAnimationFrame(function(){d();w=!1}),w=!0);const q=E(a,n);q!==m&&(m=q,null!=l&&l(q))},g=new ResizeObserver(d);window.addEventListener("resize",d);document.addEventListener("scroll",c,{capture:!0,passive:!0});g.observe(a);return()=>{g.unobserve(a);window.removeEventListener("resize",d);document.removeEventListener("scroll",
12
- c,!0)}}},[a,f,l,d,b])}let G=t.createCommand("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");
13
- function H({close:b,editor:a,anchorElementRef:d,resolution:l,options:f,menuRenderFn:p,onSelectOption:n,shouldSplitNodeWithQuery:w=!1,commandPriority:m=t.COMMAND_PRIORITY_LOW}){let [c,g]=x.useState(null);x.useEffect(()=>{g(0)},[l.match&&l.match.matchingString]);let q=x.useCallback(e=>{a.update(()=>{const h=null!=l.match&&w?C(l.match):null;n(e,h,b,l.match?l.match.matchingString:"")})},[a,w,l.match,n,b]),r=x.useCallback(e=>{const h=a.getRootElement();null!==h&&(h.setAttribute("aria-activedescendant",
14
- "typeahead-item-"+e),g(e))},[a]);x.useEffect(()=>()=>{let e=a.getRootElement();null!==e&&e.removeAttribute("aria-activedescendant")},[a]);z(()=>{null===f?g(null):null===c&&r(0)},[f,c,r]);x.useEffect(()=>y.mergeRegister(a.registerCommand(G,({option:e})=>e.ref&&null!=e.ref.current?(B(e.ref.current),!0):!1,m)),[a,r,m]);x.useEffect(()=>y.mergeRegister(a.registerCommand(t.KEY_ARROW_DOWN_COMMAND,e=>{if(null!==f&&f.length&&null!==c){let h=c!==f.length-1?c+1:0;r(h);let u=f[h];null!=u.ref&&u.ref.current&&
15
- a.dispatchCommand(G,{index:h,option:u});e.preventDefault();e.stopImmediatePropagation()}return!0},m),a.registerCommand(t.KEY_ARROW_UP_COMMAND,e=>{if(null!==f&&f.length&&null!==c){var h=0!==c?c-1:f.length-1;r(h);h=f[h];null!=h.ref&&h.ref.current&&B(h.ref.current);e.preventDefault();e.stopImmediatePropagation()}return!0},m),a.registerCommand(t.KEY_ESCAPE_COMMAND,e=>{e.preventDefault();e.stopImmediatePropagation();b();return!0},m),a.registerCommand(t.KEY_TAB_COMMAND,e=>{if(null===f||null===c||null==
16
- f[c])return!1;e.preventDefault();e.stopImmediatePropagation();q(f[c]);return!0},m),a.registerCommand(t.KEY_ENTER_COMMAND,e=>{if(null===f||null===c||null==f[c])return!1;null!==e&&(e.preventDefault(),e.stopImmediatePropagation());q(f[c]);return!0},m)),[q,b,a,f,c,r,m]);let v=x.useMemo(()=>({options:f,selectOptionAndCleanUp:q,selectedIndex:c,setHighlightedIndex:g}),[q,c,f]);return p(d,v,l.match?l.match.matchingString:"")}
17
- function I(b,a,d,l=document.body){let [f]=k.useLexicalComposerContext(),p=x.useRef(document.createElement("div")),n=x.useCallback(()=>{p.current.style.top=p.current.style.bottom;const m=f.getRootElement(),c=p.current;var g=c.firstChild;if(null!==m&&null!==b){const {left:r,top:v,width:e,height:h}=b.getRect();c.style.top=`${v+window.pageYOffset+p.current.offsetHeight+3}px`;c.style.left=`${r+window.pageXOffset}px`;c.style.height=`${h}px`;c.style.width=`${e}px`;if(null!==g){g.style.top=`${v}`;var q=g.getBoundingClientRect();
18
- g=q.height;q=q.width;const u=m.getBoundingClientRect();r+q>u.right&&(c.style.left=`${u.right-q+window.pageXOffset}px`);(v+g>window.innerHeight||v+g>u.bottom)&&v-u.top>g&&(c.style.top=`${v-g+window.pageYOffset-h}px`)}c.isConnected||(null!=d&&(c.className=d),c.setAttribute("aria-label","Typeahead menu"),c.setAttribute("id","typeahead-menu"),c.setAttribute("role","listbox"),c.style.display="block",c.style.position="absolute",l.append(c));p.current=c;m.setAttribute("aria-controls","typeahead-menu")}},
19
- [f,b,d,l]);x.useEffect(()=>{let m=f.getRootElement();if(null!==b)return n(),()=>{null!==m&&m.removeAttribute("aria-controls");let c=p.current;null!==c&&c.isConnected&&c.remove()}},[f,n,b]);let w=x.useCallback(m=>{null!==b&&(m||a(null))},[b,a]);F(b,p.current,n,w);return p}function J(b){x.startTransition?x.startTransition(b):b()}
20
- exports.LexicalNodeMenuPlugin=function({options:b,nodeKey:a,onClose:d,onOpen:l,onSelectOption:f,menuRenderFn:p,anchorClassName:n,commandPriority:w=t.COMMAND_PRIORITY_LOW,parent:m}){let [c]=k.useLexicalComposerContext(),[g,q]=x.useState(null);n=I(g,q,n,m);let r=x.useCallback(()=>{q(null);null!=d&&null!==g&&d()},[d,g]),v=x.useCallback(h=>{q(h);null!=l&&null===g&&l(h)},[l,g]),e=x.useCallback(()=>{a?c.update(()=>{const h=t.$getNodeByKey(a),u=c.getElementByKey(a);null!=h&&null!=u&&null==g&&J(()=>v({getRect:()=>
21
- u.getBoundingClientRect()}))}):null==a&&null!=g&&r()},[r,c,a,v,g]);x.useEffect(()=>{e()},[e,a]);x.useEffect(()=>{if(null!=a)return c.registerUpdateListener(({dirtyElements:h})=>{h.get(a)&&e()})},[c,e,a]);return null===g||null===c?null:x.createElement(H,{close:r,resolution:g,editor:c,anchorElementRef:n,options:b,menuRenderFn:p,onSelectOption:f,commandPriority:w})};exports.MenuOption=A
8
+
9
+ 'use strict';var k=require("@lexical/react/LexicalComposerContext"),t=require("lexical"),x=require("react"),y=require("@lexical/utils"),z=require("react/jsx-runtime"),A=Object.create(null);if(x)for(var B in x)A[B]=x[B];A.default=x;let C="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?x.useLayoutEffect:x.useEffect;
10
+ class D{constructor(b){this.key=b;this.ref={current:null};this.setRefElement=this.setRefElement.bind(this)}setRefElement(b){this.ref={current:b}}}let E=b=>{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"});b.scrollIntoView({block:"nearest"})}};
11
+ function F(b){var a=t.$getSelection();if(!t.$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 l=a.getTextContent().slice(0,f);var e=b.matchingString;b=b.replaceableString.length;for(let n=b;n<=e.length;n++)l.substr(-n)===e.substr(0,n)&&(b=n);b=f-b;if(0>b)return null;let p;0===b?[p]=a.splitText(f):[,p]=a.splitText(b,f);return p}
12
+ function G(b){let a=getComputedStyle(b),f="absolute"===a.position,l=/(auto|scroll)/;if("fixed"===a.position)return document.body;for(;b=b.parentElement;)if(a=getComputedStyle(b),(!f||"static"!==a.position)&&l.test(a.overflow+a.overflowY+a.overflowX))return b;return document.body}function H(b,a){b=b.getBoundingClientRect();a=a.getBoundingClientRect();return b.top>a.top&&b.top<a.bottom}
13
+ function I(b,a,f,l){let [e]=k.useLexicalComposerContext();x.useEffect(()=>{if(null!=a&&null!=b){let p=e.getRootElement(),n=null!=p?G(p):document.body,w=!1,m=H(a,n),c=function(){w||(window.requestAnimationFrame(function(){f();w=!1}),w=!0);const q=H(a,n);q!==m&&(m=q,null!=l&&l(q))},g=new ResizeObserver(f);window.addEventListener("resize",f);document.addEventListener("scroll",c,{capture:!0,passive:!0});g.observe(a);return()=>{g.unobserve(a);window.removeEventListener("resize",f);document.removeEventListener("scroll",
14
+ c,!0)}}},[a,e,l,f,b])}let J=t.createCommand("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");
15
+ function K({close:b,editor:a,anchorElementRef:f,resolution:l,options:e,menuRenderFn:p,onSelectOption:n,shouldSplitNodeWithQuery:w=!1,commandPriority:m=t.COMMAND_PRIORITY_LOW}){let [c,g]=x.useState(null);x.useEffect(()=>{g(0)},[l.match&&l.match.matchingString]);let q=x.useCallback(d=>{a.update(()=>{const h=null!=l.match&&w?F(l.match):null;n(d,h,b,l.match?l.match.matchingString:"")})},[a,w,l.match,n,b]),r=x.useCallback(d=>{const h=a.getRootElement();null!==h&&(h.setAttribute("aria-activedescendant",
16
+ "typeahead-item-"+d),g(d))},[a]);x.useEffect(()=>()=>{let d=a.getRootElement();null!==d&&d.removeAttribute("aria-activedescendant")},[a]);C(()=>{null===e?g(null):null===c&&r(0)},[e,c,r]);x.useEffect(()=>y.mergeRegister(a.registerCommand(J,({option:d})=>d.ref&&null!=d.ref.current?(E(d.ref.current),!0):!1,m)),[a,r,m]);x.useEffect(()=>y.mergeRegister(a.registerCommand(t.KEY_ARROW_DOWN_COMMAND,d=>{if(null!==e&&e.length&&null!==c){let h=c!==e.length-1?c+1:0;r(h);let u=e[h];null!=u.ref&&u.ref.current&&
17
+ a.dispatchCommand(J,{index:h,option:u});d.preventDefault();d.stopImmediatePropagation()}return!0},m),a.registerCommand(t.KEY_ARROW_UP_COMMAND,d=>{if(null!==e&&e.length&&null!==c){var h=0!==c?c-1:e.length-1;r(h);h=e[h];null!=h.ref&&h.ref.current&&E(h.ref.current);d.preventDefault();d.stopImmediatePropagation()}return!0},m),a.registerCommand(t.KEY_ESCAPE_COMMAND,d=>{d.preventDefault();d.stopImmediatePropagation();b();return!0},m),a.registerCommand(t.KEY_TAB_COMMAND,d=>{if(null===e||null===c||null==
18
+ e[c])return!1;d.preventDefault();d.stopImmediatePropagation();q(e[c]);return!0},m),a.registerCommand(t.KEY_ENTER_COMMAND,d=>{if(null===e||null===c||null==e[c])return!1;null!==d&&(d.preventDefault(),d.stopImmediatePropagation());q(e[c]);return!0},m)),[q,b,a,e,c,r,m]);let v=x.useMemo(()=>({options:e,selectOptionAndCleanUp:q,selectedIndex:c,setHighlightedIndex:g}),[q,c,e]);return p(f,v,l.match?l.match.matchingString:"")}
19
+ function L(b,a,f,l=document.body){let [e]=k.useLexicalComposerContext(),p=x.useRef(document.createElement("div")),n=x.useCallback(()=>{p.current.style.top=p.current.style.bottom;const m=e.getRootElement(),c=p.current;var g=c.firstChild;if(null!==m&&null!==b){const {left:r,top:v,width:d,height:h}=b.getRect();c.style.top=`${v+window.pageYOffset+p.current.offsetHeight+3}px`;c.style.left=`${r+window.pageXOffset}px`;c.style.height=`${h}px`;c.style.width=`${d}px`;if(null!==g){g.style.top=`${v}`;var q=g.getBoundingClientRect();
20
+ g=q.height;q=q.width;const u=m.getBoundingClientRect();r+q>u.right&&(c.style.left=`${u.right-q+window.pageXOffset}px`);(v+g>window.innerHeight||v+g>u.bottom)&&v-u.top>g+h&&(c.style.top=`${v-g+window.pageYOffset-h}px`)}c.isConnected||(null!=f&&(c.className=f),c.setAttribute("aria-label","Typeahead menu"),c.setAttribute("id","typeahead-menu"),c.setAttribute("role","listbox"),c.style.display="block",c.style.position="absolute",l.append(c));p.current=c;m.setAttribute("aria-controls","typeahead-menu")}},
21
+ [e,b,f,l]);x.useEffect(()=>{let m=e.getRootElement();if(null!==b)return n(),()=>{null!==m&&m.removeAttribute("aria-controls");let c=p.current;null!==c&&c.isConnected&&c.remove()}},[e,n,b]);let w=x.useCallback(m=>{null!==b&&(m||a(null))},[b,a]);I(b,p.current,n,w);return p}function M(b){A.startTransition?A.startTransition(b):b()}
22
+ exports.LexicalNodeMenuPlugin=function({options:b,nodeKey:a,onClose:f,onOpen:l,onSelectOption:e,menuRenderFn:p,anchorClassName:n,commandPriority:w=t.COMMAND_PRIORITY_LOW,parent:m}){let [c]=k.useLexicalComposerContext(),[g,q]=x.useState(null);n=L(g,q,n,m);let r=x.useCallback(()=>{q(null);null!=f&&null!==g&&f()},[f,g]),v=x.useCallback(h=>{q(h);null!=l&&null===g&&l(h)},[l,g]),d=x.useCallback(()=>{a?c.update(()=>{const h=t.$getNodeByKey(a),u=c.getElementByKey(a);null!=h&&null!=u&&null==g&&M(()=>v({getRect:()=>
23
+ u.getBoundingClientRect()}))}):null==a&&null!=g&&r()},[r,c,a,v,g]);x.useEffect(()=>{d()},[d,a]);x.useEffect(()=>{if(null!=a)return c.registerUpdateListener(({dirtyElements:h})=>{h.get(a)&&d()})},[c,d,a]);return null===g||null===c?null:z.jsx(K,{close:r,resolution:g,editor:c,anchorElementRef:n,options:b,menuRenderFn:p,onSelectOption:e,commandPriority:w})};exports.MenuOption=D