@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,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
  */
8
+
7
9
  import { $isRootTextContentEmptyCurry } from '@lexical/text';
8
- import { useLayoutEffect as useLayoutEffect$1, useEffect, useState } from 'react';
10
+ import { useLayoutEffect, useEffect, useState } from 'react';
9
11
 
10
12
  /**
11
13
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -24,8 +26,12 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
24
26
  * LICENSE file in the root directory of this source tree.
25
27
  *
26
28
  */
27
- const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect$1 : useEffect;
28
- var useLayoutEffect = useLayoutEffectImpl;
29
+
30
+
31
+ // This workaround is no longer necessary in React 19,
32
+ // but we currently support React >=17.x
33
+ // https://github.com/facebook/react/pull/26395
34
+ const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
29
35
 
30
36
  /**
31
37
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -34,9 +40,10 @@ var useLayoutEffect = useLayoutEffectImpl;
34
40
  * LICENSE file in the root directory of this source tree.
35
41
  *
36
42
  */
43
+
37
44
  function useLexicalIsTextContentEmpty(editor, trim) {
38
45
  const [isEmpty, setIsEmpty] = useState(editor.getEditorState().read($isRootTextContentEmptyCurry(editor.isComposing(), trim)));
39
- useLayoutEffect(() => {
46
+ useLayoutEffectImpl(() => {
40
47
  return editor.registerUpdateListener(({
41
48
  editorState
42
49
  }) => {
@@ -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 useLexicalIsTextContentEmpty = process.env.NODE_ENV === 'development' ? require('./useLexicalIsTextContentEmpty.dev.js') : require('./useLexicalIsTextContentEmpty.prod.js');
9
11
  module.exports = useLexicalIsTextContentEmpty;
@@ -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 './useLexicalIsTextContentEmpty.dev.mjs';
8
10
  import * as modProd from './useLexicalIsTextContentEmpty.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('./useLexicalIsTextContentEmpty.dev.mjs') : import('./useLexicalIsTextContentEmpty.prod.mjs'));
8
10
  export const useLexicalIsTextContentEmpty = mod.useLexicalIsTextContentEmpty;
@@ -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/text"),e=require("react"),f="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?e.useLayoutEffect:e.useEffect;exports.useLexicalIsTextContentEmpty=function(a,c){let [g,h]=e.useState(a.getEditorState().read(b.$isRootTextContentEmptyCurry(a.isComposing(),c)));f(()=>a.registerUpdateListener(({editorState:d})=>{let k=a.isComposing();d=d.read(b.$isRootTextContentEmptyCurry(k,c));h(d)}),[a,c]);return g}
8
+
9
+ 'use strict';var b=require("@lexical/text"),e=require("react");let f="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?e.useLayoutEffect:e.useEffect;exports.useLexicalIsTextContentEmpty=function(a,c){let [g,h]=e.useState(a.getEditorState().read(b.$isRootTextContentEmptyCurry(a.isComposing(),c)));f(()=>a.registerUpdateListener(({editorState:d})=>{let k=a.isComposing();d=d.read(b.$isRootTextContentEmptyCurry(k,c));h(d)}),[a,c]);return g}
@@ -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{$isRootTextContentEmptyCurry as e}from"@lexical/text";import{useLayoutEffect as t,useEffect as o,useState as i}from"react";var r="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t:o;function n(t,o){const[n,d]=i(t.getEditorState().read(e(t.isComposing(),o)));return r((()=>t.registerUpdateListener((({editorState:i})=>{const r=t.isComposing(),n=i.read(e(r,o));d(n)}))),[t,o]),n}export{n as useLexicalIsTextContentEmpty};
8
+
9
+ import{$isRootTextContentEmptyCurry as t}from"@lexical/text";import{useLayoutEffect as e,useEffect as o,useState as i}from"react";const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?e:o;function r(e,o){const[r,d]=i(e.getEditorState().read(t(e.isComposing(),o)));return n((()=>e.registerUpdateListener((({editorState:i})=>{const n=e.isComposing(),r=i.read(t(n,o));d(r)}))),[e,o]),r}export{r as useLexicalIsTextContentEmpty};
@@ -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');
@@ -17,6 +19,7 @@ var react = require('react');
17
19
  * LICENSE file in the root directory of this source tree.
18
20
  *
19
21
  */
22
+
20
23
  function isNodeSelected(editor, key) {
21
24
  return editor.getEditorState().read(() => {
22
25
  const node = lexical.$getNodeByKey(key);
@@ -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
  */
8
+
7
9
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
- import { $getNodeByKey, $getSelection, $isNodeSelection, $createNodeSelection, $setSelection } from 'lexical';
10
+ import { $getSelection, $isNodeSelection, $createNodeSelection, $setSelection, $getNodeByKey } from 'lexical';
9
11
  import { useState, useEffect, useCallback } from 'react';
10
12
 
11
13
  /**
@@ -15,6 +17,7 @@ import { useState, useEffect, useCallback } from 'react';
15
17
  * LICENSE file in the root directory of this source tree.
16
18
  *
17
19
  */
20
+
18
21
  function isNodeSelected(editor, key) {
19
22
  return editor.getEditorState().read(() => {
20
23
  const node = $getNodeByKey(key);
@@ -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 useLexicalNodeSelection = process.env.NODE_ENV === 'development' ? require('./useLexicalNodeSelection.dev.js') : require('./useLexicalNodeSelection.prod.js');
9
11
  module.exports = useLexicalNodeSelection;
@@ -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 './useLexicalNodeSelection.dev.mjs';
8
10
  import * as modProd from './useLexicalNodeSelection.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('./useLexicalNodeSelection.dev.mjs') : import('./useLexicalNodeSelection.prod.mjs'));
8
10
  export const useLexicalNodeSelection = mod.useLexicalNodeSelection;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict';var b=require("@lexical/react/LexicalComposerContext"),f=require("lexical"),h=require("react");function k(c,a){return c.getEditorState().read(()=>{let g=f.$getNodeByKey(a);return null===g?!1:g.isSelected()})}
8
10
  exports.useLexicalNodeSelection=function(c){let [a]=b.useLexicalComposerContext(),[g,l]=h.useState(()=>k(a,c));h.useEffect(()=>{let e=!0,d=a.registerUpdateListener(()=>{e&&l(k(a,c))});return()=>{e=!1;d()}},[a,c]);let m=h.useCallback(e=>{a.update(()=>{let d=f.$getSelection();f.$isNodeSelection(d)||(d=f.$createNodeSelection(),f.$setSelection(d));f.$isNodeSelection(d)&&(e?d.add(c):d.delete(c))})},[a,c]),n=h.useCallback(()=>{a.update(()=>{const e=f.$getSelection();f.$isNodeSelection(e)&&e.clear()})},
9
11
  [a]);return[g,m,n]}
@@ -3,5 +3,7 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{$getNodeByKey as t,$getSelection as r,$isNodeSelection as o,$createNodeSelection as n,$setSelection as c}from"lexical";import{useState as a,useEffect as i,useCallback as l}from"react";function d(e,r){return e.getEditorState().read((()=>{const e=t(r);return null!==e&&e.isSelected()}))}function u(t){const[u]=e(),[p,s]=a((()=>d(u,t)));i((()=>{let e=!0;const r=u.registerUpdateListener((()=>{e&&s(d(u,t))}));return()=>{e=!1,r()}}),[u,t]);return[p,l((e=>{u.update((()=>{let a=r();o(a)||(a=n(),c(a)),o(a)&&(e?a.add(t):a.delete(t))}))}),[u,t]),l((()=>{u.update((()=>{const e=r();o(e)&&e.clear()}))}),[u])]}export{u as useLexicalNodeSelection};
8
+
9
+ import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{$getSelection as t,$isNodeSelection as r,$createNodeSelection as o,$setSelection as n,$getNodeByKey as c}from"lexical";import{useState as a,useEffect as i,useCallback as l}from"react";function d(e,t){return e.getEditorState().read((()=>{const e=c(t);return null!==e&&e.isSelected()}))}function u(c){const[u]=e(),[p,s]=a((()=>d(u,c)));i((()=>{let e=!0;const t=u.registerUpdateListener((()=>{e&&s(d(u,c))}));return()=>{e=!1,t()}}),[u,c]);return[p,l((e=>{u.update((()=>{let a=t();r(a)||(a=o(),n(a)),r(a)&&(e?a.add(c):a.delete(c))}))}),[u,c]),l((()=>{u.update((()=>{const e=t();r(e)&&e.clear()}))}),[u])]}export{u as useLexicalNodeSelection};
@@ -12,5 +12,8 @@ export type LexicalSubscription<T> = {
12
12
  };
13
13
  /**
14
14
  * Shortcut to Lexical subscriptions when values are used for render.
15
+ * @param subscription - The function to create the {@link LexicalSubscription}. This function's identity must be stable (e.g. defined at module scope or with useCallback).
15
16
  */
16
- export default function useLexicalSubscription<T>(subscription: (editor: LexicalEditor) => LexicalSubscription<T>): T;
17
+ export declare function useLexicalSubscription<T>(subscription: (editor: LexicalEditor) => LexicalSubscription<T>): T;
18
+ /** @deprecated use the named export {@link useLexicalSubscription} */
19
+ export default useLexicalSubscription;
@@ -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');
@@ -26,8 +28,12 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
26
28
  * LICENSE file in the root directory of this source tree.
27
29
  *
28
30
  */
31
+
32
+
33
+ // This workaround is no longer necessary in React 19,
34
+ // but we currently support React >=17.x
35
+ // https://github.com/facebook/react/pull/26395
29
36
  const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
30
- var useLayoutEffect = useLayoutEffectImpl;
31
37
 
32
38
  /**
33
39
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -36,15 +42,17 @@ var useLayoutEffect = useLayoutEffectImpl;
36
42
  * LICENSE file in the root directory of this source tree.
37
43
  *
38
44
  */
45
+
39
46
  /**
40
47
  * Shortcut to Lexical subscriptions when values are used for render.
48
+ * @param subscription - The function to create the {@link LexicalSubscription}. This function's identity must be stable (e.g. defined at module scope or with useCallback).
41
49
  */
42
50
  function useLexicalSubscription(subscription) {
43
51
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
44
52
  const initializedSubscription = react.useMemo(() => subscription(editor), [editor, subscription]);
45
53
  const valueRef = react.useRef(initializedSubscription.initialValueFn());
46
54
  const [value, setValue] = react.useState(valueRef.current);
47
- useLayoutEffect(() => {
55
+ useLayoutEffectImpl(() => {
48
56
  const {
49
57
  initialValueFn,
50
58
  subscribe
@@ -62,4 +70,5 @@ function useLexicalSubscription(subscription) {
62
70
  return value;
63
71
  }
64
72
 
65
- module.exports = useLexicalSubscription;
73
+ exports.default = useLexicalSubscription;
74
+ exports.useLexicalSubscription = useLexicalSubscription;
@@ -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
  */
8
+
7
9
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
- import { useLayoutEffect as useLayoutEffect$1, useEffect, useMemo, useRef, useState } from 'react';
10
+ import { useLayoutEffect, useEffect, useMemo, useRef, useState } from 'react';
9
11
 
10
12
  /**
11
13
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -24,8 +26,12 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
24
26
  * LICENSE file in the root directory of this source tree.
25
27
  *
26
28
  */
27
- const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect$1 : useEffect;
28
- var useLayoutEffect = useLayoutEffectImpl;
29
+
30
+
31
+ // This workaround is no longer necessary in React 19,
32
+ // but we currently support React >=17.x
33
+ // https://github.com/facebook/react/pull/26395
34
+ const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
29
35
 
30
36
  /**
31
37
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -34,15 +40,17 @@ var useLayoutEffect = useLayoutEffectImpl;
34
40
  * LICENSE file in the root directory of this source tree.
35
41
  *
36
42
  */
43
+
37
44
  /**
38
45
  * Shortcut to Lexical subscriptions when values are used for render.
46
+ * @param subscription - The function to create the {@link LexicalSubscription}. This function's identity must be stable (e.g. defined at module scope or with useCallback).
39
47
  */
40
48
  function useLexicalSubscription(subscription) {
41
49
  const [editor] = useLexicalComposerContext();
42
50
  const initializedSubscription = useMemo(() => subscription(editor), [editor, subscription]);
43
51
  const valueRef = useRef(initializedSubscription.initialValueFn());
44
52
  const [value, setValue] = useState(valueRef.current);
45
- useLayoutEffect(() => {
53
+ useLayoutEffectImpl(() => {
46
54
  const {
47
55
  initialValueFn,
48
56
  subscribe
@@ -60,4 +68,4 @@ function useLexicalSubscription(subscription) {
60
68
  return value;
61
69
  }
62
70
 
63
- export { useLexicalSubscription as default };
71
+ export { useLexicalSubscription as default, useLexicalSubscription };
@@ -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 useLexicalSubscription = process.env.NODE_ENV === 'development' ? require('./useLexicalSubscription.dev.js') : require('./useLexicalSubscription.prod.js');
9
11
  module.exports = useLexicalSubscription;
@@ -14,6 +14,9 @@ export type LexicalSubscription<T> = {
14
14
  subscribe: (callback: (value: T) => void) => () => void,
15
15
  };
16
16
 
17
- declare export default function useLexicalSubscription<T>(
17
+ declare export function useLexicalSubscription<T>(
18
18
  subscription: (editor: LexicalEditor) => LexicalSubscription<T>,
19
19
  ): T;
20
+
21
+ /** @deprecated use the named export {@link useLexicalSubscription} */
22
+ declare export default typeof useLexicalSubscription;
@@ -3,8 +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
  */
8
+
7
9
  import * as modDev from './useLexicalSubscription.dev.mjs';
8
10
  import * as modProd from './useLexicalSubscription.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
- export default mod.default;
12
+ export default mod.default;
13
+ export const useLexicalSubscription = mod.useLexicalSubscription;
@@ -3,6 +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('./useLexicalSubscription.dev.mjs') : import('./useLexicalSubscription.prod.mjs'));
8
- export default mod.default;
10
+ export default mod.default;
11
+ export const useLexicalSubscription = mod.useLexicalSubscription;
@@ -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
  */
7
- 'use strict';var a=require("@lexical/react/LexicalComposerContext"),k=require("react"),l="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?k.useLayoutEffect:k.useEffect;
8
- module.exports=function(c){let [f]=a.useLexicalComposerContext(),d=k.useMemo(()=>c(f),[f,c]),b=k.useRef(d.initialValueFn()),[m,g]=k.useState(b.current);l(()=>{let {initialValueFn:n,subscribe:p}=d,e=n();b.current!==e&&(b.current=e,g(e));return p(h=>{b.current=h;g(h)})},[d,c]);return m}
8
+
9
+ 'use strict';var a=require("@lexical/react/LexicalComposerContext"),f=require("react");let l="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?f.useLayoutEffect:f.useEffect;
10
+ function m(c){let [g]=a.useLexicalComposerContext(),d=f.useMemo(()=>c(g),[g,c]),b=f.useRef(d.initialValueFn()),[n,h]=f.useState(b.current);l(()=>{let {initialValueFn:p,subscribe:q}=d,e=p();b.current!==e&&(b.current=e,h(e));return q(k=>{b.current=k;h(k)})},[d,c]);return n}exports.default=m;exports.useLexicalSubscription=m
@@ -3,5 +3,7 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useLayoutEffect as t,useEffect as n,useMemo as r,useRef as o,useState as i}from"react";var c="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t:n;function u(t){const[n]=e(),u=r((()=>t(n)),[n,t]),a=o(u.initialValueFn()),[d,l]=i(a.current);return c((()=>{const{initialValueFn:e,subscribe:t}=u,n=e();return a.current!==n&&(a.current=n,l(n)),t((e=>{a.current=e,l(e)}))}),[u,t]),d}export{u as default};
8
+
9
+ import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useLayoutEffect as t,useEffect as n,useMemo as r,useRef as o,useState as i}from"react";const c="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t:n;function u(t){const[n]=e(),u=r((()=>t(n)),[n,t]),a=o(u.initialValueFn()),[d,l]=i(a.current);return c((()=>{const{initialValueFn:e,subscribe:t}=u,n=e();return a.current!==n&&(a.current=n,l(n)),t((e=>{a.current=e,l(e)}))}),[u,t]),d}export{u as default,u as useLexicalSubscription};
@@ -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
  function useLexicalTextEntity(getMatch, targetNode, createNode) {
22
25
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
23
26
  react.useEffect(() => {
@@ -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 { registerLexicalTextEntity } from '@lexical/text';
9
11
  import { mergeRegister } from '@lexical/utils';
@@ -16,6 +18,7 @@ import { useEffect } from 'react';
16
18
  * LICENSE file in the root directory of this source tree.
17
19
  *
18
20
  */
21
+
19
22
  function useLexicalTextEntity(getMatch, targetNode, createNode) {
20
23
  const [editor] = useLexicalComposerContext();
21
24
  useEffect(() => {
@@ -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 useLexicalTextEntity = process.env.NODE_ENV === 'development' ? require('./useLexicalTextEntity.dev.js') : require('./useLexicalTextEntity.prod.js');
9
11
  module.exports = useLexicalTextEntity;
@@ -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 './useLexicalTextEntity.dev.mjs';
8
10
  import * as modProd from './useLexicalTextEntity.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('./useLexicalTextEntity.dev.mjs') : import('./useLexicalTextEntity.prod.mjs'));
8
10
  export const useLexicalTextEntity = mod.useLexicalTextEntity;
@@ -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
  'use strict';var e=require("@lexical/react/LexicalComposerContext"),f=require("@lexical/text"),g=require("@lexical/utils"),h=require("react");exports.useLexicalTextEntity=function(a,b,c){let [d]=e.useLexicalComposerContext();h.useEffect(()=>g.mergeRegister(...f.registerLexicalTextEntity(d,a,b,c)),[c,d,a,b])}
@@ -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 o}from"@lexical/react/LexicalComposerContext";import{registerLexicalTextEntity as t}from"@lexical/text";import{mergeRegister as r}from"@lexical/utils";import{useEffect as e}from"react";function i(i,m,c){const[l]=o();e((()=>r(...t(l,i,m,c))),[c,l,i,m])}export{i as useLexicalTextEntity};