@lexical/react 0.44.1-nightly.20260519.0 → 0.45.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 (576) hide show
  1. package/README.md +1 -1
  2. package/{LexicalClearEditorPlugin.dev.js → dist/LexicalClearEditorPlugin.dev.js} +2 -11
  3. package/{LexicalClearEditorPlugin.dev.mjs → dist/LexicalClearEditorPlugin.dev.mjs} +1 -10
  4. package/dist/LexicalClearEditorPlugin.prod.js +9 -0
  5. package/dist/LexicalClearEditorPlugin.prod.mjs +9 -0
  6. package/{LexicalComposer.dev.js → dist/LexicalComposer.dev.js} +2 -12
  7. package/{LexicalComposer.dev.mjs → dist/LexicalComposer.dev.mjs} +1 -11
  8. package/dist/LexicalComposer.prod.js +9 -0
  9. package/dist/LexicalComposer.prod.mjs +9 -0
  10. package/{LexicalContentEditable.dev.js → dist/LexicalContentEditable.dev.js} +13 -22
  11. package/{LexicalContentEditable.dev.mjs → dist/LexicalContentEditable.dev.mjs} +12 -21
  12. package/dist/LexicalContentEditable.prod.js +9 -0
  13. package/dist/LexicalContentEditable.prod.mjs +9 -0
  14. package/{LexicalDraggableBlockPlugin.dev.js → dist/LexicalDraggableBlockPlugin.dev.js} +5 -27
  15. package/{LexicalDraggableBlockPlugin.dev.mjs → dist/LexicalDraggableBlockPlugin.dev.mjs} +1 -23
  16. package/dist/LexicalDraggableBlockPlugin.prod.js +9 -0
  17. package/dist/LexicalDraggableBlockPlugin.prod.mjs +9 -0
  18. package/{LexicalNestedComposer.dev.js → dist/LexicalNestedComposer.dev.js} +1 -0
  19. package/{LexicalNestedComposer.dev.mjs → dist/LexicalNestedComposer.dev.mjs} +1 -0
  20. package/{LexicalNodeMenuPlugin.dev.js → dist/LexicalNodeMenuPlugin.dev.js} +24 -34
  21. package/{LexicalNodeMenuPlugin.dev.mjs → dist/LexicalNodeMenuPlugin.dev.mjs} +22 -32
  22. package/dist/LexicalNodeMenuPlugin.prod.js +9 -0
  23. package/dist/LexicalNodeMenuPlugin.prod.mjs +9 -0
  24. package/{LexicalOnChangePlugin.dev.js → dist/LexicalOnChangePlugin.dev.js} +1 -11
  25. package/{LexicalOnChangePlugin.dev.mjs → dist/LexicalOnChangePlugin.dev.mjs} +1 -11
  26. package/dist/LexicalOnChangePlugin.prod.js +9 -0
  27. package/dist/LexicalOnChangePlugin.prod.mjs +9 -0
  28. package/{LexicalPlainTextPlugin.dev.js → dist/LexicalPlainTextPlugin.dev.js} +2 -11
  29. package/{LexicalPlainTextPlugin.dev.mjs → dist/LexicalPlainTextPlugin.dev.mjs} +1 -10
  30. package/dist/LexicalPlainTextPlugin.prod.js +9 -0
  31. package/dist/LexicalPlainTextPlugin.prod.mjs +9 -0
  32. package/{LexicalRichTextPlugin.dev.js → dist/LexicalRichTextPlugin.dev.js} +2 -11
  33. package/{LexicalRichTextPlugin.dev.mjs → dist/LexicalRichTextPlugin.dev.mjs} +1 -10
  34. package/dist/LexicalRichTextPlugin.prod.js +9 -0
  35. package/dist/LexicalRichTextPlugin.prod.mjs +9 -0
  36. package/{LexicalTablePlugin.dev.js → dist/LexicalTablePlugin.dev.js} +6 -3
  37. package/{LexicalTablePlugin.dev.mjs → dist/LexicalTablePlugin.dev.mjs} +7 -4
  38. package/dist/LexicalTablePlugin.prod.js +9 -0
  39. package/dist/LexicalTablePlugin.prod.mjs +9 -0
  40. package/{LexicalTypeaheadMenuPlugin.dev.js → dist/LexicalTypeaheadMenuPlugin.dev.js} +24 -34
  41. package/{LexicalTypeaheadMenuPlugin.dev.mjs → dist/LexicalTypeaheadMenuPlugin.dev.mjs} +22 -32
  42. package/dist/LexicalTypeaheadMenuPlugin.prod.js +9 -0
  43. package/dist/LexicalTypeaheadMenuPlugin.prod.mjs +9 -0
  44. package/dist/shared/reactPatches.d.ts +8 -0
  45. package/dist/shared/useLayoutEffect.d.ts +10 -0
  46. package/{useLexicalEditable.dev.js → dist/useLexicalEditable.dev.js} +2 -11
  47. package/{useLexicalEditable.dev.mjs → dist/useLexicalEditable.dev.mjs} +1 -10
  48. package/dist/useLexicalEditable.prod.js +9 -0
  49. package/dist/useLexicalEditable.prod.mjs +9 -0
  50. package/{useLexicalIsTextContentEmpty.dev.js → dist/useLexicalIsTextContentEmpty.dev.js} +2 -11
  51. package/{useLexicalIsTextContentEmpty.dev.mjs → dist/useLexicalIsTextContentEmpty.dev.mjs} +1 -10
  52. package/dist/useLexicalIsTextContentEmpty.prod.js +9 -0
  53. package/dist/useLexicalIsTextContentEmpty.prod.mjs +9 -0
  54. package/{useLexicalSubscription.dev.js → dist/useLexicalSubscription.dev.js} +2 -11
  55. package/{useLexicalSubscription.dev.mjs → dist/useLexicalSubscription.dev.mjs} +1 -10
  56. package/dist/useLexicalSubscription.prod.js +9 -0
  57. package/dist/useLexicalSubscription.prod.mjs +9 -0
  58. package/package.json +1054 -938
  59. package/src/ExtensionComponent.tsx +59 -0
  60. package/src/LexicalAutoEmbedPlugin.tsx +300 -0
  61. package/src/LexicalAutoFocusPlugin.ts +41 -0
  62. package/src/LexicalAutoLinkPlugin.ts +61 -0
  63. package/src/LexicalBlockWithAlignableContents.tsx +119 -0
  64. package/src/LexicalCharacterLimitPlugin.tsx +91 -0
  65. package/src/LexicalCheckListPlugin.tsx +24 -0
  66. package/src/LexicalClearEditorPlugin.ts +27 -0
  67. package/src/LexicalClickableLinkPlugin.tsx +28 -0
  68. package/src/LexicalCollaborationContext.tsx +91 -0
  69. package/src/LexicalCollaborationPlugin.tsx +266 -0
  70. package/src/LexicalComposer.tsx +185 -0
  71. package/src/LexicalComposerContext.ts +63 -0
  72. package/src/LexicalContentEditable.tsx +98 -0
  73. package/src/LexicalDecoratorBlockNode.ts +87 -0
  74. package/src/LexicalDraggableBlockPlugin.tsx +601 -0
  75. package/src/LexicalEditorRefPlugin.tsx +41 -0
  76. package/src/LexicalErrorBoundary.tsx +46 -0
  77. package/src/LexicalExtensionComposer.tsx +117 -0
  78. package/src/LexicalExtensionEditorComposer.tsx +46 -0
  79. package/src/LexicalHashtagPlugin.ts +26 -0
  80. package/src/LexicalHistoryPlugin.ts +31 -0
  81. package/src/LexicalHorizontalRuleNode.tsx +123 -0
  82. package/src/LexicalHorizontalRulePlugin.ts +52 -0
  83. package/src/LexicalLinkPlugin.ts +32 -0
  84. package/src/LexicalListPlugin.ts +60 -0
  85. package/src/LexicalMarkdownShortcutPlugin.tsx +56 -0
  86. package/src/LexicalNestedComposer.tsx +221 -0
  87. package/src/LexicalNodeContextMenuPlugin.tsx +316 -0
  88. package/src/LexicalNodeEventPlugin.ts +71 -0
  89. package/src/LexicalNodeMenuPlugin.tsx +131 -0
  90. package/src/LexicalOnChangePlugin.ts +52 -0
  91. package/src/LexicalPlainTextPlugin.tsx +65 -0
  92. package/src/LexicalRichTextPlugin.tsx +65 -0
  93. package/src/LexicalSelectionAlwaysOnDisplay.tsx +24 -0
  94. package/src/LexicalTabIndentationPlugin.tsx +40 -0
  95. package/src/LexicalTableOfContentsPlugin.tsx +277 -0
  96. package/src/LexicalTablePlugin.ts +118 -0
  97. package/src/LexicalTreeView.tsx +128 -0
  98. package/src/LexicalTypeaheadMenuPlugin.tsx +365 -0
  99. package/src/ReactExtension.tsx +113 -0
  100. package/src/ReactPluginHostExtension.tsx +228 -0
  101. package/src/ReactProviderExtension.tsx +20 -0
  102. package/src/TreeViewExtension.tsx +48 -0
  103. package/src/shared/LegacyDecorators.tsx +62 -0
  104. package/src/shared/LexicalContentEditableElement.tsx +126 -0
  105. package/src/shared/LexicalMenu.tsx +738 -0
  106. package/src/shared/buildEditorComponent.tsx +60 -0
  107. package/src/shared/mergeRefs.ts +20 -0
  108. package/src/shared/point.ts +55 -0
  109. package/src/shared/reactPatches.ts +22 -0
  110. package/src/shared/rect.ts +158 -0
  111. package/src/shared/types.ts +106 -0
  112. package/src/shared/useCanShowPlaceholder.ts +50 -0
  113. package/src/shared/useCharacterLimit.ts +314 -0
  114. package/src/shared/useDecorators.tsx +73 -0
  115. package/src/shared/useHistory.ts +28 -0
  116. package/src/shared/useLayoutEffect.ts +19 -0
  117. package/src/shared/useList.ts +18 -0
  118. package/src/shared/usePlainTextSetup.ts +24 -0
  119. package/src/shared/useReactDecorators.tsx +53 -0
  120. package/src/shared/useRichTextSetup.ts +24 -0
  121. package/src/shared/useYjsCollaboration.tsx +694 -0
  122. package/src/useExtensionComponent.tsx +57 -0
  123. package/src/useExtensionSignalValue.ts +85 -0
  124. package/src/useLexicalEditable.ts +33 -0
  125. package/src/useLexicalIsTextContentEmpty.ts +37 -0
  126. package/src/useLexicalNodeSelection.ts +114 -0
  127. package/src/useLexicalSubscription.tsx +52 -0
  128. package/src/useLexicalTextEntity.ts +29 -0
  129. package/LexicalClearEditorPlugin.prod.js +0 -9
  130. package/LexicalClearEditorPlugin.prod.mjs +0 -9
  131. package/LexicalComposer.prod.js +0 -9
  132. package/LexicalComposer.prod.mjs +0 -9
  133. package/LexicalContentEditable.prod.js +0 -9
  134. package/LexicalContentEditable.prod.mjs +0 -9
  135. package/LexicalDraggableBlockPlugin.prod.js +0 -9
  136. package/LexicalDraggableBlockPlugin.prod.mjs +0 -9
  137. package/LexicalNodeMenuPlugin.prod.js +0 -9
  138. package/LexicalNodeMenuPlugin.prod.mjs +0 -9
  139. package/LexicalOnChangePlugin.prod.js +0 -9
  140. package/LexicalOnChangePlugin.prod.mjs +0 -9
  141. package/LexicalPlainTextPlugin.prod.js +0 -9
  142. package/LexicalPlainTextPlugin.prod.mjs +0 -9
  143. package/LexicalRichTextPlugin.prod.js +0 -9
  144. package/LexicalRichTextPlugin.prod.mjs +0 -9
  145. package/LexicalTablePlugin.prod.js +0 -9
  146. package/LexicalTablePlugin.prod.mjs +0 -9
  147. package/LexicalTypeaheadMenuPlugin.prod.js +0 -9
  148. package/LexicalTypeaheadMenuPlugin.prod.mjs +0 -9
  149. package/useLexicalEditable.prod.js +0 -9
  150. package/useLexicalEditable.prod.mjs +0 -9
  151. package/useLexicalIsTextContentEmpty.prod.js +0 -9
  152. package/useLexicalIsTextContentEmpty.prod.mjs +0 -9
  153. package/useLexicalSubscription.prod.js +0 -9
  154. package/useLexicalSubscription.prod.mjs +0 -9
  155. /package/{ExtensionComponent.d.ts → dist/ExtensionComponent.d.ts} +0 -0
  156. /package/{LexicalAutoEmbedPlugin.d.ts → dist/LexicalAutoEmbedPlugin.d.ts} +0 -0
  157. /package/{LexicalAutoEmbedPlugin.dev.js → dist/LexicalAutoEmbedPlugin.dev.js} +0 -0
  158. /package/{LexicalAutoEmbedPlugin.dev.mjs → dist/LexicalAutoEmbedPlugin.dev.mjs} +0 -0
  159. /package/{LexicalAutoEmbedPlugin.js → dist/LexicalAutoEmbedPlugin.js} +0 -0
  160. /package/{LexicalAutoEmbedPlugin.js.flow → dist/LexicalAutoEmbedPlugin.js.flow} +0 -0
  161. /package/{LexicalAutoEmbedPlugin.mjs → dist/LexicalAutoEmbedPlugin.mjs} +0 -0
  162. /package/{LexicalAutoEmbedPlugin.node.mjs → dist/LexicalAutoEmbedPlugin.node.mjs} +0 -0
  163. /package/{LexicalAutoEmbedPlugin.prod.js → dist/LexicalAutoEmbedPlugin.prod.js} +0 -0
  164. /package/{LexicalAutoEmbedPlugin.prod.mjs → dist/LexicalAutoEmbedPlugin.prod.mjs} +0 -0
  165. /package/{LexicalAutoFocusPlugin.d.ts → dist/LexicalAutoFocusPlugin.d.ts} +0 -0
  166. /package/{LexicalAutoFocusPlugin.dev.js → dist/LexicalAutoFocusPlugin.dev.js} +0 -0
  167. /package/{LexicalAutoFocusPlugin.dev.mjs → dist/LexicalAutoFocusPlugin.dev.mjs} +0 -0
  168. /package/{LexicalAutoFocusPlugin.js → dist/LexicalAutoFocusPlugin.js} +0 -0
  169. /package/{LexicalAutoFocusPlugin.js.flow → dist/LexicalAutoFocusPlugin.js.flow} +0 -0
  170. /package/{LexicalAutoFocusPlugin.mjs → dist/LexicalAutoFocusPlugin.mjs} +0 -0
  171. /package/{LexicalAutoFocusPlugin.node.mjs → dist/LexicalAutoFocusPlugin.node.mjs} +0 -0
  172. /package/{LexicalAutoFocusPlugin.prod.js → dist/LexicalAutoFocusPlugin.prod.js} +0 -0
  173. /package/{LexicalAutoFocusPlugin.prod.mjs → dist/LexicalAutoFocusPlugin.prod.mjs} +0 -0
  174. /package/{LexicalAutoLinkPlugin.d.ts → dist/LexicalAutoLinkPlugin.d.ts} +0 -0
  175. /package/{LexicalAutoLinkPlugin.dev.js → dist/LexicalAutoLinkPlugin.dev.js} +0 -0
  176. /package/{LexicalAutoLinkPlugin.dev.mjs → dist/LexicalAutoLinkPlugin.dev.mjs} +0 -0
  177. /package/{LexicalAutoLinkPlugin.js → dist/LexicalAutoLinkPlugin.js} +0 -0
  178. /package/{LexicalAutoLinkPlugin.js.flow → dist/LexicalAutoLinkPlugin.js.flow} +0 -0
  179. /package/{LexicalAutoLinkPlugin.mjs → dist/LexicalAutoLinkPlugin.mjs} +0 -0
  180. /package/{LexicalAutoLinkPlugin.node.mjs → dist/LexicalAutoLinkPlugin.node.mjs} +0 -0
  181. /package/{LexicalAutoLinkPlugin.prod.js → dist/LexicalAutoLinkPlugin.prod.js} +0 -0
  182. /package/{LexicalAutoLinkPlugin.prod.mjs → dist/LexicalAutoLinkPlugin.prod.mjs} +0 -0
  183. /package/{LexicalBlockWithAlignableContents.d.ts → dist/LexicalBlockWithAlignableContents.d.ts} +0 -0
  184. /package/{LexicalBlockWithAlignableContents.dev.js → dist/LexicalBlockWithAlignableContents.dev.js} +0 -0
  185. /package/{LexicalBlockWithAlignableContents.dev.mjs → dist/LexicalBlockWithAlignableContents.dev.mjs} +0 -0
  186. /package/{LexicalBlockWithAlignableContents.js → dist/LexicalBlockWithAlignableContents.js} +0 -0
  187. /package/{LexicalBlockWithAlignableContents.js.flow → dist/LexicalBlockWithAlignableContents.js.flow} +0 -0
  188. /package/{LexicalBlockWithAlignableContents.mjs → dist/LexicalBlockWithAlignableContents.mjs} +0 -0
  189. /package/{LexicalBlockWithAlignableContents.node.mjs → dist/LexicalBlockWithAlignableContents.node.mjs} +0 -0
  190. /package/{LexicalBlockWithAlignableContents.prod.js → dist/LexicalBlockWithAlignableContents.prod.js} +0 -0
  191. /package/{LexicalBlockWithAlignableContents.prod.mjs → dist/LexicalBlockWithAlignableContents.prod.mjs} +0 -0
  192. /package/{LexicalCharacterLimitPlugin.d.ts → dist/LexicalCharacterLimitPlugin.d.ts} +0 -0
  193. /package/{LexicalCharacterLimitPlugin.dev.js → dist/LexicalCharacterLimitPlugin.dev.js} +0 -0
  194. /package/{LexicalCharacterLimitPlugin.dev.mjs → dist/LexicalCharacterLimitPlugin.dev.mjs} +0 -0
  195. /package/{LexicalCharacterLimitPlugin.js → dist/LexicalCharacterLimitPlugin.js} +0 -0
  196. /package/{LexicalCharacterLimitPlugin.js.flow → dist/LexicalCharacterLimitPlugin.js.flow} +0 -0
  197. /package/{LexicalCharacterLimitPlugin.mjs → dist/LexicalCharacterLimitPlugin.mjs} +0 -0
  198. /package/{LexicalCharacterLimitPlugin.node.mjs → dist/LexicalCharacterLimitPlugin.node.mjs} +0 -0
  199. /package/{LexicalCharacterLimitPlugin.prod.js → dist/LexicalCharacterLimitPlugin.prod.js} +0 -0
  200. /package/{LexicalCharacterLimitPlugin.prod.mjs → dist/LexicalCharacterLimitPlugin.prod.mjs} +0 -0
  201. /package/{LexicalCheckListPlugin.d.ts → dist/LexicalCheckListPlugin.d.ts} +0 -0
  202. /package/{LexicalCheckListPlugin.dev.js → dist/LexicalCheckListPlugin.dev.js} +0 -0
  203. /package/{LexicalCheckListPlugin.dev.mjs → dist/LexicalCheckListPlugin.dev.mjs} +0 -0
  204. /package/{LexicalCheckListPlugin.js → dist/LexicalCheckListPlugin.js} +0 -0
  205. /package/{LexicalCheckListPlugin.js.flow → dist/LexicalCheckListPlugin.js.flow} +0 -0
  206. /package/{LexicalCheckListPlugin.mjs → dist/LexicalCheckListPlugin.mjs} +0 -0
  207. /package/{LexicalCheckListPlugin.node.mjs → dist/LexicalCheckListPlugin.node.mjs} +0 -0
  208. /package/{LexicalCheckListPlugin.prod.js → dist/LexicalCheckListPlugin.prod.js} +0 -0
  209. /package/{LexicalCheckListPlugin.prod.mjs → dist/LexicalCheckListPlugin.prod.mjs} +0 -0
  210. /package/{LexicalClearEditorPlugin.d.ts → dist/LexicalClearEditorPlugin.d.ts} +0 -0
  211. /package/{LexicalClearEditorPlugin.js → dist/LexicalClearEditorPlugin.js} +0 -0
  212. /package/{LexicalClearEditorPlugin.js.flow → dist/LexicalClearEditorPlugin.js.flow} +0 -0
  213. /package/{LexicalClearEditorPlugin.mjs → dist/LexicalClearEditorPlugin.mjs} +0 -0
  214. /package/{LexicalClearEditorPlugin.node.mjs → dist/LexicalClearEditorPlugin.node.mjs} +0 -0
  215. /package/{LexicalClickableLinkPlugin.d.ts → dist/LexicalClickableLinkPlugin.d.ts} +0 -0
  216. /package/{LexicalClickableLinkPlugin.dev.js → dist/LexicalClickableLinkPlugin.dev.js} +0 -0
  217. /package/{LexicalClickableLinkPlugin.dev.mjs → dist/LexicalClickableLinkPlugin.dev.mjs} +0 -0
  218. /package/{LexicalClickableLinkPlugin.js → dist/LexicalClickableLinkPlugin.js} +0 -0
  219. /package/{LexicalClickableLinkPlugin.js.flow → dist/LexicalClickableLinkPlugin.js.flow} +0 -0
  220. /package/{LexicalClickableLinkPlugin.mjs → dist/LexicalClickableLinkPlugin.mjs} +0 -0
  221. /package/{LexicalClickableLinkPlugin.node.mjs → dist/LexicalClickableLinkPlugin.node.mjs} +0 -0
  222. /package/{LexicalClickableLinkPlugin.prod.js → dist/LexicalClickableLinkPlugin.prod.js} +0 -0
  223. /package/{LexicalClickableLinkPlugin.prod.mjs → dist/LexicalClickableLinkPlugin.prod.mjs} +0 -0
  224. /package/{LexicalCollaborationContext.d.ts → dist/LexicalCollaborationContext.d.ts} +0 -0
  225. /package/{LexicalCollaborationContext.dev.js → dist/LexicalCollaborationContext.dev.js} +0 -0
  226. /package/{LexicalCollaborationContext.dev.mjs → dist/LexicalCollaborationContext.dev.mjs} +0 -0
  227. /package/{LexicalCollaborationContext.js → dist/LexicalCollaborationContext.js} +0 -0
  228. /package/{LexicalCollaborationContext.js.flow → dist/LexicalCollaborationContext.js.flow} +0 -0
  229. /package/{LexicalCollaborationContext.mjs → dist/LexicalCollaborationContext.mjs} +0 -0
  230. /package/{LexicalCollaborationContext.node.mjs → dist/LexicalCollaborationContext.node.mjs} +0 -0
  231. /package/{LexicalCollaborationContext.prod.js → dist/LexicalCollaborationContext.prod.js} +0 -0
  232. /package/{LexicalCollaborationContext.prod.mjs → dist/LexicalCollaborationContext.prod.mjs} +0 -0
  233. /package/{LexicalCollaborationPlugin.d.ts → dist/LexicalCollaborationPlugin.d.ts} +0 -0
  234. /package/{LexicalCollaborationPlugin.dev.js → dist/LexicalCollaborationPlugin.dev.js} +0 -0
  235. /package/{LexicalCollaborationPlugin.dev.mjs → dist/LexicalCollaborationPlugin.dev.mjs} +0 -0
  236. /package/{LexicalCollaborationPlugin.js → dist/LexicalCollaborationPlugin.js} +0 -0
  237. /package/{LexicalCollaborationPlugin.js.flow → dist/LexicalCollaborationPlugin.js.flow} +0 -0
  238. /package/{LexicalCollaborationPlugin.mjs → dist/LexicalCollaborationPlugin.mjs} +0 -0
  239. /package/{LexicalCollaborationPlugin.node.mjs → dist/LexicalCollaborationPlugin.node.mjs} +0 -0
  240. /package/{LexicalCollaborationPlugin.prod.js → dist/LexicalCollaborationPlugin.prod.js} +0 -0
  241. /package/{LexicalCollaborationPlugin.prod.mjs → dist/LexicalCollaborationPlugin.prod.mjs} +0 -0
  242. /package/{LexicalComposer.d.ts → dist/LexicalComposer.d.ts} +0 -0
  243. /package/{LexicalComposer.js → dist/LexicalComposer.js} +0 -0
  244. /package/{LexicalComposer.js.flow → dist/LexicalComposer.js.flow} +0 -0
  245. /package/{LexicalComposer.mjs → dist/LexicalComposer.mjs} +0 -0
  246. /package/{LexicalComposer.node.mjs → dist/LexicalComposer.node.mjs} +0 -0
  247. /package/{LexicalComposerContext.d.ts → dist/LexicalComposerContext.d.ts} +0 -0
  248. /package/{LexicalComposerContext.dev.js → dist/LexicalComposerContext.dev.js} +0 -0
  249. /package/{LexicalComposerContext.dev.mjs → dist/LexicalComposerContext.dev.mjs} +0 -0
  250. /package/{LexicalComposerContext.js → dist/LexicalComposerContext.js} +0 -0
  251. /package/{LexicalComposerContext.js.flow → dist/LexicalComposerContext.js.flow} +0 -0
  252. /package/{LexicalComposerContext.mjs → dist/LexicalComposerContext.mjs} +0 -0
  253. /package/{LexicalComposerContext.node.mjs → dist/LexicalComposerContext.node.mjs} +0 -0
  254. /package/{LexicalComposerContext.prod.js → dist/LexicalComposerContext.prod.js} +0 -0
  255. /package/{LexicalComposerContext.prod.mjs → dist/LexicalComposerContext.prod.mjs} +0 -0
  256. /package/{LexicalContentEditable.d.ts → dist/LexicalContentEditable.d.ts} +0 -0
  257. /package/{LexicalContentEditable.js → dist/LexicalContentEditable.js} +0 -0
  258. /package/{LexicalContentEditable.js.flow → dist/LexicalContentEditable.js.flow} +0 -0
  259. /package/{LexicalContentEditable.mjs → dist/LexicalContentEditable.mjs} +0 -0
  260. /package/{LexicalContentEditable.node.mjs → dist/LexicalContentEditable.node.mjs} +0 -0
  261. /package/{LexicalDecoratorBlockNode.d.ts → dist/LexicalDecoratorBlockNode.d.ts} +0 -0
  262. /package/{LexicalDecoratorBlockNode.dev.js → dist/LexicalDecoratorBlockNode.dev.js} +0 -0
  263. /package/{LexicalDecoratorBlockNode.dev.mjs → dist/LexicalDecoratorBlockNode.dev.mjs} +0 -0
  264. /package/{LexicalDecoratorBlockNode.js → dist/LexicalDecoratorBlockNode.js} +0 -0
  265. /package/{LexicalDecoratorBlockNode.js.flow → dist/LexicalDecoratorBlockNode.js.flow} +0 -0
  266. /package/{LexicalDecoratorBlockNode.mjs → dist/LexicalDecoratorBlockNode.mjs} +0 -0
  267. /package/{LexicalDecoratorBlockNode.node.mjs → dist/LexicalDecoratorBlockNode.node.mjs} +0 -0
  268. /package/{LexicalDecoratorBlockNode.prod.js → dist/LexicalDecoratorBlockNode.prod.js} +0 -0
  269. /package/{LexicalDecoratorBlockNode.prod.mjs → dist/LexicalDecoratorBlockNode.prod.mjs} +0 -0
  270. /package/{LexicalDraggableBlockPlugin.d.ts → dist/LexicalDraggableBlockPlugin.d.ts} +0 -0
  271. /package/{LexicalDraggableBlockPlugin.js → dist/LexicalDraggableBlockPlugin.js} +0 -0
  272. /package/{LexicalDraggableBlockPlugin.js.flow → dist/LexicalDraggableBlockPlugin.js.flow} +0 -0
  273. /package/{LexicalDraggableBlockPlugin.mjs → dist/LexicalDraggableBlockPlugin.mjs} +0 -0
  274. /package/{LexicalDraggableBlockPlugin.node.mjs → dist/LexicalDraggableBlockPlugin.node.mjs} +0 -0
  275. /package/{LexicalEditorRefPlugin.d.ts → dist/LexicalEditorRefPlugin.d.ts} +0 -0
  276. /package/{LexicalEditorRefPlugin.dev.js → dist/LexicalEditorRefPlugin.dev.js} +0 -0
  277. /package/{LexicalEditorRefPlugin.dev.mjs → dist/LexicalEditorRefPlugin.dev.mjs} +0 -0
  278. /package/{LexicalEditorRefPlugin.js → dist/LexicalEditorRefPlugin.js} +0 -0
  279. /package/{LexicalEditorRefPlugin.js.flow → dist/LexicalEditorRefPlugin.js.flow} +0 -0
  280. /package/{LexicalEditorRefPlugin.mjs → dist/LexicalEditorRefPlugin.mjs} +0 -0
  281. /package/{LexicalEditorRefPlugin.node.mjs → dist/LexicalEditorRefPlugin.node.mjs} +0 -0
  282. /package/{LexicalEditorRefPlugin.prod.js → dist/LexicalEditorRefPlugin.prod.js} +0 -0
  283. /package/{LexicalEditorRefPlugin.prod.mjs → dist/LexicalEditorRefPlugin.prod.mjs} +0 -0
  284. /package/{LexicalErrorBoundary.d.ts → dist/LexicalErrorBoundary.d.ts} +0 -0
  285. /package/{LexicalErrorBoundary.dev.js → dist/LexicalErrorBoundary.dev.js} +0 -0
  286. /package/{LexicalErrorBoundary.dev.mjs → dist/LexicalErrorBoundary.dev.mjs} +0 -0
  287. /package/{LexicalErrorBoundary.js → dist/LexicalErrorBoundary.js} +0 -0
  288. /package/{LexicalErrorBoundary.js.flow → dist/LexicalErrorBoundary.js.flow} +0 -0
  289. /package/{LexicalErrorBoundary.mjs → dist/LexicalErrorBoundary.mjs} +0 -0
  290. /package/{LexicalErrorBoundary.node.mjs → dist/LexicalErrorBoundary.node.mjs} +0 -0
  291. /package/{LexicalErrorBoundary.prod.js → dist/LexicalErrorBoundary.prod.js} +0 -0
  292. /package/{LexicalErrorBoundary.prod.mjs → dist/LexicalErrorBoundary.prod.mjs} +0 -0
  293. /package/{LexicalExtensionComponent.dev.js → dist/LexicalExtensionComponent.dev.js} +0 -0
  294. /package/{LexicalExtensionComponent.dev.mjs → dist/LexicalExtensionComponent.dev.mjs} +0 -0
  295. /package/{LexicalExtensionComponent.js → dist/LexicalExtensionComponent.js} +0 -0
  296. /package/{LexicalExtensionComponent.js.flow → dist/LexicalExtensionComponent.js.flow} +0 -0
  297. /package/{LexicalExtensionComponent.mjs → dist/LexicalExtensionComponent.mjs} +0 -0
  298. /package/{LexicalExtensionComponent.node.mjs → dist/LexicalExtensionComponent.node.mjs} +0 -0
  299. /package/{LexicalExtensionComponent.prod.js → dist/LexicalExtensionComponent.prod.js} +0 -0
  300. /package/{LexicalExtensionComponent.prod.mjs → dist/LexicalExtensionComponent.prod.mjs} +0 -0
  301. /package/{LexicalExtensionComposer.d.ts → dist/LexicalExtensionComposer.d.ts} +0 -0
  302. /package/{LexicalExtensionComposer.dev.js → dist/LexicalExtensionComposer.dev.js} +0 -0
  303. /package/{LexicalExtensionComposer.dev.mjs → dist/LexicalExtensionComposer.dev.mjs} +0 -0
  304. /package/{LexicalExtensionComposer.js → dist/LexicalExtensionComposer.js} +0 -0
  305. /package/{LexicalExtensionComposer.js.flow → dist/LexicalExtensionComposer.js.flow} +0 -0
  306. /package/{LexicalExtensionComposer.mjs → dist/LexicalExtensionComposer.mjs} +0 -0
  307. /package/{LexicalExtensionComposer.node.mjs → dist/LexicalExtensionComposer.node.mjs} +0 -0
  308. /package/{LexicalExtensionComposer.prod.js → dist/LexicalExtensionComposer.prod.js} +0 -0
  309. /package/{LexicalExtensionComposer.prod.mjs → dist/LexicalExtensionComposer.prod.mjs} +0 -0
  310. /package/{LexicalExtensionEditorComposer.d.ts → dist/LexicalExtensionEditorComposer.d.ts} +0 -0
  311. /package/{LexicalExtensionEditorComposer.dev.js → dist/LexicalExtensionEditorComposer.dev.js} +0 -0
  312. /package/{LexicalExtensionEditorComposer.dev.mjs → dist/LexicalExtensionEditorComposer.dev.mjs} +0 -0
  313. /package/{LexicalExtensionEditorComposer.js → dist/LexicalExtensionEditorComposer.js} +0 -0
  314. /package/{LexicalExtensionEditorComposer.js.flow → dist/LexicalExtensionEditorComposer.js.flow} +0 -0
  315. /package/{LexicalExtensionEditorComposer.mjs → dist/LexicalExtensionEditorComposer.mjs} +0 -0
  316. /package/{LexicalExtensionEditorComposer.node.mjs → dist/LexicalExtensionEditorComposer.node.mjs} +0 -0
  317. /package/{LexicalExtensionEditorComposer.prod.js → dist/LexicalExtensionEditorComposer.prod.js} +0 -0
  318. /package/{LexicalExtensionEditorComposer.prod.mjs → dist/LexicalExtensionEditorComposer.prod.mjs} +0 -0
  319. /package/{LexicalHashtagPlugin.d.ts → dist/LexicalHashtagPlugin.d.ts} +0 -0
  320. /package/{LexicalHashtagPlugin.dev.js → dist/LexicalHashtagPlugin.dev.js} +0 -0
  321. /package/{LexicalHashtagPlugin.dev.mjs → dist/LexicalHashtagPlugin.dev.mjs} +0 -0
  322. /package/{LexicalHashtagPlugin.js → dist/LexicalHashtagPlugin.js} +0 -0
  323. /package/{LexicalHashtagPlugin.js.flow → dist/LexicalHashtagPlugin.js.flow} +0 -0
  324. /package/{LexicalHashtagPlugin.mjs → dist/LexicalHashtagPlugin.mjs} +0 -0
  325. /package/{LexicalHashtagPlugin.node.mjs → dist/LexicalHashtagPlugin.node.mjs} +0 -0
  326. /package/{LexicalHashtagPlugin.prod.js → dist/LexicalHashtagPlugin.prod.js} +0 -0
  327. /package/{LexicalHashtagPlugin.prod.mjs → dist/LexicalHashtagPlugin.prod.mjs} +0 -0
  328. /package/{LexicalHistoryPlugin.d.ts → dist/LexicalHistoryPlugin.d.ts} +0 -0
  329. /package/{LexicalHistoryPlugin.dev.js → dist/LexicalHistoryPlugin.dev.js} +0 -0
  330. /package/{LexicalHistoryPlugin.dev.mjs → dist/LexicalHistoryPlugin.dev.mjs} +0 -0
  331. /package/{LexicalHistoryPlugin.js → dist/LexicalHistoryPlugin.js} +0 -0
  332. /package/{LexicalHistoryPlugin.js.flow → dist/LexicalHistoryPlugin.js.flow} +0 -0
  333. /package/{LexicalHistoryPlugin.mjs → dist/LexicalHistoryPlugin.mjs} +0 -0
  334. /package/{LexicalHistoryPlugin.node.mjs → dist/LexicalHistoryPlugin.node.mjs} +0 -0
  335. /package/{LexicalHistoryPlugin.prod.js → dist/LexicalHistoryPlugin.prod.js} +0 -0
  336. /package/{LexicalHistoryPlugin.prod.mjs → dist/LexicalHistoryPlugin.prod.mjs} +0 -0
  337. /package/{LexicalHorizontalRuleNode.d.ts → dist/LexicalHorizontalRuleNode.d.ts} +0 -0
  338. /package/{LexicalHorizontalRuleNode.dev.js → dist/LexicalHorizontalRuleNode.dev.js} +0 -0
  339. /package/{LexicalHorizontalRuleNode.dev.mjs → dist/LexicalHorizontalRuleNode.dev.mjs} +0 -0
  340. /package/{LexicalHorizontalRuleNode.js → dist/LexicalHorizontalRuleNode.js} +0 -0
  341. /package/{LexicalHorizontalRuleNode.js.flow → dist/LexicalHorizontalRuleNode.js.flow} +0 -0
  342. /package/{LexicalHorizontalRuleNode.mjs → dist/LexicalHorizontalRuleNode.mjs} +0 -0
  343. /package/{LexicalHorizontalRuleNode.node.mjs → dist/LexicalHorizontalRuleNode.node.mjs} +0 -0
  344. /package/{LexicalHorizontalRuleNode.prod.js → dist/LexicalHorizontalRuleNode.prod.js} +0 -0
  345. /package/{LexicalHorizontalRuleNode.prod.mjs → dist/LexicalHorizontalRuleNode.prod.mjs} +0 -0
  346. /package/{LexicalHorizontalRulePlugin.d.ts → dist/LexicalHorizontalRulePlugin.d.ts} +0 -0
  347. /package/{LexicalHorizontalRulePlugin.dev.js → dist/LexicalHorizontalRulePlugin.dev.js} +0 -0
  348. /package/{LexicalHorizontalRulePlugin.dev.mjs → dist/LexicalHorizontalRulePlugin.dev.mjs} +0 -0
  349. /package/{LexicalHorizontalRulePlugin.js → dist/LexicalHorizontalRulePlugin.js} +0 -0
  350. /package/{LexicalHorizontalRulePlugin.js.flow → dist/LexicalHorizontalRulePlugin.js.flow} +0 -0
  351. /package/{LexicalHorizontalRulePlugin.mjs → dist/LexicalHorizontalRulePlugin.mjs} +0 -0
  352. /package/{LexicalHorizontalRulePlugin.node.mjs → dist/LexicalHorizontalRulePlugin.node.mjs} +0 -0
  353. /package/{LexicalHorizontalRulePlugin.prod.js → dist/LexicalHorizontalRulePlugin.prod.js} +0 -0
  354. /package/{LexicalHorizontalRulePlugin.prod.mjs → dist/LexicalHorizontalRulePlugin.prod.mjs} +0 -0
  355. /package/{LexicalLinkPlugin.d.ts → dist/LexicalLinkPlugin.d.ts} +0 -0
  356. /package/{LexicalLinkPlugin.dev.js → dist/LexicalLinkPlugin.dev.js} +0 -0
  357. /package/{LexicalLinkPlugin.dev.mjs → dist/LexicalLinkPlugin.dev.mjs} +0 -0
  358. /package/{LexicalLinkPlugin.js → dist/LexicalLinkPlugin.js} +0 -0
  359. /package/{LexicalLinkPlugin.js.flow → dist/LexicalLinkPlugin.js.flow} +0 -0
  360. /package/{LexicalLinkPlugin.mjs → dist/LexicalLinkPlugin.mjs} +0 -0
  361. /package/{LexicalLinkPlugin.node.mjs → dist/LexicalLinkPlugin.node.mjs} +0 -0
  362. /package/{LexicalLinkPlugin.prod.js → dist/LexicalLinkPlugin.prod.js} +0 -0
  363. /package/{LexicalLinkPlugin.prod.mjs → dist/LexicalLinkPlugin.prod.mjs} +0 -0
  364. /package/{LexicalListPlugin.d.ts → dist/LexicalListPlugin.d.ts} +0 -0
  365. /package/{LexicalListPlugin.dev.js → dist/LexicalListPlugin.dev.js} +0 -0
  366. /package/{LexicalListPlugin.dev.mjs → dist/LexicalListPlugin.dev.mjs} +0 -0
  367. /package/{LexicalListPlugin.js → dist/LexicalListPlugin.js} +0 -0
  368. /package/{LexicalListPlugin.js.flow → dist/LexicalListPlugin.js.flow} +0 -0
  369. /package/{LexicalListPlugin.mjs → dist/LexicalListPlugin.mjs} +0 -0
  370. /package/{LexicalListPlugin.node.mjs → dist/LexicalListPlugin.node.mjs} +0 -0
  371. /package/{LexicalListPlugin.prod.js → dist/LexicalListPlugin.prod.js} +0 -0
  372. /package/{LexicalListPlugin.prod.mjs → dist/LexicalListPlugin.prod.mjs} +0 -0
  373. /package/{LexicalMarkdownShortcutPlugin.d.ts → dist/LexicalMarkdownShortcutPlugin.d.ts} +0 -0
  374. /package/{LexicalMarkdownShortcutPlugin.dev.js → dist/LexicalMarkdownShortcutPlugin.dev.js} +0 -0
  375. /package/{LexicalMarkdownShortcutPlugin.dev.mjs → dist/LexicalMarkdownShortcutPlugin.dev.mjs} +0 -0
  376. /package/{LexicalMarkdownShortcutPlugin.js → dist/LexicalMarkdownShortcutPlugin.js} +0 -0
  377. /package/{LexicalMarkdownShortcutPlugin.js.flow → dist/LexicalMarkdownShortcutPlugin.js.flow} +0 -0
  378. /package/{LexicalMarkdownShortcutPlugin.mjs → dist/LexicalMarkdownShortcutPlugin.mjs} +0 -0
  379. /package/{LexicalMarkdownShortcutPlugin.node.mjs → dist/LexicalMarkdownShortcutPlugin.node.mjs} +0 -0
  380. /package/{LexicalMarkdownShortcutPlugin.prod.js → dist/LexicalMarkdownShortcutPlugin.prod.js} +0 -0
  381. /package/{LexicalMarkdownShortcutPlugin.prod.mjs → dist/LexicalMarkdownShortcutPlugin.prod.mjs} +0 -0
  382. /package/{LexicalNestedComposer.d.ts → dist/LexicalNestedComposer.d.ts} +0 -0
  383. /package/{LexicalNestedComposer.js → dist/LexicalNestedComposer.js} +0 -0
  384. /package/{LexicalNestedComposer.js.flow → dist/LexicalNestedComposer.js.flow} +0 -0
  385. /package/{LexicalNestedComposer.mjs → dist/LexicalNestedComposer.mjs} +0 -0
  386. /package/{LexicalNestedComposer.node.mjs → dist/LexicalNestedComposer.node.mjs} +0 -0
  387. /package/{LexicalNestedComposer.prod.js → dist/LexicalNestedComposer.prod.js} +0 -0
  388. /package/{LexicalNestedComposer.prod.mjs → dist/LexicalNestedComposer.prod.mjs} +0 -0
  389. /package/{LexicalNodeContextMenuPlugin.d.ts → dist/LexicalNodeContextMenuPlugin.d.ts} +0 -0
  390. /package/{LexicalNodeContextMenuPlugin.dev.js → dist/LexicalNodeContextMenuPlugin.dev.js} +0 -0
  391. /package/{LexicalNodeContextMenuPlugin.dev.mjs → dist/LexicalNodeContextMenuPlugin.dev.mjs} +0 -0
  392. /package/{LexicalNodeContextMenuPlugin.js → dist/LexicalNodeContextMenuPlugin.js} +0 -0
  393. /package/{LexicalNodeContextMenuPlugin.js.flow → dist/LexicalNodeContextMenuPlugin.js.flow} +0 -0
  394. /package/{LexicalNodeContextMenuPlugin.mjs → dist/LexicalNodeContextMenuPlugin.mjs} +0 -0
  395. /package/{LexicalNodeContextMenuPlugin.node.mjs → dist/LexicalNodeContextMenuPlugin.node.mjs} +0 -0
  396. /package/{LexicalNodeContextMenuPlugin.prod.js → dist/LexicalNodeContextMenuPlugin.prod.js} +0 -0
  397. /package/{LexicalNodeContextMenuPlugin.prod.mjs → dist/LexicalNodeContextMenuPlugin.prod.mjs} +0 -0
  398. /package/{LexicalNodeEventPlugin.d.ts → dist/LexicalNodeEventPlugin.d.ts} +0 -0
  399. /package/{LexicalNodeEventPlugin.dev.js → dist/LexicalNodeEventPlugin.dev.js} +0 -0
  400. /package/{LexicalNodeEventPlugin.dev.mjs → dist/LexicalNodeEventPlugin.dev.mjs} +0 -0
  401. /package/{LexicalNodeEventPlugin.js → dist/LexicalNodeEventPlugin.js} +0 -0
  402. /package/{LexicalNodeEventPlugin.js.flow → dist/LexicalNodeEventPlugin.js.flow} +0 -0
  403. /package/{LexicalNodeEventPlugin.mjs → dist/LexicalNodeEventPlugin.mjs} +0 -0
  404. /package/{LexicalNodeEventPlugin.node.mjs → dist/LexicalNodeEventPlugin.node.mjs} +0 -0
  405. /package/{LexicalNodeEventPlugin.prod.js → dist/LexicalNodeEventPlugin.prod.js} +0 -0
  406. /package/{LexicalNodeEventPlugin.prod.mjs → dist/LexicalNodeEventPlugin.prod.mjs} +0 -0
  407. /package/{LexicalNodeMenuPlugin.d.ts → dist/LexicalNodeMenuPlugin.d.ts} +0 -0
  408. /package/{LexicalNodeMenuPlugin.js → dist/LexicalNodeMenuPlugin.js} +0 -0
  409. /package/{LexicalNodeMenuPlugin.js.flow → dist/LexicalNodeMenuPlugin.js.flow} +0 -0
  410. /package/{LexicalNodeMenuPlugin.mjs → dist/LexicalNodeMenuPlugin.mjs} +0 -0
  411. /package/{LexicalNodeMenuPlugin.node.mjs → dist/LexicalNodeMenuPlugin.node.mjs} +0 -0
  412. /package/{LexicalOnChangePlugin.d.ts → dist/LexicalOnChangePlugin.d.ts} +0 -0
  413. /package/{LexicalOnChangePlugin.js → dist/LexicalOnChangePlugin.js} +0 -0
  414. /package/{LexicalOnChangePlugin.js.flow → dist/LexicalOnChangePlugin.js.flow} +0 -0
  415. /package/{LexicalOnChangePlugin.mjs → dist/LexicalOnChangePlugin.mjs} +0 -0
  416. /package/{LexicalOnChangePlugin.node.mjs → dist/LexicalOnChangePlugin.node.mjs} +0 -0
  417. /package/{LexicalPlainTextPlugin.d.ts → dist/LexicalPlainTextPlugin.d.ts} +0 -0
  418. /package/{LexicalPlainTextPlugin.js → dist/LexicalPlainTextPlugin.js} +0 -0
  419. /package/{LexicalPlainTextPlugin.js.flow → dist/LexicalPlainTextPlugin.js.flow} +0 -0
  420. /package/{LexicalPlainTextPlugin.mjs → dist/LexicalPlainTextPlugin.mjs} +0 -0
  421. /package/{LexicalPlainTextPlugin.node.mjs → dist/LexicalPlainTextPlugin.node.mjs} +0 -0
  422. /package/{LexicalReactExtension.dev.js → dist/LexicalReactExtension.dev.js} +0 -0
  423. /package/{LexicalReactExtension.dev.mjs → dist/LexicalReactExtension.dev.mjs} +0 -0
  424. /package/{LexicalReactExtension.js → dist/LexicalReactExtension.js} +0 -0
  425. /package/{LexicalReactExtension.js.flow → dist/LexicalReactExtension.js.flow} +0 -0
  426. /package/{LexicalReactExtension.mjs → dist/LexicalReactExtension.mjs} +0 -0
  427. /package/{LexicalReactExtension.node.mjs → dist/LexicalReactExtension.node.mjs} +0 -0
  428. /package/{LexicalReactExtension.prod.js → dist/LexicalReactExtension.prod.js} +0 -0
  429. /package/{LexicalReactExtension.prod.mjs → dist/LexicalReactExtension.prod.mjs} +0 -0
  430. /package/{LexicalReactPluginHostExtension.dev.js → dist/LexicalReactPluginHostExtension.dev.js} +0 -0
  431. /package/{LexicalReactPluginHostExtension.dev.mjs → dist/LexicalReactPluginHostExtension.dev.mjs} +0 -0
  432. /package/{LexicalReactPluginHostExtension.js → dist/LexicalReactPluginHostExtension.js} +0 -0
  433. /package/{LexicalReactPluginHostExtension.js.flow → dist/LexicalReactPluginHostExtension.js.flow} +0 -0
  434. /package/{LexicalReactPluginHostExtension.mjs → dist/LexicalReactPluginHostExtension.mjs} +0 -0
  435. /package/{LexicalReactPluginHostExtension.node.mjs → dist/LexicalReactPluginHostExtension.node.mjs} +0 -0
  436. /package/{LexicalReactPluginHostExtension.prod.js → dist/LexicalReactPluginHostExtension.prod.js} +0 -0
  437. /package/{LexicalReactPluginHostExtension.prod.mjs → dist/LexicalReactPluginHostExtension.prod.mjs} +0 -0
  438. /package/{LexicalReactProviderExtension.dev.js → dist/LexicalReactProviderExtension.dev.js} +0 -0
  439. /package/{LexicalReactProviderExtension.dev.mjs → dist/LexicalReactProviderExtension.dev.mjs} +0 -0
  440. /package/{LexicalReactProviderExtension.js → dist/LexicalReactProviderExtension.js} +0 -0
  441. /package/{LexicalReactProviderExtension.js.flow → dist/LexicalReactProviderExtension.js.flow} +0 -0
  442. /package/{LexicalReactProviderExtension.mjs → dist/LexicalReactProviderExtension.mjs} +0 -0
  443. /package/{LexicalReactProviderExtension.node.mjs → dist/LexicalReactProviderExtension.node.mjs} +0 -0
  444. /package/{LexicalReactProviderExtension.prod.js → dist/LexicalReactProviderExtension.prod.js} +0 -0
  445. /package/{LexicalReactProviderExtension.prod.mjs → dist/LexicalReactProviderExtension.prod.mjs} +0 -0
  446. /package/{LexicalRichTextPlugin.d.ts → dist/LexicalRichTextPlugin.d.ts} +0 -0
  447. /package/{LexicalRichTextPlugin.js → dist/LexicalRichTextPlugin.js} +0 -0
  448. /package/{LexicalRichTextPlugin.js.flow → dist/LexicalRichTextPlugin.js.flow} +0 -0
  449. /package/{LexicalRichTextPlugin.mjs → dist/LexicalRichTextPlugin.mjs} +0 -0
  450. /package/{LexicalRichTextPlugin.node.mjs → dist/LexicalRichTextPlugin.node.mjs} +0 -0
  451. /package/{LexicalSelectionAlwaysOnDisplay.d.ts → dist/LexicalSelectionAlwaysOnDisplay.d.ts} +0 -0
  452. /package/{LexicalSelectionAlwaysOnDisplay.dev.js → dist/LexicalSelectionAlwaysOnDisplay.dev.js} +0 -0
  453. /package/{LexicalSelectionAlwaysOnDisplay.dev.mjs → dist/LexicalSelectionAlwaysOnDisplay.dev.mjs} +0 -0
  454. /package/{LexicalSelectionAlwaysOnDisplay.js → dist/LexicalSelectionAlwaysOnDisplay.js} +0 -0
  455. /package/{LexicalSelectionAlwaysOnDisplay.js.flow → dist/LexicalSelectionAlwaysOnDisplay.js.flow} +0 -0
  456. /package/{LexicalSelectionAlwaysOnDisplay.mjs → dist/LexicalSelectionAlwaysOnDisplay.mjs} +0 -0
  457. /package/{LexicalSelectionAlwaysOnDisplay.node.mjs → dist/LexicalSelectionAlwaysOnDisplay.node.mjs} +0 -0
  458. /package/{LexicalSelectionAlwaysOnDisplay.prod.js → dist/LexicalSelectionAlwaysOnDisplay.prod.js} +0 -0
  459. /package/{LexicalSelectionAlwaysOnDisplay.prod.mjs → dist/LexicalSelectionAlwaysOnDisplay.prod.mjs} +0 -0
  460. /package/{LexicalTabIndentationPlugin.d.ts → dist/LexicalTabIndentationPlugin.d.ts} +0 -0
  461. /package/{LexicalTabIndentationPlugin.dev.js → dist/LexicalTabIndentationPlugin.dev.js} +0 -0
  462. /package/{LexicalTabIndentationPlugin.dev.mjs → dist/LexicalTabIndentationPlugin.dev.mjs} +0 -0
  463. /package/{LexicalTabIndentationPlugin.js → dist/LexicalTabIndentationPlugin.js} +0 -0
  464. /package/{LexicalTabIndentationPlugin.js.flow → dist/LexicalTabIndentationPlugin.js.flow} +0 -0
  465. /package/{LexicalTabIndentationPlugin.mjs → dist/LexicalTabIndentationPlugin.mjs} +0 -0
  466. /package/{LexicalTabIndentationPlugin.node.mjs → dist/LexicalTabIndentationPlugin.node.mjs} +0 -0
  467. /package/{LexicalTabIndentationPlugin.prod.js → dist/LexicalTabIndentationPlugin.prod.js} +0 -0
  468. /package/{LexicalTabIndentationPlugin.prod.mjs → dist/LexicalTabIndentationPlugin.prod.mjs} +0 -0
  469. /package/{LexicalTableOfContentsPlugin.d.ts → dist/LexicalTableOfContentsPlugin.d.ts} +0 -0
  470. /package/{LexicalTableOfContentsPlugin.dev.js → dist/LexicalTableOfContentsPlugin.dev.js} +0 -0
  471. /package/{LexicalTableOfContentsPlugin.dev.mjs → dist/LexicalTableOfContentsPlugin.dev.mjs} +0 -0
  472. /package/{LexicalTableOfContentsPlugin.js → dist/LexicalTableOfContentsPlugin.js} +0 -0
  473. /package/{LexicalTableOfContentsPlugin.js.flow → dist/LexicalTableOfContentsPlugin.js.flow} +0 -0
  474. /package/{LexicalTableOfContentsPlugin.mjs → dist/LexicalTableOfContentsPlugin.mjs} +0 -0
  475. /package/{LexicalTableOfContentsPlugin.node.mjs → dist/LexicalTableOfContentsPlugin.node.mjs} +0 -0
  476. /package/{LexicalTableOfContentsPlugin.prod.js → dist/LexicalTableOfContentsPlugin.prod.js} +0 -0
  477. /package/{LexicalTableOfContentsPlugin.prod.mjs → dist/LexicalTableOfContentsPlugin.prod.mjs} +0 -0
  478. /package/{LexicalTablePlugin.d.ts → dist/LexicalTablePlugin.d.ts} +0 -0
  479. /package/{LexicalTablePlugin.js → dist/LexicalTablePlugin.js} +0 -0
  480. /package/{LexicalTablePlugin.js.flow → dist/LexicalTablePlugin.js.flow} +0 -0
  481. /package/{LexicalTablePlugin.mjs → dist/LexicalTablePlugin.mjs} +0 -0
  482. /package/{LexicalTablePlugin.node.mjs → dist/LexicalTablePlugin.node.mjs} +0 -0
  483. /package/{LexicalTreeView.d.ts → dist/LexicalTreeView.d.ts} +0 -0
  484. /package/{LexicalTreeView.dev.js → dist/LexicalTreeView.dev.js} +0 -0
  485. /package/{LexicalTreeView.dev.mjs → dist/LexicalTreeView.dev.mjs} +0 -0
  486. /package/{LexicalTreeView.js → dist/LexicalTreeView.js} +0 -0
  487. /package/{LexicalTreeView.js.flow → dist/LexicalTreeView.js.flow} +0 -0
  488. /package/{LexicalTreeView.mjs → dist/LexicalTreeView.mjs} +0 -0
  489. /package/{LexicalTreeView.node.mjs → dist/LexicalTreeView.node.mjs} +0 -0
  490. /package/{LexicalTreeView.prod.js → dist/LexicalTreeView.prod.js} +0 -0
  491. /package/{LexicalTreeView.prod.mjs → dist/LexicalTreeView.prod.mjs} +0 -0
  492. /package/{LexicalTreeViewExtension.dev.js → dist/LexicalTreeViewExtension.dev.js} +0 -0
  493. /package/{LexicalTreeViewExtension.dev.mjs → dist/LexicalTreeViewExtension.dev.mjs} +0 -0
  494. /package/{LexicalTreeViewExtension.js → dist/LexicalTreeViewExtension.js} +0 -0
  495. /package/{LexicalTreeViewExtension.js.flow → dist/LexicalTreeViewExtension.js.flow} +0 -0
  496. /package/{LexicalTreeViewExtension.mjs → dist/LexicalTreeViewExtension.mjs} +0 -0
  497. /package/{LexicalTreeViewExtension.node.mjs → dist/LexicalTreeViewExtension.node.mjs} +0 -0
  498. /package/{LexicalTreeViewExtension.prod.js → dist/LexicalTreeViewExtension.prod.js} +0 -0
  499. /package/{LexicalTreeViewExtension.prod.mjs → dist/LexicalTreeViewExtension.prod.mjs} +0 -0
  500. /package/{LexicalTypeaheadMenuPlugin.d.ts → dist/LexicalTypeaheadMenuPlugin.d.ts} +0 -0
  501. /package/{LexicalTypeaheadMenuPlugin.js → dist/LexicalTypeaheadMenuPlugin.js} +0 -0
  502. /package/{LexicalTypeaheadMenuPlugin.js.flow → dist/LexicalTypeaheadMenuPlugin.js.flow} +0 -0
  503. /package/{LexicalTypeaheadMenuPlugin.mjs → dist/LexicalTypeaheadMenuPlugin.mjs} +0 -0
  504. /package/{LexicalTypeaheadMenuPlugin.node.mjs → dist/LexicalTypeaheadMenuPlugin.node.mjs} +0 -0
  505. /package/{ReactExtension.d.ts → dist/ReactExtension.d.ts} +0 -0
  506. /package/{ReactPluginHostExtension.d.ts → dist/ReactPluginHostExtension.d.ts} +0 -0
  507. /package/{ReactProviderExtension.d.ts → dist/ReactProviderExtension.d.ts} +0 -0
  508. /package/{TreeViewExtension.d.ts → dist/TreeViewExtension.d.ts} +0 -0
  509. /package/{shared → dist/shared}/LegacyDecorators.d.ts +0 -0
  510. /package/{shared → dist/shared}/LexicalContentEditableElement.d.ts +0 -0
  511. /package/{shared → dist/shared}/LexicalMenu.d.ts +0 -0
  512. /package/{shared → dist/shared}/buildEditorComponent.d.ts +0 -0
  513. /package/{shared → dist/shared}/mergeRefs.d.ts +0 -0
  514. /package/{shared → dist/shared}/point.d.ts +0 -0
  515. /package/{shared → dist/shared}/rect.d.ts +0 -0
  516. /package/{shared → dist/shared}/types.d.ts +0 -0
  517. /package/{shared → dist/shared}/useCanShowPlaceholder.d.ts +0 -0
  518. /package/{shared → dist/shared}/useCharacterLimit.d.ts +0 -0
  519. /package/{shared → dist/shared}/useDecorators.d.ts +0 -0
  520. /package/{shared → dist/shared}/useHistory.d.ts +0 -0
  521. /package/{shared → dist/shared}/useList.d.ts +0 -0
  522. /package/{shared → dist/shared}/usePlainTextSetup.d.ts +0 -0
  523. /package/{shared → dist/shared}/useReactDecorators.d.ts +0 -0
  524. /package/{shared → dist/shared}/useRichTextSetup.d.ts +0 -0
  525. /package/{shared → dist/shared}/useYjsCollaboration.d.ts +0 -0
  526. /package/{useExtensionComponent.d.ts → dist/useExtensionComponent.d.ts} +0 -0
  527. /package/{useExtensionSignalValue.d.ts → dist/useExtensionSignalValue.d.ts} +0 -0
  528. /package/{useLexicalEditable.d.ts → dist/useLexicalEditable.d.ts} +0 -0
  529. /package/{useLexicalEditable.js → dist/useLexicalEditable.js} +0 -0
  530. /package/{useLexicalEditable.js.flow → dist/useLexicalEditable.js.flow} +0 -0
  531. /package/{useLexicalEditable.mjs → dist/useLexicalEditable.mjs} +0 -0
  532. /package/{useLexicalEditable.node.mjs → dist/useLexicalEditable.node.mjs} +0 -0
  533. /package/{useLexicalExtensionComponent.dev.js → dist/useLexicalExtensionComponent.dev.js} +0 -0
  534. /package/{useLexicalExtensionComponent.dev.mjs → dist/useLexicalExtensionComponent.dev.mjs} +0 -0
  535. /package/{useLexicalExtensionComponent.js → dist/useLexicalExtensionComponent.js} +0 -0
  536. /package/{useLexicalExtensionComponent.js.flow → dist/useLexicalExtensionComponent.js.flow} +0 -0
  537. /package/{useLexicalExtensionComponent.mjs → dist/useLexicalExtensionComponent.mjs} +0 -0
  538. /package/{useLexicalExtensionComponent.node.mjs → dist/useLexicalExtensionComponent.node.mjs} +0 -0
  539. /package/{useLexicalExtensionComponent.prod.js → dist/useLexicalExtensionComponent.prod.js} +0 -0
  540. /package/{useLexicalExtensionComponent.prod.mjs → dist/useLexicalExtensionComponent.prod.mjs} +0 -0
  541. /package/{useLexicalExtensionSignalValue.dev.js → dist/useLexicalExtensionSignalValue.dev.js} +0 -0
  542. /package/{useLexicalExtensionSignalValue.dev.mjs → dist/useLexicalExtensionSignalValue.dev.mjs} +0 -0
  543. /package/{useLexicalExtensionSignalValue.js → dist/useLexicalExtensionSignalValue.js} +0 -0
  544. /package/{useLexicalExtensionSignalValue.js.flow → dist/useLexicalExtensionSignalValue.js.flow} +0 -0
  545. /package/{useLexicalExtensionSignalValue.mjs → dist/useLexicalExtensionSignalValue.mjs} +0 -0
  546. /package/{useLexicalExtensionSignalValue.node.mjs → dist/useLexicalExtensionSignalValue.node.mjs} +0 -0
  547. /package/{useLexicalExtensionSignalValue.prod.js → dist/useLexicalExtensionSignalValue.prod.js} +0 -0
  548. /package/{useLexicalExtensionSignalValue.prod.mjs → dist/useLexicalExtensionSignalValue.prod.mjs} +0 -0
  549. /package/{useLexicalIsTextContentEmpty.d.ts → dist/useLexicalIsTextContentEmpty.d.ts} +0 -0
  550. /package/{useLexicalIsTextContentEmpty.js → dist/useLexicalIsTextContentEmpty.js} +0 -0
  551. /package/{useLexicalIsTextContentEmpty.js.flow → dist/useLexicalIsTextContentEmpty.js.flow} +0 -0
  552. /package/{useLexicalIsTextContentEmpty.mjs → dist/useLexicalIsTextContentEmpty.mjs} +0 -0
  553. /package/{useLexicalIsTextContentEmpty.node.mjs → dist/useLexicalIsTextContentEmpty.node.mjs} +0 -0
  554. /package/{useLexicalNodeSelection.d.ts → dist/useLexicalNodeSelection.d.ts} +0 -0
  555. /package/{useLexicalNodeSelection.dev.js → dist/useLexicalNodeSelection.dev.js} +0 -0
  556. /package/{useLexicalNodeSelection.dev.mjs → dist/useLexicalNodeSelection.dev.mjs} +0 -0
  557. /package/{useLexicalNodeSelection.js → dist/useLexicalNodeSelection.js} +0 -0
  558. /package/{useLexicalNodeSelection.js.flow → dist/useLexicalNodeSelection.js.flow} +0 -0
  559. /package/{useLexicalNodeSelection.mjs → dist/useLexicalNodeSelection.mjs} +0 -0
  560. /package/{useLexicalNodeSelection.node.mjs → dist/useLexicalNodeSelection.node.mjs} +0 -0
  561. /package/{useLexicalNodeSelection.prod.js → dist/useLexicalNodeSelection.prod.js} +0 -0
  562. /package/{useLexicalNodeSelection.prod.mjs → dist/useLexicalNodeSelection.prod.mjs} +0 -0
  563. /package/{useLexicalSubscription.d.ts → dist/useLexicalSubscription.d.ts} +0 -0
  564. /package/{useLexicalSubscription.js → dist/useLexicalSubscription.js} +0 -0
  565. /package/{useLexicalSubscription.js.flow → dist/useLexicalSubscription.js.flow} +0 -0
  566. /package/{useLexicalSubscription.mjs → dist/useLexicalSubscription.mjs} +0 -0
  567. /package/{useLexicalSubscription.node.mjs → dist/useLexicalSubscription.node.mjs} +0 -0
  568. /package/{useLexicalTextEntity.d.ts → dist/useLexicalTextEntity.d.ts} +0 -0
  569. /package/{useLexicalTextEntity.dev.js → dist/useLexicalTextEntity.dev.js} +0 -0
  570. /package/{useLexicalTextEntity.dev.mjs → dist/useLexicalTextEntity.dev.mjs} +0 -0
  571. /package/{useLexicalTextEntity.js → dist/useLexicalTextEntity.js} +0 -0
  572. /package/{useLexicalTextEntity.js.flow → dist/useLexicalTextEntity.js.flow} +0 -0
  573. /package/{useLexicalTextEntity.mjs → dist/useLexicalTextEntity.mjs} +0 -0
  574. /package/{useLexicalTextEntity.node.mjs → dist/useLexicalTextEntity.node.mjs} +0 -0
  575. /package/{useLexicalTextEntity.prod.js → dist/useLexicalTextEntity.prod.js} +0 -0
  576. /package/{useLexicalTextEntity.prod.mjs → dist/useLexicalTextEntity.prod.mjs} +0 -0
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import {
9
+ getExtensionDependencyFromEditor,
10
+ getPeerDependencyFromEditor,
11
+ } from '@lexical/extension';
12
+ import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
13
+ import {
14
+ type AnyLexicalExtension,
15
+ type LexicalExtensionDependency,
16
+ type OutputComponentExtension,
17
+ } from 'lexical';
18
+
19
+ export function useExtensionDependency<Extension extends AnyLexicalExtension>(
20
+ extension: Extension,
21
+ ): LexicalExtensionDependency<Extension> {
22
+ return getExtensionDependencyFromEditor(
23
+ useLexicalComposerContext()[0],
24
+ extension,
25
+ );
26
+ }
27
+
28
+ export function useOptionalExtensionDependency<
29
+ Extension extends AnyLexicalExtension,
30
+ >(extension: Extension): undefined | LexicalExtensionDependency<Extension> {
31
+ return usePeerExtensionDependency<typeof extension>(extension.name);
32
+ }
33
+
34
+ export function usePeerExtensionDependency<
35
+ Extension extends AnyLexicalExtension,
36
+ >(
37
+ extensionName: Extension['name'],
38
+ ): undefined | LexicalExtensionDependency<Extension> {
39
+ return getPeerDependencyFromEditor(
40
+ useLexicalComposerContext()[0],
41
+ extensionName,
42
+ );
43
+ }
44
+
45
+ /**
46
+ * Use a Component from the given Extension that uses the ReactExtension convention
47
+ * of exposing a Component property in its output.
48
+ *
49
+ * @param extension - An extension with a Component property in the output
50
+ * @returns `getExtensionConfigFromEditor(useLexicalComposerContext()[0], extension).Component`
51
+ */
52
+ export function useExtensionComponent<
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- contravariant in props
54
+ OutputComponent extends React.ComponentType<any>,
55
+ >(extension: OutputComponentExtension<OutputComponent>): OutputComponent {
56
+ return useExtensionDependency(extension).output.Component;
57
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import type {ReadonlySignal} from '@lexical/extension';
10
+ import type {AnyLexicalExtension, LexicalExtensionOutput} from 'lexical';
11
+
12
+ import {useExtensionDependency} from '@lexical/react/useExtensionComponent';
13
+ import {useMemo, useSyncExternalStore} from 'react';
14
+
15
+ /**
16
+ * A React hook that subscribes to a signal and returns its current value.
17
+ * The component will re-render whenever the signal's value changes.
18
+ *
19
+ * @param s - The ReadonlySignal to subscribe to
20
+ * @returns The current value of the signal
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * const signal = new Signal(0);
25
+ * function MyComponent() {
26
+ * const value = useSignalValue(signal);
27
+ * return <div>Value: {value}</div>;
28
+ * }
29
+ * ```
30
+ */
31
+ export function useSignalValue<V>(s: ReadonlySignal<V>): V {
32
+ const [subscribe, getSnapshot] = useMemo(
33
+ () => [s.subscribe.bind(s), s.peek.bind(s)] as const,
34
+ [s],
35
+ );
36
+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
37
+ }
38
+
39
+ /**
40
+ * Type helper that extracts the value type from a ReadonlySignal.
41
+ * If the type is not a ReadonlySignal, it returns never.
42
+ *
43
+ * @example
44
+ * ```tsx
45
+ * type MySignal = ReadonlySignal<number>;
46
+ * type Value = SignalValue<MySignal>; // number
47
+ * ```
48
+ */
49
+ export type SignalValue<S> = S extends ReadonlySignal<infer V> ? V : never;
50
+
51
+ /**
52
+ * A React hook that subscribes to a signal property from a Lexical extension's output
53
+ * and returns its current value. The component will re-render whenever the signal's value changes.
54
+ *
55
+ * This hook combines the functionality of useExtensionDependency and useSignalValue,
56
+ * providing a convenient way to access reactive values from Lexical extensions.
57
+ *
58
+ * @param extension - The Lexical extension instance
59
+ * @param prop - The property name in the extension's output that contains a signal
60
+ * @returns The current value of the signal property
61
+ *
62
+ * @example
63
+ * ```tsx
64
+ * import {useExtensionSignalValue} from '@lexical/react/useExtensionSignalValue';
65
+ * import {MyExtension} from './MyExtension';
66
+ *
67
+ * function MyComponent() {
68
+ * // Assuming MyExtension has a signal property 'count' in its output
69
+ * const count = useExtensionSignalValue(MyExtension, 'count');
70
+ * return <div>Count: {count}</div>;
71
+ * }
72
+ * ```
73
+ */
74
+ export function useExtensionSignalValue<
75
+ Extension extends AnyLexicalExtension,
76
+ K extends keyof LexicalExtensionOutput<Extension>,
77
+ >(
78
+ extension: Extension,
79
+ prop: K,
80
+ ): SignalValue<LexicalExtensionOutput<Extension>[K]> {
81
+ const signal = useExtensionDependency(extension).output[
82
+ prop
83
+ ] as ReadonlySignal<SignalValue<LexicalExtensionOutput<Extension>[K]>>;
84
+ return useSignalValue(signal);
85
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import type {LexicalSubscription} from './useLexicalSubscription';
10
+ import type {LexicalEditor} from 'lexical';
11
+
12
+ import {useLexicalSubscription} from './useLexicalSubscription';
13
+
14
+ function subscription(editor: LexicalEditor): LexicalSubscription<boolean> {
15
+ return {
16
+ initialValueFn: () => editor.isEditable(),
17
+ subscribe: callback => {
18
+ return editor.registerEditableListener(callback);
19
+ },
20
+ };
21
+ }
22
+
23
+ /**
24
+ * Get the current value for {@link LexicalEditor.isEditable}
25
+ * using {@link useLexicalSubscription}.
26
+ * You should prefer this over manually observing the value with
27
+ * {@link LexicalEditor.registerEditableListener},
28
+ * which is a bit tricky to do correctly, particularly when using
29
+ * React StrictMode (the default for development) or concurrency.
30
+ */
31
+ export function useLexicalEditable(): boolean {
32
+ return useLexicalSubscription(subscription);
33
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import type {LexicalEditor} from 'lexical';
10
+
11
+ import {$isRootTextContentEmptyCurry} from '@lexical/text';
12
+ import {useState} from 'react';
13
+
14
+ import useLayoutEffect from './shared/useLayoutEffect';
15
+
16
+ export function useLexicalIsTextContentEmpty(
17
+ editor: LexicalEditor,
18
+ trim?: boolean,
19
+ ): boolean {
20
+ const [isEmpty, setIsEmpty] = useState(
21
+ editor
22
+ .getEditorState()
23
+ .read($isRootTextContentEmptyCurry(editor.isComposing(), trim)),
24
+ );
25
+
26
+ useLayoutEffect(() => {
27
+ return editor.registerUpdateListener(({editorState}) => {
28
+ const isComposing = editor.isComposing();
29
+ const currentIsEmpty = editorState.read(
30
+ $isRootTextContentEmptyCurry(isComposing, trim),
31
+ );
32
+ setIsEmpty(currentIsEmpty);
33
+ });
34
+ }, [editor, trim]);
35
+
36
+ return isEmpty;
37
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import type {LexicalEditor, NodeKey} from 'lexical';
10
+
11
+ import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
12
+ import {
13
+ $createNodeSelection,
14
+ $getNodeByKey,
15
+ $getSelection,
16
+ $isNodeSelection,
17
+ $setSelection,
18
+ } from 'lexical';
19
+ import {useCallback, useEffect, useState} from 'react';
20
+
21
+ /**
22
+ * A helper function to determine if a specific node is selected in a Lexical editor.
23
+ *
24
+ * @param {LexicalEditor} editor - The LexicalEditor instance.
25
+ * @param {NodeKey} key - The key of the node to check.
26
+ * @returns {boolean} Whether the node is selected.
27
+ */
28
+
29
+ function isNodeSelected(editor: LexicalEditor, key: NodeKey): boolean {
30
+ return editor.getEditorState().read(() => {
31
+ const node = $getNodeByKey(key);
32
+
33
+ if (node === null) {
34
+ return false; // Node doesn't exist, so it's not selected.
35
+ }
36
+
37
+ return node.isSelected(); // Check if the node is selected.
38
+ });
39
+ }
40
+
41
+ /**
42
+ * A custom hook to manage the selection state of a specific node in a Lexical editor.
43
+ *
44
+ * This hook provides utilities to:
45
+ * - Check if a node is selected.
46
+ * - Update its selection state.
47
+ * - Clear the selection.
48
+ *
49
+ * @param {NodeKey} key - The key of the node to track selection for.
50
+ * @returns {[boolean, (selected: boolean) => void, () => void]} A tuple containing:
51
+ * - `isSelected` (boolean): Whether the node is currently selected.
52
+ * - `setSelected` (function): A function to set the selection state of the node.
53
+ * - `clearSelected` (function): A function to clear the selection of the node.
54
+ *
55
+ */
56
+
57
+ export function useLexicalNodeSelection(
58
+ key: NodeKey,
59
+ ): [boolean, (selected: boolean) => void, () => void] {
60
+ const [editor] = useLexicalComposerContext();
61
+
62
+ // State to track whether the node is currently selected.
63
+ const [isSelected, setIsSelected] = useState(() =>
64
+ isNodeSelected(editor, key),
65
+ );
66
+
67
+ useEffect(() => {
68
+ let isMounted = true;
69
+ const unregister = editor.registerUpdateListener(() => {
70
+ if (isMounted) {
71
+ setIsSelected(isNodeSelected(editor, key));
72
+ }
73
+ });
74
+
75
+ return () => {
76
+ isMounted = false; // Prevent updates after component unmount.
77
+ unregister();
78
+ };
79
+ }, [editor, key]);
80
+
81
+ const setSelected = useCallback(
82
+ (selected: boolean) => {
83
+ editor.update(() => {
84
+ let selection = $getSelection();
85
+
86
+ if (!$isNodeSelection(selection)) {
87
+ selection = $createNodeSelection();
88
+ $setSelection(selection);
89
+ }
90
+
91
+ if ($isNodeSelection(selection)) {
92
+ if (selected) {
93
+ selection.add(key);
94
+ } else {
95
+ selection.delete(key);
96
+ }
97
+ }
98
+ });
99
+ },
100
+ [editor, key],
101
+ );
102
+
103
+ const clearSelected = useCallback(() => {
104
+ editor.update(() => {
105
+ const selection = $getSelection();
106
+
107
+ if ($isNodeSelection(selection)) {
108
+ selection.clear();
109
+ }
110
+ });
111
+ }, [editor]);
112
+
113
+ return [isSelected, setSelected, clearSelected];
114
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import type {LexicalEditor} from 'lexical';
10
+
11
+ import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
12
+ import {useMemo, useRef, useState} from 'react';
13
+
14
+ import useLayoutEffect from './shared/useLayoutEffect';
15
+
16
+ export type LexicalSubscription<T> = {
17
+ initialValueFn: () => T;
18
+ subscribe: (callback: (value: T) => void) => () => void;
19
+ };
20
+
21
+ /**
22
+ * Shortcut to Lexical subscriptions when values are used for render.
23
+ * @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).
24
+ */
25
+ export function useLexicalSubscription<T>(
26
+ subscription: (editor: LexicalEditor) => LexicalSubscription<T>,
27
+ ): T {
28
+ const [editor] = useLexicalComposerContext();
29
+ const initializedSubscription = useMemo(
30
+ () => subscription(editor),
31
+ [editor, subscription],
32
+ );
33
+ const [value, setValue] = useState<T>(() =>
34
+ initializedSubscription.initialValueFn(),
35
+ );
36
+ const valueRef = useRef<T>(value);
37
+ useLayoutEffect(() => {
38
+ const {initialValueFn, subscribe} = initializedSubscription;
39
+ const currentValue = initialValueFn();
40
+ if (valueRef.current !== currentValue) {
41
+ valueRef.current = currentValue;
42
+ setValue(currentValue);
43
+ }
44
+
45
+ return subscribe((newValue: T) => {
46
+ valueRef.current = newValue;
47
+ setValue(newValue);
48
+ });
49
+ }, [initializedSubscription, subscription]);
50
+
51
+ return value;
52
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import type {EntityMatch} from '@lexical/text';
10
+ import type {Klass, TextNode} from 'lexical';
11
+
12
+ import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
13
+ import {registerLexicalTextEntity} from '@lexical/text';
14
+ import {mergeRegister} from '@lexical/utils';
15
+ import {useEffect} from 'react';
16
+
17
+ export function useLexicalTextEntity<T extends TextNode>(
18
+ getMatch: (text: string) => null | EntityMatch,
19
+ targetNode: Klass<T>,
20
+ createNode: (textNode: TextNode) => T,
21
+ ): void {
22
+ const [editor] = useLexicalComposerContext();
23
+
24
+ useEffect(() => {
25
+ return mergeRegister(
26
+ ...registerLexicalTextEntity(editor, getMatch, targetNode, createNode),
27
+ );
28
+ }, [createNode, editor, getMatch, targetNode]);
29
+ }
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- "use strict";var e=require("@lexical/extension"),t=require("@lexical/react/LexicalComposerContext"),o=require("react");const r="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?o.useLayoutEffect:o.useEffect;exports.ClearEditorPlugin=function({onClear:o}){const[i]=t.useLexicalComposerContext();return r(()=>e.registerClearEditor(i,o),[i,o]),null};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import{registerClearEditor as o}from"@lexical/extension";import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useLayoutEffect as n,useEffect as t}from"react";const i="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:t;function r({onClear:n}){const[t]=e();return i(()=>o(t,n),[t,n]),null}export{r as ClearEditorPlugin};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("lexical"),o=require("react"),n=require("react/jsx-runtime");const r="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,i=r?o.useLayoutEffect:o.useEffect,a={tag:t.HISTORY_MERGE_TAG};exports.LexicalComposer=function({initialConfig:c,children:s}){const l=o.useMemo(()=>{const{theme:o,namespace:n,nodes:i,onError:s,editorState:l,html:d}=c,u=e.createLexicalComposerContext(null,o),m=t.createEditor({editable:c.editable,html:d,namespace:n,nodes:i,onError:e=>s(e,m),theme:o});return function(e,o){if(null===o)return;if(void 0===o)e.update(()=>{const o=t.$getRoot();if(o.isEmpty()){const n=t.$createParagraphNode();o.append(n);const i=r?document.activeElement:null;(null!==t.$getSelection()||null!==i&&i===e.getRootElement())&&n.select()}},a);else if(null!==o)switch(typeof o){case"string":{const t=e.parseEditorState(o);e.setEditorState(t,a);break}case"object":e.setEditorState(o,a);break;case"function":e.update(()=>{t.$getRoot().isEmpty()&&o(e)},a)}}(m,l),[m,u]},[]);return i(()=>{const e=c.editable,[t]=l;t.setEditable(void 0===e||e)},[]),n.jsx(e.LexicalComposerContext.Provider,{value:l,children:s})};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import{createLexicalComposerContext as e,LexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{createEditor as o,$getRoot as n,$createParagraphNode as i,$getSelection as r,HISTORY_MERGE_TAG as a}from"lexical";import{useLayoutEffect as c,useEffect as l,useMemo as d}from"react";import{jsx as s}from"react/jsx-runtime";const m="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,u=m?c:l,p={tag:a};function f({initialConfig:a,children:c}){const l=d(()=>{const{theme:t,namespace:c,nodes:l,onError:d,editorState:s,html:u}=a,f=e(null,t),E=o({editable:a.editable,html:u,namespace:c,nodes:l,onError:e=>d(e,E),theme:t});return function(e,t){if(null===t)return;if(void 0===t)e.update(()=>{const t=n();if(t.isEmpty()){const o=i();t.append(o);const n=m?document.activeElement:null;(null!==r()||null!==n&&n===e.getRootElement())&&o.select()}},p);else if(null!==t)switch(typeof t){case"string":{const o=e.parseEditorState(t);e.setEditorState(o,p);break}case"object":e.setEditorState(t,p);break;case"function":e.update(()=>{n().isEmpty()&&t(e)},p)}}(E,s),[E,f]},[]);return u(()=>{const e=a.editable,[t]=l;t.setEditable(void 0===e||e)},[]),s(t.Provider,{value:l,children:c})}export{f as LexicalComposer};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("react"),a=require("react/jsx-runtime"),i=require("@lexical/text"),r=require("@lexical/utils");const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function o({editor:e,ariaActiveDescendant:i,ariaAutoComplete:r,ariaControls:o,ariaDescribedBy:l,ariaErrorMessage:s,ariaExpanded:d,ariaInvalid:u,ariaLabel:c,ariaLabelledBy:f,ariaMultiline:b,ariaOwns:x,ariaRequired:m,autoCapitalize:E,className:p,id:C,role:v="textbox",spellCheck:w=!0,style:y,tabIndex:g,"data-testid":L,...h},q){const[j,R]=t.useState(e.isEditable()),S=t.useCallback(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),D=t.useMemo(()=>function(...e){return t=>{for(const a of e)"function"==typeof a?a(t):null!=a&&(a.current=t)}}(q,S),[S,q]);return n(()=>(R(e.isEditable()),e.registerEditableListener(e=>{R(e)})),[e]),a.jsx("div",{"aria-activedescendant":j?i:void 0,"aria-autocomplete":j?r:"none","aria-controls":j?o:void 0,"aria-describedby":l,...null!=s?{"aria-errormessage":s}:{},"aria-expanded":j&&"combobox"===v?!!d:void 0,...null!=u?{"aria-invalid":u}:{},"aria-label":c,"aria-labelledby":f,"aria-multiline":b,"aria-owns":j?x:void 0,"aria-readonly":!j||void 0,"aria-required":m,autoCapitalize:E,className:p,contentEditable:j,"data-testid":L,id:C,ref:D,role:v,spellCheck:w,style:y,tabIndex:g,...h})}const l=t.forwardRef(o);function s(e){return e.getEditorState().read(i.$canShowPlaceholderCurry(e.isComposing()))}const d=t.forwardRef(u);function u(t,i){const{placeholder:r,...n}=t,[o]=e.useLexicalComposerContext();return a.jsxs(a.Fragment,{children:[a.jsx(l,{editor:o,...n,ref:i}),null!=r&&a.jsx(c,{editor:o,content:r})]})}function c({content:e,editor:i}){const o=function(e){const[a,i]=t.useState(()=>s(e));return n(()=>{function t(){const t=s(e);i(t)}return t(),r.mergeRegister(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),a}(i),[l,d]=t.useState(i.isEditable());if(t.useLayoutEffect(()=>(d(i.isEditable()),i.registerEditableListener(e=>{d(e)})),[i]),!o)return null;let u=null;return"function"==typeof e?u=e(l):null!==e&&(u=e),null===u?null:a.jsx("div",{"aria-hidden":!0,children:u})}exports.ContentEditable=d,exports.ContentEditableElement=l;
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useLayoutEffect as t,useEffect as i,forwardRef as a,useState as r,useCallback as n,useMemo as o}from"react";import{jsx as l,jsxs as d,Fragment as c}from"react/jsx-runtime";import{$canShowPlaceholderCurry as s}from"@lexical/text";import{mergeRegister as u}from"@lexical/utils";const m="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t:i;function f({editor:e,ariaActiveDescendant:t,ariaAutoComplete:i,ariaControls:a,ariaDescribedBy:d,ariaErrorMessage:c,ariaExpanded:s,ariaInvalid:u,ariaLabel:f,ariaLabelledBy:b,ariaMultiline:p,ariaOwns:x,ariaRequired:E,autoCapitalize:v,className:w,id:y,role:C="textbox",spellCheck:g=!0,style:L,tabIndex:h,"data-testid":D,...I},R){const[k,q]=r(e.isEditable()),z=n(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),A=o(()=>function(...e){return t=>{for(const i of e)"function"==typeof i?i(t):null!=i&&(i.current=t)}}(R,z),[z,R]);return m(()=>(q(e.isEditable()),e.registerEditableListener(e=>{q(e)})),[e]),l("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?i:"none","aria-controls":k?a:void 0,"aria-describedby":d,...null!=c?{"aria-errormessage":c}:{},"aria-expanded":k&&"combobox"===C?!!s:void 0,...null!=u?{"aria-invalid":u}:{},"aria-label":f,"aria-labelledby":b,"aria-multiline":p,"aria-owns":k?x:void 0,"aria-readonly":!k||void 0,"aria-required":E,autoCapitalize:v,className:w,contentEditable:k,"data-testid":D,id:y,ref:A,role:C,spellCheck:g,style:L,tabIndex:h,...I})}const b=a(f);function p(e){return e.getEditorState().read(s(e.isComposing()))}const x=a(E);function E(t,i){const{placeholder:a,...r}=t,[n]=e();return d(c,{children:[l(b,{editor:n,...r,ref:i}),null!=a&&l(v,{editor:n,content:a})]})}function v({content:e,editor:i}){const a=function(e){const[t,i]=r(()=>p(e));return m(()=>{function t(){const t=p(e);i(t)}return t(),u(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(i),[n,o]=r(i.isEditable());if(t(()=>(o(i.isEditable()),i.registerEditableListener(e=>{o(e)})),[i]),!a)return null;let d=null;return"function"==typeof e?d=e(n):null!==e&&(d=e),null===d?null:l("div",{"aria-hidden":!0,children:d})}export{x as ContentEditable,b as ContentEditableElement};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- "use strict";var t=require("@lexical/react/LexicalComposerContext"),e=require("@lexical/rich-text"),n=require("@lexical/utils"),o=require("lexical"),r=require("react"),i=require("react-dom"),s=require("react/jsx-runtime");const l="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,a=l&&"documentMode"in document?document.documentMode:null,c=l&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);l&&"InputEvent"in window&&!a&&new window.InputEvent("input");class u{_x;_y;constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}equals({x:t,y:e}){return this.x===t&&this.y===e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}}class m{_left;_top;_right;_bottom;constructor(t,e,n,o){const[r,i]=e<=o?[e,o]:[o,e],[s,l]=t<=n?[t,n]:[n,t];this._top=r,this._right=l,this._left=s,this._bottom=i}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:t,left:e,bottom:n,right:o}){return t===this._top&&n===this._bottom&&e===this._left&&o===this._right}contains(t){if(t instanceof u){const{x:e,y:n}=t,o=n<this._top,r=n>this._bottom,i=e<this._left,s=e>this._right;return{reason:{isOnBottomSide:r,isOnLeftSide:i,isOnRightSide:s,isOnTopSide:o},result:!(o||r||i||s)}}{const{top:e,left:n,bottom:o,right:r}=t;return e>=this._top&&e<=this._bottom&&o>=this._top&&o<=this._bottom&&n>=this._left&&n<=this._right&&r>=this._left&&r<=this._right}}intersectsWith(t){const{left:e,top:n,width:o,height:r}=t,{left:i,top:s,width:l,height:a}=this;return(e+o>=i+l?e+o:i+l)-(e<=i?e:i)<=o+l&&(n+r>=s+a?n+r:s+a)-(n<=s?n:s)<=r+a}generateNewRect({left:t=this.left,top:e=this.top,right:n=this.right,bottom:o=this.bottom}){return new m(t,e,n,o)}static fromLTRB(t,e,n,o){return new m(t,e,n,o)}static fromLWTH(t,e,n,o){return new m(t,n,t+e,n+o)}static fromPoints(t,e){const{y:n,x:o}=t,{y:r,x:i}=e;return m.fromLTRB(o,n,i,r)}static fromDOM(t){const{top:e,width:n,left:o,height:r}=t.getBoundingClientRect();return m.fromLWTH(o,n,e,r)}}const g="application/x-lexical-drag-block";let d=1/0;function h(t){const e=(t,e)=>t?parseFloat(window.getComputedStyle(t)[e]):0,{marginTop:n,marginBottom:o}=window.getComputedStyle(t),r=e(t.previousElementSibling,"marginBottom"),i=e(t.nextElementSibling,"marginTop"),s=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),i),marginTop:s}}function f(t,e,r,i=!1){const s=t.getBoundingClientRect(),l=function(t){return t.getEditorState().read(()=>o.$getRoot().getChildrenKeys())}(e);let a=null;return e.getEditorState().read(()=>{if(i){const[t,o]=[e.getElementByKey(l[0]),e.getElementByKey(l[l.length-1])],[i,s]=[null!=t?t.getBoundingClientRect():void 0,null!=o?o.getBoundingClientRect():void 0];if(i&&s){const e=n.calculateZoomLevel(t),l=n.calculateZoomLevel(o);if(r.y/e<i.top?a=t:r.y/l>s.bottom&&(a=o),a)return}}let t=0===(o=l.length)?1/0:d>=0&&d<o?d:Math.floor(o/2);var o;let c=0;for(;t>=0&&t<l.length;){const o=l[t],i=e.getElementByKey(o);if(null===i)break;const g=n.calculateZoomLevel(i),f=new u(r.x/g,r.y/g),p=m.fromDOM(i),{marginTop:y,marginBottom:_}=h(i),v=p.generateNewRect({bottom:p.bottom+_,left:s.left,right:s.right,top:p.top-y}),{result:x,reason:{isOnTopSide:E,isOnBottomSide:M}}=v.contains(f);if(x){a=i,d=t;break}0===c&&(c=E?-1:M?1:1/0),t+=c}}),a}function p(t,l,a,u,m,d,p,y,_){const v=l.parentElement,x=r.useRef(!1),[E,M]=r.useState(null),R=r.useCallback(t=>{M(t),_&&_(t)},[_]);return r.useEffect(()=>{function e(e){const o=e.target;if(!n.isHTMLElement(o))return void R(null);if(y(o))return;const r=f(l,t,e);R(r)}function o(){R(null)}return null!=v&&(v.addEventListener("mousemove",e),v.addEventListener("mouseleave",o)),()=>{null!=v&&(v.removeEventListener("mousemove",e),v.removeEventListener("mouseleave",o))}},[v,l,t,y,R]),r.useEffect(()=>{const t=n.calculateZoomLevel(document.getElementsByClassName("ContentEditable__root")[0],!0);a.current&&function(t,e,n,o){if(!t)return void(e.style.display="none");const r=t.getBoundingClientRect(),i=window.getComputedStyle(t),s=e.getBoundingClientRect(),l=n.getBoundingClientRect();let a=parseInt(i.lineHeight,10);isNaN(a)&&(a=r.bottom-r.top);const c=(r.top+(a-(s.height||a))/2-l.top+n.scrollTop)/o;e.style.display="flex",e.style.opacity="1",e.style.transform=`translate(4px, ${c}px)`}(E,a.current,l,t)},[l,E,a]),r.useEffect(()=>{function r(o){if(!x.current)return!1;const[r]=e.eventFiles(o);if(r)return!1;const{pageY:i,target:s}=o;if(!n.isHTMLElement(s))return!1;const a=f(l,t,o,!0),c=u.current;return null!==a&&null!==c&&(function(t,e,n,o){const{top:r,height:i}=e.getBoundingClientRect(),{top:s,width:l}=o.getBoundingClientRect(),{marginTop:a,marginBottom:c}=h(e);let u=r;n>=r?u+=i+c/2:u-=a/2;const m=u-s-2+o.scrollTop;t.style.transform=`translate(24px, ${m}px)`,t.style.width=l-48+"px",t.style.opacity=".4"}(c,a,i/n.calculateZoomLevel(s),l),o.preventDefault(),!0)}return n.mergeRegister(t.registerCommand(o.DRAGOVER_COMMAND,t=>r(t),o.COMMAND_PRIORITY_LOW),t.registerCommand(o.DROP_COMMAND,r=>function(r){if(!x.current)return!1;const[i]=e.eventFiles(r);if(i)return!1;const{target:s,dataTransfer:a,pageY:u}=r,m=null!=a?a.getData(g):"",d=o.$getNodeByKey(m);if(!d)return!1;if(!n.isHTMLElement(s))return!1;const h=f(l,t,r,!0);if(!h)return!1;const p=o.$getNearestNodeFromDOMNode(h);if(!p)return!1;if(p===d)return c&&t.focus(),!0;const y=h.getBoundingClientRect().top;return u/n.calculateZoomLevel(s)>=y?p.insertAfter(d):p.insertBefore(d),R(null),c&&o.$onUpdate(()=>{t.focus()}),!0}(r),o.COMMAND_PRIORITY_HIGH))},[l,t,u,R]),r.useEffect(()=>{if(c&&m)return n.mergeRegister(t.registerRootListener(e=>{function r(r){const i=r.relatedTarget;n.isHTMLElement(i)&&y(i)&&(e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=o.$getSelection();null===t||t.dirty||(t.dirty=!0)})),r.stopImmediatePropagation())}if(e)return e.addEventListener("blur",r,!0),()=>e.removeEventListener("blur",r,!0)}),t.registerCommand(o.BLUR_COMMAND,()=>{const e=t.getRootElement(),r=document.activeElement;return!!(e&&n.isHTMLElement(r)&&y(r))&&(e.focus({preventScroll:!0}),t.update(()=>{const t=o.$getSelection();null===t||t.dirty||(t.dirty=!0)}),!0)},o.COMMAND_PRIORITY_HIGH))},[t,m,y]),i.createPortal(s.jsxs(s.Fragment,{children:[s.jsx("div",{draggable:!0,onDragStart:function(e){const n=e.dataTransfer;if(!n||!E)return;!function(t,e){const{transform:n}=e.style;e.style.transform="translateZ(0)",t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=n})}(n,E);let r="";if(t.update(()=>{const t=o.$getNearestNodeFromDOMNode(E);t&&(r=t.getKey())}),x.current=!0,n.setData(g,r),c){const e=t.getRootElement();null!==e&&document.activeElement!==e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=o.$getSelection();null===t||t.dirty||(t.dirty=!0)}))}},onDragEnd:function(){var e;x.current=!1,(e=u.current)&&(e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)"),c&&t.focus()},children:m&&d}),p]}),l)}exports.DraggableBlockPlugin_EXPERIMENTAL=function({anchorElem:e=document.body,menuRef:n,targetLineRef:o,menuComponent:r,targetLineComponent:i,isOnMenu:s,onElementChanged:l}){const[a]=t.useLexicalComposerContext();return p(a,e,n,o,a._editable,r,i,s,l)};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{eventFiles as e}from"@lexical/rich-text";import{calculateZoomLevel as n,mergeRegister as o,isHTMLElement as r}from"@lexical/utils";import{DRAGOVER_COMMAND as i,COMMAND_PRIORITY_LOW as s,DROP_COMMAND as l,COMMAND_PRIORITY_HIGH as a,BLUR_COMMAND as c,$getSelection as u,$getNodeByKey as m,$getNearestNodeFromDOMNode as g,$onUpdate as h,$getRoot as f}from"lexical";import{useRef as d,useState as p,useCallback as y,useEffect as _}from"react";import{createPortal as x}from"react-dom";import{jsxs as b,Fragment as v,jsx as w}from"react/jsx-runtime";const E="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,T=E&&"documentMode"in document?document.documentMode:null,B=E&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);E&&"InputEvent"in window&&!T&&new window.InputEvent("input");class C{_x;_y;constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}equals({x:t,y:e}){return this.x===t&&this.y===e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}}class R{_left;_top;_right;_bottom;constructor(t,e,n,o){const[r,i]=e<=o?[e,o]:[o,e],[s,l]=t<=n?[t,n]:[n,t];this._top=r,this._right=l,this._left=s,this._bottom=i}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:t,left:e,bottom:n,right:o}){return t===this._top&&n===this._bottom&&e===this._left&&o===this._right}contains(t){if(t instanceof C){const{x:e,y:n}=t,o=n<this._top,r=n>this._bottom,i=e<this._left,s=e>this._right;return{reason:{isOnBottomSide:r,isOnLeftSide:i,isOnRightSide:s,isOnTopSide:o},result:!(o||r||i||s)}}{const{top:e,left:n,bottom:o,right:r}=t;return e>=this._top&&e<=this._bottom&&o>=this._top&&o<=this._bottom&&n>=this._left&&n<=this._right&&r>=this._left&&r<=this._right}}intersectsWith(t){const{left:e,top:n,width:o,height:r}=t,{left:i,top:s,width:l,height:a}=this;return(e+o>=i+l?e+o:i+l)-(e<=i?e:i)<=o+l&&(n+r>=s+a?n+r:s+a)-(n<=s?n:s)<=r+a}generateNewRect({left:t=this.left,top:e=this.top,right:n=this.right,bottom:o=this.bottom}){return new R(t,e,n,o)}static fromLTRB(t,e,n,o){return new R(t,e,n,o)}static fromLWTH(t,e,n,o){return new R(t,n,t+e,n+o)}static fromPoints(t,e){const{y:n,x:o}=t,{y:r,x:i}=e;return R.fromLTRB(o,n,i,r)}static fromDOM(t){const{top:e,width:n,left:o,height:r}=t.getBoundingClientRect();return R.fromLWTH(o,n,e,r)}}const S="application/x-lexical-drag-block";let D=1/0;function L(t){const e=(t,e)=>t?parseFloat(window.getComputedStyle(t)[e]):0,{marginTop:n,marginBottom:o}=window.getComputedStyle(t),r=e(t.previousElementSibling,"marginBottom"),i=e(t.nextElementSibling,"marginTop"),s=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),i),marginTop:s}}function M(t,e,o,r=!1){const i=t.getBoundingClientRect(),s=function(t){return t.getEditorState().read(()=>f().getChildrenKeys())}(e);let l=null;return e.getEditorState().read(()=>{if(r){const[t,r]=[e.getElementByKey(s[0]),e.getElementByKey(s[s.length-1])],[i,a]=[null!=t?t.getBoundingClientRect():void 0,null!=r?r.getBoundingClientRect():void 0];if(i&&a){const e=n(t),s=n(r);if(o.y/e<i.top?l=t:o.y/s>a.bottom&&(l=r),l)return}}let t=0===(a=s.length)?1/0:D>=0&&D<a?D:Math.floor(a/2);var a;let c=0;for(;t>=0&&t<s.length;){const r=s[t],a=e.getElementByKey(r);if(null===a)break;const u=n(a),m=new C(o.x/u,o.y/u),g=R.fromDOM(a),{marginTop:h,marginBottom:f}=L(a),d=g.generateNewRect({bottom:g.bottom+f,left:i.left,right:i.right,top:g.top-h}),{result:p,reason:{isOnTopSide:y,isOnBottomSide:_}}=d.contains(m);if(p){l=a,D=t;break}0===c&&(c=y?-1:_?1:1/0),t+=c}}),l}function O(t,f,E,T,C,R,D,O,I){const K=f.parentElement,N=d(!1),[Y,k]=p(null),F=y(t=>{k(t),I&&I(t)},[I]);return _(()=>{function e(e){const n=e.target;if(!r(n))return void F(null);if(O(n))return;const o=M(f,t,e);F(o)}function n(){F(null)}return null!=K&&(K.addEventListener("mousemove",e),K.addEventListener("mouseleave",n)),()=>{null!=K&&(K.removeEventListener("mousemove",e),K.removeEventListener("mouseleave",n))}},[K,f,t,O,F]),_(()=>{const t=n(document.getElementsByClassName("ContentEditable__root")[0],!0);E.current&&function(t,e,n,o){if(!t)return void(e.style.display="none");const r=t.getBoundingClientRect(),i=window.getComputedStyle(t),s=e.getBoundingClientRect(),l=n.getBoundingClientRect();let a=parseInt(i.lineHeight,10);isNaN(a)&&(a=r.bottom-r.top);const c=(r.top+(a-(s.height||a))/2-l.top+n.scrollTop)/o;e.style.display="flex",e.style.opacity="1",e.style.transform=`translate(4px, ${c}px)`}(Y,E.current,f,t)},[f,Y,E]),_(()=>{function c(o){if(!N.current)return!1;const[i]=e(o);if(i)return!1;const{pageY:s,target:l}=o;if(!r(l))return!1;const a=M(f,t,o,!0),c=T.current;return null!==a&&null!==c&&(function(t,e,n,o){const{top:r,height:i}=e.getBoundingClientRect(),{top:s,width:l}=o.getBoundingClientRect(),{marginTop:a,marginBottom:c}=L(e);let u=r;n>=r?u+=i+c/2:u-=a/2;const m=u-s-2+o.scrollTop;t.style.transform=`translate(24px, ${m}px)`,t.style.width=l-48+"px",t.style.opacity=".4"}(c,a,s/n(l),f),o.preventDefault(),!0)}return o(t.registerCommand(i,t=>c(t),s),t.registerCommand(l,o=>function(o){if(!N.current)return!1;const[i]=e(o);if(i)return!1;const{target:s,dataTransfer:l,pageY:a}=o,c=null!=l?l.getData(S):"",u=m(c);if(!u)return!1;if(!r(s))return!1;const d=M(f,t,o,!0);if(!d)return!1;const p=g(d);if(!p)return!1;if(p===u)return B&&t.focus(),!0;const y=d.getBoundingClientRect().top;return a/n(s)>=y?p.insertAfter(u):p.insertBefore(u),F(null),B&&h(()=>{t.focus()}),!0}(o),a))},[f,t,T,F]),_(()=>{if(B&&C)return o(t.registerRootListener(e=>{function n(n){const o=n.relatedTarget;r(o)&&O(o)&&(e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=u();null===t||t.dirty||(t.dirty=!0)})),n.stopImmediatePropagation())}if(e)return e.addEventListener("blur",n,!0),()=>e.removeEventListener("blur",n,!0)}),t.registerCommand(c,()=>{const e=t.getRootElement(),n=document.activeElement;return!!(e&&r(n)&&O(n))&&(e.focus({preventScroll:!0}),t.update(()=>{const t=u();null===t||t.dirty||(t.dirty=!0)}),!0)},a))},[t,C,O]),x(b(v,{children:[w("div",{draggable:!0,onDragStart:function(e){const n=e.dataTransfer;if(!n||!Y)return;!function(t,e){const{transform:n}=e.style;e.style.transform="translateZ(0)",t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=n})}(n,Y);let o="";if(t.update(()=>{const t=g(Y);t&&(o=t.getKey())}),N.current=!0,n.setData(S,o),B){const e=t.getRootElement();null!==e&&document.activeElement!==e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=u();null===t||t.dirty||(t.dirty=!0)}))}},onDragEnd:function(){var e;N.current=!1,(e=T.current)&&(e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)"),B&&t.focus()},children:C&&R}),D]}),f)}function I({anchorElem:e=document.body,menuRef:n,targetLineRef:o,menuComponent:r,targetLineComponent:i,isOnMenu:s,onElementChanged:l}){const[a]=t();return O(a,e,n,o,a._editable,r,i,s,l)}export{I as DraggableBlockPlugin_EXPERIMENTAL};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("lexical"),n=require("react"),l=require("@lexical/utils"),o=require("react-dom"),r=require("react/jsx-runtime");const i="startTransition";const s="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,u=s?n.useLayoutEffect:n.useEffect;const c=e=>{const t=document.getElementById("typeahead-menu");if(!t)return;const n=t.getBoundingClientRect();n.top+n.height>window.innerHeight&&t.scrollIntoView({block:"center"}),n.top<0&&t.scrollIntoView({block:"center"}),e.scrollIntoView({block:"nearest"})};function a(e,t){const n=e.getBoundingClientRect(),l=t.getBoundingClientRect();return n.top>=l.top-6&&n.top<=l.bottom+6}function d(t,l,o,r){const[i]=e.useLexicalComposerContext();n.useEffect(()=>{if(null!=l&&null!=t){const e=i.getRootElement(),t=null!=e?function(e){let t=getComputedStyle(e);const n="absolute"===t.position,l=/(auto|scroll)/;if("fixed"===t.position)return document.body;for(let o=e;o=o.parentElement;)if(t=getComputedStyle(o),(!n||"static"!==t.position)&&l.test(t.overflow+t.overflowY+t.overflowX))return o;return document.body}(e):document.body;let n=!1,s=a(l,t);const u=function(){n||(window.requestAnimationFrame(function(){o(),n=!1}),n=!0);const e=a(l,t);e!==s&&(s=e,null!=r&&r(e))},c=new ResizeObserver(o);return window.addEventListener("resize",o),document.addEventListener("scroll",u,{capture:!0,passive:!0}),c.observe(l),()=>{c.unobserve(l),window.removeEventListener("resize",o),document.removeEventListener("scroll",u,!0)}}},[l,i,r,o,t])}const m=t.createCommand("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function p({index:e,isSelected:t,onClick:n,onMouseEnter:l,option:o}){let i="item";return t&&(i+=" selected"),r.jsxs("li",{tabIndex:-1,className:i,ref:o.setRefElement,role:"option","aria-selected":t,id:"typeahead-item-"+e,onMouseEnter:l,onClick:n,children:[o.icon,r.jsx("span",{className:"text",children:o.title})]},o.key)}function f({close:e,editor:i,anchorElementRef:s,resolution:a,options:d,menuRenderFn:f,onSelectOption:g,shouldSplitNodeWithQuery:h=!1,commandPriority:C=t.COMMAND_PRIORITY_LOW,preselectFirstItem:E=!0}){const[y,x]=n.useState(null),b=null!==y?Math.min(d.length-1,y):null,R=a.match&&a.match.matchingString;n.useEffect(()=>{E&&x(0)},[R,E]);const v=n.useCallback(n=>{i.update(()=>{const l=null!=a.match&&h?function(e){const n=t.$getSelection();if(!t.$isRangeSelection(n)||!n.isCollapsed())return null;const l=n.anchor;if("text"!==l.type)return null;const o=l.getNode();if(!o.isSimpleText())return null;const r=l.offset,i=o.getTextContent().slice(0,r),s=e.replaceableString.length,u=r-function(e,t,n){let l=n;for(let n=l;n<=t.length;n++)e.slice(-n)===t.substring(0,n)&&(l=n);return l}(i,e.matchingString,s);if(u<0)return null;let c;return 0===u?[c]=o.splitText(r):[,c]=o.splitText(u,r),c}(a.match):null;g(n,l,e,a.match?a.match.matchingString:"")})},[i,h,a.match,g,e]),w=n.useCallback(e=>{const t=i.getRootElement();null!==t&&(t.setAttribute("aria-activedescendant","typeahead-item-"+e),x(e))},[i]),O=n.useCallback(()=>s.current&&d.length?o.createPortal(r.jsx("div",{className:"typeahead-popover mentions-menu",children:r.jsx("ul",{children:d.map((e,t)=>r.jsx(p,{index:t,isSelected:b===t,onClick:()=>{x(t),v(e)},onMouseEnter:()=>{x(t)},option:e},e.key))})}),s.current):null,[s,d,b,v,x]);n.useEffect(()=>()=>{const e=i.getRootElement();null!==e&&e.removeAttribute("aria-activedescendant")},[i]),u(()=>{null===d?x(null):null===b&&E&&w(0)},[d,b,w,E]),n.useEffect(()=>l.mergeRegister(i.registerCommand(m,({option:e})=>!(!e.ref||null==e.ref.current)&&(c(e.ref.current),!0),C)),[i,w,C]),n.useEffect(()=>l.mergeRegister(i.registerCommand(t.KEY_ARROW_DOWN_COMMAND,e=>{const t=e;if(null!==d&&d.length){const e=null===b?0:b!==d.length-1?b+1:0;w(e);const n=d[e];if(!n)return w(-1),t.preventDefault(),t.stopImmediatePropagation(),!0;n.ref&&n.ref.current&&i.dispatchCommand(m,{index:e,option:n}),t.preventDefault(),t.stopImmediatePropagation()}return!0},C),i.registerCommand(t.KEY_ARROW_UP_COMMAND,e=>{const t=e;if(null!==d&&d.length){const e=null===b?d.length-1:0!==b?b-1:d.length-1;w(e);const n=d[e];if(!n)return w(-1),t.preventDefault(),t.stopImmediatePropagation(),!0;n.ref&&n.ref.current&&c(n.ref.current),t.preventDefault(),t.stopImmediatePropagation()}return!0},C),i.registerCommand(t.KEY_ESCAPE_COMMAND,t=>{const n=t;return n.preventDefault(),n.stopImmediatePropagation(),e(),!0},C),i.registerCommand(t.KEY_TAB_COMMAND,e=>{const t=e;return null!==d&&null!==b&&null!=d[b]&&(t.preventDefault(),t.stopImmediatePropagation(),v(d[b]),!0)},C),i.registerCommand(t.KEY_ENTER_COMMAND,e=>!(null===d||null===b||null==d[b]||e&&e.shiftKey)&&(null!==e&&(e.preventDefault(),e.stopImmediatePropagation()),v(d[b]),!0),C)),[v,e,i,d,b,w,C]);const A=n.useMemo(()=>({options:d,selectOptionAndCleanUp:v,selectedIndex:b,setHighlightedIndex:x}),[v,b,d]);return null!=f?f(s,A,a.match?a.match.matchingString:""):O()}function g(e,t){null!=t&&(e.className=t),e.setAttribute("aria-label","Typeahead menu"),e.setAttribute("role","listbox"),e.style.display="block",e.style.position="absolute"}exports.LexicalNodeMenuPlugin=function({options:l,nodeKey:o,onClose:u,onOpen:c,onSelectOption:a,menuRenderFn:m,anchorClassName:p,commandPriority:h=t.COMMAND_PRIORITY_LOW,parent:C}){const[E]=e.useLexicalComposerContext(),[y,x]=n.useState(null),b=function(t,l,o,r=(s?document.body:void 0),i=!0){const[u]=e.useLexicalComposerContext(),c=s?document.createElement("div"):null,a=n.useRef(c),m=n.useCallback(()=>{if(null===a.current||void 0===r)return;a.current.style.top=a.current.style.bottom;const e=u.getRootElement(),n=a.current,l=n.firstChild;if(null!==e&&null!==t){const{left:s,top:u,width:c,height:d}=t.getRect(),m=a.current.offsetHeight;if(n.style.top=`${u+m+3+(i?window.pageYOffset:0)}px`,n.style.left=`${s+window.pageXOffset}px`,n.style.height=`${d}px`,n.style.width=`${c}px`,null!==l){l.style.top=`${u}`;const t=l.getBoundingClientRect(),o=t.height,r=t.width,c=e.getBoundingClientRect();s+r>c.right&&(n.style.left=`${c.right-r+window.pageXOffset}px`),(u+o>window.innerHeight||u+o>c.bottom)&&u-c.top>o+d&&(n.style.top=`${u-o-d+(i?window.pageYOffset:0)}px`)}n.isConnected||(g(n,o),r.append(n)),n.setAttribute("id","typeahead-menu"),e.setAttribute("aria-controls","typeahead-menu")}},[u,t,i,o,r]);n.useEffect(()=>{const e=u.getRootElement();return null!==t&&m(),()=>{null!==e&&e.removeAttribute("aria-controls");const t=a.current;null!==t&&t.isConnected&&(t.remove(),t.removeAttribute("id"))}},[u,m,t]);const p=n.useCallback(e=>{null!==t&&(e||l(null))},[t,l]);return d(t,a.current,m,p),null!=c&&c===a.current&&(g(c,o),null!=r&&r.append(c)),a}(y,x,p,C),R=n.useCallback(()=>{x(null),null!=u&&null!==y&&u()},[u,y]),v=n.useCallback(e=>{x(e),null!=c&&null===y&&c(e)},[c,y]),w=n.useCallback(()=>{o?E.update(()=>{const e=t.$getNodeByKey(o),l=E.getElementByKey(o);var r;null!=e&&null!=l&&null==y&&(r=()=>v({getRect:()=>l.getBoundingClientRect()}),i in n?n[i](r):r())}):null==o&&null!=y&&R()},[R,E,o,v,y]);return n.useEffect(()=>{w()},[w,o]),n.useEffect(()=>{if(null!=o)return E.registerUpdateListener(({dirtyElements:e})=>{e.get(o)&&w()})},[E,w,o]),null===b.current||null===y||null===E?null:r.jsx(f,{close:R,resolution:y,editor:E,anchorElementRef:b,options:l,menuRenderFn:m,onSelectOption:a,commandPriority:h})},exports.MenuOption=class{key;ref;icon;title;constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{createCommand as t,COMMAND_PRIORITY_LOW as n,KEY_ARROW_DOWN_COMMAND as o,KEY_ARROW_UP_COMMAND as l,KEY_ESCAPE_COMMAND as r,KEY_TAB_COMMAND as i,KEY_ENTER_COMMAND as u,$getSelection as s,$isRangeSelection as c,$getNodeByKey as a}from"lexical";import m,{useLayoutEffect as d,useEffect as p,useRef as f,useCallback as g,useState as h,useMemo as y}from"react";import{mergeRegister as v}from"@lexical/utils";import w from"react-dom";import{jsx as b,jsxs as C}from"react/jsx-runtime";const x="startTransition";const E="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,R=E?d:p;class I{key;ref;icon;title;constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}}const O=e=>{const t=document.getElementById("typeahead-menu");if(!t)return;const n=t.getBoundingClientRect();n.top+n.height>window.innerHeight&&t.scrollIntoView({block:"center"}),n.top<0&&t.scrollIntoView({block:"center"}),e.scrollIntoView({block:"nearest"})};function S(e,t){const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return n.top>=o.top-6&&n.top<=o.bottom+6}function A(t,n,o,l){const[r]=e();p(()=>{if(null!=n&&null!=t){const e=r.getRootElement(),t=null!=e?function(e){let t=getComputedStyle(e);const n="absolute"===t.position,o=/(auto|scroll)/;if("fixed"===t.position)return document.body;for(let l=e;l=l.parentElement;)if(t=getComputedStyle(l),(!n||"static"!==t.position)&&o.test(t.overflow+t.overflowY+t.overflowX))return l;return document.body}(e):document.body;let i=!1,u=S(n,t);const s=function(){i||(window.requestAnimationFrame(function(){o(),i=!1}),i=!0);const e=S(n,t);e!==u&&(u=e,null!=l&&l(e))},c=new ResizeObserver(o);return window.addEventListener("resize",o),document.addEventListener("scroll",s,{capture:!0,passive:!0}),c.observe(n),()=>{c.unobserve(n),window.removeEventListener("resize",o),document.removeEventListener("scroll",s,!0)}}},[n,r,l,o,t])}const P=t("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function k({index:e,isSelected:t,onClick:n,onMouseEnter:o,option:l}){let r="item";return t&&(r+=" selected"),C("li",{tabIndex:-1,className:r,ref:l.setRefElement,role:"option","aria-selected":t,id:"typeahead-item-"+e,onMouseEnter:o,onClick:n,children:[l.icon,b("span",{className:"text",children:l.title})]},l.key)}function N({close:e,editor:t,anchorElementRef:a,resolution:m,options:d,menuRenderFn:f,onSelectOption:C,shouldSplitNodeWithQuery:x=!1,commandPriority:E=n,preselectFirstItem:I=!0}){const[S,A]=h(null),N=null!==S?Math.min(d.length-1,S):null,D=m.match&&m.match.matchingString;p(()=>{I&&A(0)},[D,I]);const T=g(n=>{t.update(()=>{const t=null!=m.match&&x?function(e){const t=s();if(!c(t)||!t.isCollapsed())return null;const n=t.anchor;if("text"!==n.type)return null;const o=n.getNode();if(!o.isSimpleText())return null;const l=n.offset,r=o.getTextContent().slice(0,l),i=e.replaceableString.length,u=l-function(e,t,n){let o=n;for(let n=o;n<=t.length;n++)e.slice(-n)===t.substring(0,n)&&(o=n);return o}(r,e.matchingString,i);if(u<0)return null;let a;return 0===u?[a]=o.splitText(l):[,a]=o.splitText(u,l),a}(m.match):null;C(n,t,e,m.match?m.match.matchingString:"")})},[t,x,m.match,C,e]),B=g(e=>{const n=t.getRootElement();null!==n&&(n.setAttribute("aria-activedescendant","typeahead-item-"+e),A(e))},[t]),L=g(()=>a.current&&d.length?w.createPortal(b("div",{className:"typeahead-popover mentions-menu",children:b("ul",{children:d.map((e,t)=>b(k,{index:t,isSelected:N===t,onClick:()=>{A(t),T(e)},onMouseEnter:()=>{A(t)},option:e},e.key))})}),a.current):null,[a,d,N,T,A]);p(()=>()=>{const e=t.getRootElement();null!==e&&e.removeAttribute("aria-activedescendant")},[t]),R(()=>{null===d?A(null):null===N&&I&&B(0)},[d,N,B,I]),p(()=>v(t.registerCommand(P,({option:e})=>!(!e.ref||null==e.ref.current)&&(O(e.ref.current),!0),E)),[t,B,E]),p(()=>v(t.registerCommand(o,e=>{const n=e;if(null!==d&&d.length){const e=null===N?0:N!==d.length-1?N+1:0;B(e);const o=d[e];if(!o)return B(-1),n.preventDefault(),n.stopImmediatePropagation(),!0;o.ref&&o.ref.current&&t.dispatchCommand(P,{index:e,option:o}),n.preventDefault(),n.stopImmediatePropagation()}return!0},E),t.registerCommand(l,e=>{const t=e;if(null!==d&&d.length){const e=null===N?d.length-1:0!==N?N-1:d.length-1;B(e);const n=d[e];if(!n)return B(-1),t.preventDefault(),t.stopImmediatePropagation(),!0;n.ref&&n.ref.current&&O(n.ref.current),t.preventDefault(),t.stopImmediatePropagation()}return!0},E),t.registerCommand(r,t=>{const n=t;return n.preventDefault(),n.stopImmediatePropagation(),e(),!0},E),t.registerCommand(i,e=>{const t=e;return null!==d&&null!==N&&null!=d[N]&&(t.preventDefault(),t.stopImmediatePropagation(),T(d[N]),!0)},E),t.registerCommand(u,e=>!(null===d||null===N||null==d[N]||e&&e.shiftKey)&&(null!==e&&(e.preventDefault(),e.stopImmediatePropagation()),T(d[N]),!0),E)),[T,e,t,d,N,B,E]);const $=y(()=>({options:d,selectOptionAndCleanUp:T,selectedIndex:N,setHighlightedIndex:A}),[T,N,d]);return null!=f?f(a,$,m.match?m.match.matchingString:""):L()}function D(e,t){null!=t&&(e.className=t),e.setAttribute("aria-label","Typeahead menu"),e.setAttribute("role","listbox"),e.style.display="block",e.style.position="absolute"}function T({options:t,nodeKey:o,onClose:l,onOpen:r,onSelectOption:i,menuRenderFn:u,anchorClassName:s,commandPriority:c=n,parent:d}){const[y]=e(),[v,w]=h(null),C=function(t,n,o,l=(E?document.body:void 0),r=!0){const[i]=e(),u=E?document.createElement("div"):null,s=f(u),c=g(()=>{if(null===s.current||void 0===l)return;s.current.style.top=s.current.style.bottom;const e=i.getRootElement(),n=s.current,u=n.firstChild;if(null!==e&&null!==t){const{left:i,top:c,width:a,height:m}=t.getRect(),d=s.current.offsetHeight;if(n.style.top=`${c+d+3+(r?window.pageYOffset:0)}px`,n.style.left=`${i+window.pageXOffset}px`,n.style.height=`${m}px`,n.style.width=`${a}px`,null!==u){u.style.top=`${c}`;const t=u.getBoundingClientRect(),o=t.height,l=t.width,s=e.getBoundingClientRect();i+l>s.right&&(n.style.left=`${s.right-l+window.pageXOffset}px`),(c+o>window.innerHeight||c+o>s.bottom)&&c-s.top>o+m&&(n.style.top=`${c-o-m+(r?window.pageYOffset:0)}px`)}n.isConnected||(D(n,o),l.append(n)),n.setAttribute("id","typeahead-menu"),e.setAttribute("aria-controls","typeahead-menu")}},[i,t,r,o,l]);p(()=>{const e=i.getRootElement();return null!==t&&c(),()=>{null!==e&&e.removeAttribute("aria-controls");const t=s.current;null!==t&&t.isConnected&&(t.remove(),t.removeAttribute("id"))}},[i,c,t]);const a=g(e=>{null!==t&&(e||n(null))},[t,n]);return A(t,s.current,c,a),null!=u&&u===s.current&&(D(u,o),null!=l&&l.append(u)),s}(v,w,s,d),R=g(()=>{w(null),null!=l&&null!==v&&l()},[l,v]),I=g(e=>{w(e),null!=r&&null===v&&r(e)},[r,v]),O=g(()=>{o?y.update(()=>{const e=a(o),t=y.getElementByKey(o);var n;null!=e&&null!=t&&null==v&&(n=()=>I({getRect:()=>t.getBoundingClientRect()}),x in m?m[x](n):n())}):null==o&&null!=v&&R()},[R,y,o,I,v]);return p(()=>{O()},[O,o]),p(()=>{if(null!=o)return y.registerUpdateListener(({dirtyElements:e})=>{e.get(o)&&O()})},[y,O,o]),null===C.current||null===v||null===y?null:b(N,{close:R,resolution:v,editor:y,anchorElementRef:C,options:t,menuRenderFn:u,onSelectOption:i,commandPriority:c})}export{T as LexicalNodeMenuPlugin,I as MenuOption};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("lexical"),i=require("react");const r="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?i.useLayoutEffect:i.useEffect;exports.OnChangePlugin=function({ignoreHistoryMergeTagChange:i=!0,ignoreSelectionChange:n=!1,onChange:o}){const[a]=e.useLexicalComposerContext();return r(()=>{if(o)return a.registerUpdateListener(({editorState:e,dirtyElements:r,dirtyLeaves:s,prevEditorState:c,tags:u})=>{n&&0===r.size&&0===s.size||i&&u.has(t.HISTORY_MERGE_TAG)||c.isEmpty()||o(e,a,u)})},[a,i,n,o]),null};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{HISTORY_MERGE_TAG as t}from"lexical";import{useLayoutEffect as o,useEffect as i}from"react";const r="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?o:i;function n({ignoreHistoryMergeTagChange:o=!0,ignoreSelectionChange:i=!1,onChange:n}){const[a]=e();return r(()=>{if(n)return a.registerUpdateListener(({editorState:e,dirtyElements:r,dirtyLeaves:d,prevEditorState:s,tags:c})=>{i&&0===r.size&&0===d.size||o&&c.has(t)||s.isEmpty()||n(e,a,c)})},[a,o,i,n]),null}export{n as OnChangePlugin};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext"),r=require("@lexical/react/useLexicalEditable"),t=require("@lexical/extension"),n=require("@lexical/react/ReactProviderExtension"),o=require("react"),i=require("react-dom"),c=require("react/jsx-runtime"),a=require("@lexical/text"),s=require("@lexical/utils"),l=require("@lexical/dragon"),u=require("@lexical/plain-text");function d(e,...r){const t=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(const e of r)n.append("v",e);throw t.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const x="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?o.useLayoutEffect:o.useEffect;function f({editor:e,ErrorBoundary:r}){return function(e,r){const[t,n]=o.useState(()=>e.getDecorators());return x(()=>e.registerDecoratorListener(e=>{i.flushSync(()=>{n(e)})}),[e]),o.useEffect(()=>{n(e.getDecorators())},[e]),o.useMemo(()=>{const n=[],a=Object.keys(t);for(let s=0;s<a.length;s++){const l=a[s],u=c.jsx(r,{onError:r=>e._onError(r),children:c.jsx(o.Suspense,{fallback:null,children:t[l]})}),d=e.getElementByKey(l);null!==d&&n.push(i.createPortal(u,d,l))}return n},[r,t,e])}(e,r)}function g({editor:e,ErrorBoundary:r}){return function(e){const r=t.LexicalBuilder.maybeFromEditor(e);if(r&&r.hasExtensionByName(n.ReactProviderExtension.name)){for(const e of["@lexical/plain-text","@lexical/rich-text"])r.hasExtensionByName(e)&&d(320,e);return!0}return!1}(e)?null:c.jsx(f,{editor:e,ErrorBoundary:r})}function m(e){return e.getEditorState().read(a.$canShowPlaceholderCurry(e.isComposing()))}function E({content:t}){const[n]=e.useLexicalComposerContext(),i=function(e){const[r,t]=o.useState(()=>m(e));return x(()=>{function r(){const r=m(e);t(r)}return r(),s.mergeRegister(e.registerUpdateListener(()=>{r()}),e.registerEditableListener(()=>{r()}))},[e]),r}(n),c=r.useLexicalEditable();return i?"function"==typeof t?t(c):t:null}exports.PlainTextPlugin=function({contentEditable:r,placeholder:t=null,ErrorBoundary:n}){const[o]=e.useLexicalComposerContext();return function(e){x(()=>s.mergeRegister(u.registerPlainText(e),l.registerDragonSupport(e)),[e])}(o),c.jsxs(c.Fragment,{children:[r,c.jsx(E,{content:t}),c.jsx(g,{editor:o,ErrorBoundary:n})]})};