@lexical/react 0.14.5 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/LexicalAutoEmbedPlugin.dev.js +15 -11
  2. package/LexicalAutoEmbedPlugin.dev.mjs +5 -2
  3. package/LexicalAutoEmbedPlugin.js +2 -0
  4. package/LexicalAutoEmbedPlugin.mjs +2 -0
  5. package/LexicalAutoEmbedPlugin.node.mjs +2 -0
  6. package/LexicalAutoEmbedPlugin.prod.js +6 -5
  7. package/LexicalAutoEmbedPlugin.prod.mjs +3 -1
  8. package/LexicalAutoFocusPlugin.dev.js +3 -0
  9. package/LexicalAutoFocusPlugin.dev.mjs +3 -0
  10. package/LexicalAutoFocusPlugin.js +2 -0
  11. package/LexicalAutoFocusPlugin.mjs +2 -0
  12. package/LexicalAutoFocusPlugin.node.mjs +2 -0
  13. package/LexicalAutoFocusPlugin.prod.js +2 -0
  14. package/LexicalAutoFocusPlugin.prod.mjs +2 -0
  15. package/LexicalAutoLinkPlugin.dev.js +9 -4
  16. package/LexicalAutoLinkPlugin.dev.mjs +10 -5
  17. package/LexicalAutoLinkPlugin.js +2 -0
  18. package/LexicalAutoLinkPlugin.mjs +2 -0
  19. package/LexicalAutoLinkPlugin.node.mjs +2 -0
  20. package/LexicalAutoLinkPlugin.prod.js +12 -10
  21. package/LexicalAutoLinkPlugin.prod.mjs +3 -1
  22. package/LexicalBlockWithAlignableContents.dev.js +14 -9
  23. package/LexicalBlockWithAlignableContents.dev.mjs +11 -7
  24. package/LexicalBlockWithAlignableContents.js +2 -0
  25. package/LexicalBlockWithAlignableContents.mjs +2 -0
  26. package/LexicalBlockWithAlignableContents.node.mjs +2 -0
  27. package/LexicalBlockWithAlignableContents.prod.js +6 -4
  28. package/LexicalBlockWithAlignableContents.prod.mjs +3 -1
  29. package/LexicalCharacterLimitPlugin.dev.js +17 -12
  30. package/LexicalCharacterLimitPlugin.dev.mjs +12 -8
  31. package/LexicalCharacterLimitPlugin.js +2 -0
  32. package/LexicalCharacterLimitPlugin.mjs +2 -0
  33. package/LexicalCharacterLimitPlugin.node.mjs +2 -0
  34. package/LexicalCharacterLimitPlugin.prod.js +11 -9
  35. package/LexicalCharacterLimitPlugin.prod.mjs +3 -1
  36. package/LexicalCheckListPlugin.dev.js +5 -0
  37. package/LexicalCheckListPlugin.dev.mjs +5 -0
  38. package/LexicalCheckListPlugin.js +2 -0
  39. package/LexicalCheckListPlugin.mjs +2 -0
  40. package/LexicalCheckListPlugin.node.mjs +2 -0
  41. package/LexicalCheckListPlugin.prod.js +4 -2
  42. package/LexicalCheckListPlugin.prod.mjs +3 -1
  43. package/LexicalClearEditorPlugin.dev.js +9 -2
  44. package/LexicalClearEditorPlugin.dev.mjs +11 -4
  45. package/LexicalClearEditorPlugin.js +2 -0
  46. package/LexicalClearEditorPlugin.mjs +2 -0
  47. package/LexicalClearEditorPlugin.node.mjs +2 -0
  48. package/LexicalClearEditorPlugin.prod.js +3 -1
  49. package/LexicalClearEditorPlugin.prod.mjs +3 -1
  50. package/LexicalClickableLinkPlugin.d.ts +3 -1
  51. package/LexicalClickableLinkPlugin.dev.js +17 -15
  52. package/LexicalClickableLinkPlugin.dev.mjs +16 -15
  53. package/LexicalClickableLinkPlugin.js +2 -0
  54. package/LexicalClickableLinkPlugin.js.flow +3 -1
  55. package/LexicalClickableLinkPlugin.mjs +3 -0
  56. package/LexicalClickableLinkPlugin.node.mjs +3 -0
  57. package/LexicalClickableLinkPlugin.prod.js +6 -4
  58. package/LexicalClickableLinkPlugin.prod.mjs +3 -1
  59. package/LexicalCollaborationContext.dev.js +3 -0
  60. package/LexicalCollaborationContext.dev.mjs +3 -0
  61. package/LexicalCollaborationContext.js +2 -0
  62. package/LexicalCollaborationContext.mjs +2 -0
  63. package/LexicalCollaborationContext.node.mjs +2 -0
  64. package/LexicalCollaborationContext.prod.js +2 -0
  65. package/LexicalCollaborationContext.prod.mjs +2 -0
  66. package/LexicalCollaborationPlugin.dev.js +20 -2
  67. package/LexicalCollaborationPlugin.dev.mjs +6 -1
  68. package/LexicalCollaborationPlugin.js +2 -0
  69. package/LexicalCollaborationPlugin.mjs +2 -0
  70. package/LexicalCollaborationPlugin.node.mjs +2 -0
  71. package/LexicalCollaborationPlugin.prod.js +12 -10
  72. package/LexicalCollaborationPlugin.prod.mjs +3 -1
  73. package/LexicalComposer.dev.js +17 -8
  74. package/LexicalComposer.dev.mjs +16 -8
  75. package/LexicalComposer.js +2 -0
  76. package/LexicalComposer.mjs +2 -0
  77. package/LexicalComposer.node.mjs +2 -0
  78. package/LexicalComposer.prod.js +5 -4
  79. package/LexicalComposer.prod.mjs +3 -1
  80. package/LexicalComposerContext.dev.js +3 -0
  81. package/LexicalComposerContext.dev.mjs +3 -0
  82. package/LexicalComposerContext.js +2 -0
  83. package/LexicalComposerContext.mjs +2 -0
  84. package/LexicalComposerContext.node.mjs +2 -0
  85. package/LexicalComposerContext.prod.js +4 -2
  86. package/LexicalComposerContext.prod.mjs +3 -1
  87. package/LexicalContentEditable.dev.js +24 -23
  88. package/LexicalContentEditable.dev.mjs +22 -22
  89. package/LexicalContentEditable.js +2 -0
  90. package/LexicalContentEditable.mjs +2 -0
  91. package/LexicalContentEditable.node.mjs +2 -0
  92. package/LexicalContentEditable.prod.js +5 -3
  93. package/LexicalContentEditable.prod.mjs +3 -1
  94. package/LexicalContextMenuPlugin.dev.js +29 -7
  95. package/LexicalContextMenuPlugin.dev.mjs +17 -8
  96. package/LexicalContextMenuPlugin.js +2 -0
  97. package/LexicalContextMenuPlugin.js.flow +12 -0
  98. package/LexicalContextMenuPlugin.mjs +2 -0
  99. package/LexicalContextMenuPlugin.node.mjs +2 -0
  100. package/LexicalContextMenuPlugin.prod.js +18 -16
  101. package/LexicalContextMenuPlugin.prod.mjs +3 -1
  102. package/LexicalDecoratorBlockNode.d.ts +1 -0
  103. package/LexicalDecoratorBlockNode.dev.js +6 -0
  104. package/LexicalDecoratorBlockNode.dev.mjs +6 -0
  105. package/LexicalDecoratorBlockNode.js +2 -0
  106. package/LexicalDecoratorBlockNode.mjs +2 -0
  107. package/LexicalDecoratorBlockNode.node.mjs +2 -0
  108. package/LexicalDecoratorBlockNode.prod.js +3 -1
  109. package/LexicalDecoratorBlockNode.prod.mjs +3 -1
  110. package/LexicalEditorRefPlugin.dev.js +17 -1
  111. package/LexicalEditorRefPlugin.dev.mjs +3 -0
  112. package/LexicalEditorRefPlugin.js +2 -0
  113. package/LexicalEditorRefPlugin.js.flow +19 -0
  114. package/LexicalEditorRefPlugin.mjs +2 -0
  115. package/LexicalEditorRefPlugin.node.mjs +2 -0
  116. package/LexicalEditorRefPlugin.prod.js +3 -1
  117. package/LexicalEditorRefPlugin.prod.mjs +2 -0
  118. package/LexicalErrorBoundary.d.ts +3 -1
  119. package/LexicalErrorBoundary.dev.js +30 -10
  120. package/LexicalErrorBoundary.dev.mjs +13 -7
  121. package/LexicalErrorBoundary.js +2 -0
  122. package/LexicalErrorBoundary.js.flow +4 -1
  123. package/LexicalErrorBoundary.mjs +3 -0
  124. package/LexicalErrorBoundary.node.mjs +3 -0
  125. package/LexicalErrorBoundary.prod.js +6 -4
  126. package/LexicalErrorBoundary.prod.mjs +3 -1
  127. package/LexicalHashtagPlugin.dev.js +5 -2
  128. package/LexicalHashtagPlugin.dev.mjs +5 -2
  129. package/LexicalHashtagPlugin.js +2 -0
  130. package/LexicalHashtagPlugin.mjs +2 -0
  131. package/LexicalHashtagPlugin.node.mjs +2 -0
  132. package/LexicalHashtagPlugin.prod.js +2 -0
  133. package/LexicalHashtagPlugin.prod.mjs +2 -0
  134. package/LexicalHistoryPlugin.dev.js +4 -0
  135. package/LexicalHistoryPlugin.dev.mjs +4 -0
  136. package/LexicalHistoryPlugin.js +2 -0
  137. package/LexicalHistoryPlugin.mjs +2 -0
  138. package/LexicalHistoryPlugin.node.mjs +2 -0
  139. package/LexicalHistoryPlugin.prod.js +2 -0
  140. package/LexicalHistoryPlugin.prod.mjs +2 -0
  141. package/LexicalHorizontalRuleNode.d.ts +2 -2
  142. package/LexicalHorizontalRuleNode.dev.js +23 -12
  143. package/LexicalHorizontalRuleNode.dev.mjs +21 -11
  144. package/LexicalHorizontalRuleNode.js +2 -0
  145. package/LexicalHorizontalRuleNode.mjs +2 -0
  146. package/LexicalHorizontalRuleNode.node.mjs +2 -0
  147. package/LexicalHorizontalRuleNode.prod.js +7 -5
  148. package/LexicalHorizontalRuleNode.prod.mjs +3 -1
  149. package/LexicalHorizontalRulePlugin.dev.js +3 -0
  150. package/LexicalHorizontalRulePlugin.dev.mjs +3 -0
  151. package/LexicalHorizontalRulePlugin.js +2 -0
  152. package/LexicalHorizontalRulePlugin.mjs +2 -0
  153. package/LexicalHorizontalRulePlugin.node.mjs +2 -0
  154. package/LexicalHorizontalRulePlugin.prod.js +2 -0
  155. package/LexicalHorizontalRulePlugin.prod.mjs +2 -0
  156. package/LexicalLinkPlugin.dev.js +6 -3
  157. package/LexicalLinkPlugin.dev.mjs +7 -4
  158. package/LexicalLinkPlugin.js +2 -0
  159. package/LexicalLinkPlugin.mjs +2 -0
  160. package/LexicalLinkPlugin.node.mjs +2 -0
  161. package/LexicalLinkPlugin.prod.js +3 -1
  162. package/LexicalLinkPlugin.prod.mjs +3 -1
  163. package/LexicalListPlugin.dev.js +4 -0
  164. package/LexicalListPlugin.dev.mjs +4 -0
  165. package/LexicalListPlugin.js +2 -0
  166. package/LexicalListPlugin.mjs +2 -0
  167. package/LexicalListPlugin.node.mjs +2 -0
  168. package/LexicalListPlugin.prod.js +2 -0
  169. package/LexicalListPlugin.prod.mjs +2 -0
  170. package/LexicalMarkdownShortcutPlugin.dev.js +3 -0
  171. package/LexicalMarkdownShortcutPlugin.dev.mjs +3 -0
  172. package/LexicalMarkdownShortcutPlugin.js +2 -0
  173. package/LexicalMarkdownShortcutPlugin.mjs +2 -0
  174. package/LexicalMarkdownShortcutPlugin.node.mjs +2 -0
  175. package/LexicalMarkdownShortcutPlugin.prod.js +2 -0
  176. package/LexicalMarkdownShortcutPlugin.prod.mjs +2 -0
  177. package/LexicalNestedComposer.dev.js +14 -9
  178. package/LexicalNestedComposer.dev.mjs +8 -4
  179. package/LexicalNestedComposer.js +2 -0
  180. package/LexicalNestedComposer.mjs +2 -0
  181. package/LexicalNestedComposer.node.mjs +2 -0
  182. package/LexicalNestedComposer.prod.js +7 -5
  183. package/LexicalNestedComposer.prod.mjs +3 -1
  184. package/LexicalNodeEventPlugin.dev.js +3 -0
  185. package/LexicalNodeEventPlugin.dev.mjs +3 -0
  186. package/LexicalNodeEventPlugin.js +2 -0
  187. package/LexicalNodeEventPlugin.js.flow +12 -0
  188. package/LexicalNodeEventPlugin.mjs +2 -0
  189. package/LexicalNodeEventPlugin.node.mjs +2 -0
  190. package/LexicalNodeEventPlugin.prod.js +2 -0
  191. package/LexicalNodeEventPlugin.prod.mjs +2 -0
  192. package/LexicalNodeMenuPlugin.dev.js +30 -8
  193. package/LexicalNodeMenuPlugin.dev.mjs +17 -8
  194. package/LexicalNodeMenuPlugin.js +2 -0
  195. package/LexicalNodeMenuPlugin.mjs +2 -0
  196. package/LexicalNodeMenuPlugin.node.mjs +2 -0
  197. package/LexicalNodeMenuPlugin.prod.js +17 -15
  198. package/LexicalNodeMenuPlugin.prod.mjs +3 -1
  199. package/LexicalOnChangePlugin.dev.js +9 -2
  200. package/LexicalOnChangePlugin.dev.mjs +11 -4
  201. package/LexicalOnChangePlugin.js +2 -0
  202. package/LexicalOnChangePlugin.mjs +2 -0
  203. package/LexicalOnChangePlugin.node.mjs +2 -0
  204. package/LexicalOnChangePlugin.prod.js +3 -1
  205. package/LexicalOnChangePlugin.prod.mjs +3 -1
  206. package/LexicalPlainTextPlugin.dev.js +34 -19
  207. package/LexicalPlainTextPlugin.dev.mjs +31 -17
  208. package/LexicalPlainTextPlugin.js +2 -0
  209. package/LexicalPlainTextPlugin.js.flow +1 -1
  210. package/LexicalPlainTextPlugin.mjs +2 -0
  211. package/LexicalPlainTextPlugin.node.mjs +2 -0
  212. package/LexicalPlainTextPlugin.prod.js +6 -4
  213. package/LexicalPlainTextPlugin.prod.mjs +3 -1
  214. package/LexicalRichTextPlugin.dev.js +34 -19
  215. package/LexicalRichTextPlugin.dev.mjs +31 -17
  216. package/LexicalRichTextPlugin.js +2 -0
  217. package/LexicalRichTextPlugin.js.flow +1 -1
  218. package/LexicalRichTextPlugin.mjs +2 -0
  219. package/LexicalRichTextPlugin.node.mjs +2 -0
  220. package/LexicalRichTextPlugin.prod.js +6 -4
  221. package/LexicalRichTextPlugin.prod.mjs +3 -1
  222. package/LexicalTabIndentationPlugin.dev.js +5 -2
  223. package/LexicalTabIndentationPlugin.dev.mjs +5 -2
  224. package/LexicalTabIndentationPlugin.js +2 -0
  225. package/LexicalTabIndentationPlugin.mjs +2 -0
  226. package/LexicalTabIndentationPlugin.node.mjs +2 -0
  227. package/LexicalTabIndentationPlugin.prod.js +2 -0
  228. package/LexicalTabIndentationPlugin.prod.mjs +2 -0
  229. package/LexicalTableOfContents.d.ts +6 -13
  230. package/LexicalTableOfContents.dev.js +57 -10
  231. package/LexicalTableOfContents.dev.mjs +58 -11
  232. package/LexicalTableOfContents.js +2 -0
  233. package/LexicalTableOfContents.js.flow +3 -7
  234. package/LexicalTableOfContents.mjs +2 -0
  235. package/LexicalTableOfContents.node.mjs +2 -0
  236. package/LexicalTableOfContents.prod.js +6 -4
  237. package/LexicalTableOfContents.prod.mjs +3 -1
  238. package/LexicalTableOfContentsPlugin.d.ts +20 -0
  239. package/LexicalTableOfContentsPlugin.dev.js +198 -0
  240. package/LexicalTableOfContentsPlugin.dev.mjs +196 -0
  241. package/LexicalTableOfContentsPlugin.js +11 -0
  242. package/LexicalTableOfContentsPlugin.js.flow +18 -0
  243. package/LexicalTableOfContentsPlugin.mjs +12 -0
  244. package/LexicalTableOfContentsPlugin.node.mjs +10 -0
  245. package/LexicalTableOfContentsPlugin.prod.js +12 -0
  246. package/LexicalTableOfContentsPlugin.prod.mjs +9 -0
  247. package/LexicalTablePlugin.dev.js +28 -2
  248. package/LexicalTablePlugin.dev.mjs +31 -5
  249. package/LexicalTablePlugin.js +2 -0
  250. package/LexicalTablePlugin.mjs +2 -0
  251. package/LexicalTablePlugin.node.mjs +2 -0
  252. package/LexicalTablePlugin.prod.js +9 -5
  253. package/LexicalTablePlugin.prod.mjs +3 -1
  254. package/LexicalTreeView.d.ts +3 -1
  255. package/LexicalTreeView.dev.js +22 -4
  256. package/LexicalTreeView.dev.mjs +8 -3
  257. package/LexicalTreeView.js +2 -0
  258. package/LexicalTreeView.js.flow +2 -0
  259. package/LexicalTreeView.mjs +2 -0
  260. package/LexicalTreeView.node.mjs +2 -0
  261. package/LexicalTreeView.prod.js +5 -3
  262. package/LexicalTreeView.prod.mjs +3 -1
  263. package/LexicalTypeaheadMenuPlugin.dev.js +30 -8
  264. package/LexicalTypeaheadMenuPlugin.dev.mjs +17 -8
  265. package/LexicalTypeaheadMenuPlugin.js +2 -0
  266. package/LexicalTypeaheadMenuPlugin.mjs +2 -0
  267. package/LexicalTypeaheadMenuPlugin.node.mjs +2 -0
  268. package/LexicalTypeaheadMenuPlugin.prod.js +21 -19
  269. package/LexicalTypeaheadMenuPlugin.prod.mjs +3 -1
  270. package/package.json +50 -20
  271. package/shared/useCharacterLimit.d.ts +1 -1
  272. package/useLexicalEditable.d.ts +11 -1
  273. package/useLexicalEditable.dev.js +22 -3
  274. package/useLexicalEditable.dev.mjs +23 -5
  275. package/useLexicalEditable.js +2 -0
  276. package/useLexicalEditable.js.flow +4 -1
  277. package/useLexicalEditable.mjs +4 -1
  278. package/useLexicalEditable.node.mjs +4 -1
  279. package/useLexicalEditable.prod.js +4 -2
  280. package/useLexicalEditable.prod.mjs +3 -1
  281. package/useLexicalIsTextContentEmpty.dev.js +9 -2
  282. package/useLexicalIsTextContentEmpty.dev.mjs +11 -4
  283. package/useLexicalIsTextContentEmpty.js +2 -0
  284. package/useLexicalIsTextContentEmpty.mjs +2 -0
  285. package/useLexicalIsTextContentEmpty.node.mjs +2 -0
  286. package/useLexicalIsTextContentEmpty.prod.js +3 -1
  287. package/useLexicalIsTextContentEmpty.prod.mjs +3 -1
  288. package/useLexicalNodeSelection.dev.js +3 -0
  289. package/useLexicalNodeSelection.dev.mjs +4 -1
  290. package/useLexicalNodeSelection.js +2 -0
  291. package/useLexicalNodeSelection.mjs +2 -0
  292. package/useLexicalNodeSelection.node.mjs +2 -0
  293. package/useLexicalNodeSelection.prod.js +2 -0
  294. package/useLexicalNodeSelection.prod.mjs +3 -1
  295. package/useLexicalSubscription.d.ts +4 -1
  296. package/useLexicalSubscription.dev.js +12 -3
  297. package/useLexicalSubscription.dev.mjs +13 -5
  298. package/useLexicalSubscription.js +2 -0
  299. package/useLexicalSubscription.js.flow +4 -1
  300. package/useLexicalSubscription.mjs +4 -1
  301. package/useLexicalSubscription.node.mjs +4 -1
  302. package/useLexicalSubscription.prod.js +4 -2
  303. package/useLexicalSubscription.prod.mjs +3 -1
  304. package/useLexicalTextEntity.dev.js +3 -0
  305. package/useLexicalTextEntity.dev.mjs +3 -0
  306. package/useLexicalTextEntity.js +2 -0
  307. package/useLexicalTextEntity.mjs +2 -0
  308. package/useLexicalTextEntity.node.mjs +2 -0
  309. package/useLexicalTextEntity.prod.js +2 -0
  310. package/useLexicalTextEntity.prod.mjs +2 -0
@@ -3,5 +3,7 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- import{useCollaborationContext as e}from"@lexical/react/LexicalCollaborationContext";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import*as o from"react";import{useRef as r,useState as n,useMemo as s,useCallback as c,useEffect as a}from"react";import{mergeRegister as i}from"@lexical/utils";import{createBinding as l,initLocalState as d,syncLexicalUpdateToYjs as m,TOGGLE_CONNECT_COMMAND as u,setLocalStateFocus as f,createUndoManager as p,CONNECTED_COMMAND as g,syncCursorPositions as y,syncYjsChangesToLexical as C}from"@lexical/yjs";import{COMMAND_PRIORITY_EDITOR as h,FOCUS_COMMAND as E,BLUR_COMMAND as v,UNDO_COMMAND as b,REDO_COMMAND as x,CAN_UNDO_COMMAND as k,CAN_REDO_COMMAND as S,$getRoot as D,$createParagraphNode as j,$getSelection as L}from"lexical";import{createPortal as T}from"react-dom";import{UndoManager as w}from"yjs";function A(e,t,i,f,p,E,v,b,x,k,S){const A=r(!1),[R,_]=n(f.get(t)),I=s((()=>l(e,i,t,R,f,k)),[e,i,t,f,R,k]),z=c((()=>{i.connect()}),[i]),B=c((()=>{try{i.disconnect()}catch(e){}}),[i]);a((()=>{const{root:o}=I,{awareness:r}=i,n=({status:t})=>{e.dispatchCommand(g,"connected"===t)},s=t=>{v&&t&&o.isEmpty()&&0===o._xmlText._length&&!1===A.current&&function(e,t){e.update((()=>{const o=D();if(o.isEmpty())if(t)switch(typeof t){case"string":{const o=e.parseEditorState(t);e.setEditorState(o,{tag:"history-merge"});break}case"object":e.setEditorState(t,{tag:"history-merge"});break;case"function":e.update((()=>{D().isEmpty()&&t(e)}),{tag:"history-merge"})}else{const t=j();o.append(t);const{activeElement:r}=document;(null!==L()||null!==r&&r===e.getRootElement())&&t.select()}}),{tag:"history-merge"})}(e,x),A.current=!1},c=()=>{y(I,i)},a=(e,t)=>{const o=t.origin;if(o!==I){C(I,i,e,o instanceof w)}};d(i,p,E,document.activeElement===e.getRootElement(),S||{});const l=o=>{!function(e,t){if(e.update((()=>{const e=D();e.clear(),e.select()}),{tag:"skip-collab"}),null==t.cursors)return;const o=t.cursors;if(null==o)return;const r=t.cursorsContainer;if(null==r)return;const n=Array.from(o.values());for(let e=0;e<n.length;e++){const t=n[e].selection;if(t&&null!=t.selections){const o=t.selections;for(let t=0;t<o.length;t++)r.removeChild(o[e])}}}(e,I),_(o),f.set(t,o),A.current=!0};i.on("reload",l),i.on("status",n),i.on("sync",s),r.on("update",c),o.getSharedType().observeDeep(a);const u=e.registerUpdateListener((({prevEditorState:e,editorState:t,dirtyLeaves:o,dirtyElements:r,normalizedNodes:n,tags:s})=>{!1===s.has("skip-collab")&&m(I,i,e,t,r,o,n,s)}));return z(),()=>{!1===A.current&&B(),i.off("sync",s),i.off("status",n),i.off("reload",l),r.off("update",c),o.getSharedType().unobserveDeep(a),f.delete(t),u()}}),[I,E,z,B,f,e,t,x,p,i,v,S]);const F=s((()=>T(o.createElement("div",{ref:e=>{I.cursorsContainer=e}}),b&&b.current||document.body)),[I,b]);return a((()=>e.registerCommand(u,(e=>{if(void 0!==z&&void 0!==B){e?(console.log("Collaboration connected!"),z()):(console.log("Collaboration disconnected!"),B())}return!0}),h)),[z,B,e]),[F,I]}function R(e,t){const r=s((()=>p(t,t.root.getSharedType())),[t]);a((()=>i(e.registerCommand(b,(()=>(r.undo(),!0)),h),e.registerCommand(x,(()=>(r.redo(),!0)),h))));const n=c((()=>{r.clear()}),[r]);return o.useEffect((()=>{const t=()=>{e.dispatchCommand(k,r.undoStack.length>0),e.dispatchCommand(S,r.redoStack.length>0)};return r.on("stack-item-added",t),r.on("stack-item-popped",t),r.on("stack-cleared",t),()=>{r.off("stack-item-added",t),r.off("stack-item-popped",t),r.off("stack-cleared",t)}}),[e,r]),n}function _({id:o,providerFactory:r,shouldBootstrap:n,username:c,cursorColor:l,cursorsContainerRef:d,initialEditorState:m,excludedProperties:u,awarenessData:p}){const g=e(c,l),{yjsDocMap:y,name:C,color:b}=g,[x]=t();a((()=>(g.isCollabActive=!0,()=>{null==x._parentEditor&&(g.isCollabActive=!1)})),[g,x]);const k=s((()=>r(o,y)),[o,r,y]),[S,D]=A(x,o,k,y,C,b,n,d,m,u,p);return g.clientID=D.clientID,R(x,D),function(e,t,o,r,n){a((()=>i(e.registerCommand(E,(()=>(f(t,o,r,!0,n||{}),!1)),h),e.registerCommand(v,(()=>(f(t,o,r,!1,n||{}),!1)),h))),[r,e,o,t,n])}(x,k,C,b,p),S}export{_ as CollaborationPlugin};
8
+
9
+ import{useCollaborationContext as t}from"@lexical/react/LexicalCollaborationContext";import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import*as o from"react";import{useRef as r,useState as n,useMemo as s,useCallback as c,useEffect as a}from"react";import{mergeRegister as i}from"@lexical/utils";import{createBinding as l,initLocalState as d,syncLexicalUpdateToYjs as m,TOGGLE_CONNECT_COMMAND as u,setLocalStateFocus as f,createUndoManager as p,CONNECTED_COMMAND as g,syncCursorPositions as y,syncYjsChangesToLexical as C}from"@lexical/yjs";import{COMMAND_PRIORITY_EDITOR as h,FOCUS_COMMAND as E,BLUR_COMMAND as v,UNDO_COMMAND as x,REDO_COMMAND as b,CAN_UNDO_COMMAND as k,CAN_REDO_COMMAND as S,$getRoot as D,$createParagraphNode as j,$getSelection as L}from"lexical";import{createPortal as T}from"react-dom";import{UndoManager as w}from"yjs";import{jsx as A}from"react/jsx-runtime";function R(t,e,o,i,f,p,E,v,x,b,k){const S=r(!1),[R,_]=n(i.get(e)),I=s((()=>l(t,o,e,R,i,b)),[t,o,e,i,R,b]),z=c((()=>{o.connect()}),[o]),B=c((()=>{try{o.disconnect()}catch(t){}}),[o]);a((()=>{const{root:r}=I,{awareness:n}=o,s=({status:e})=>{t.dispatchCommand(g,"connected"===e)},c=e=>{E&&e&&r.isEmpty()&&0===r._xmlText._length&&!1===S.current&&function(t,e){t.update((()=>{const o=D();if(o.isEmpty())if(e)switch(typeof e){case"string":{const o=t.parseEditorState(e);t.setEditorState(o,{tag:"history-merge"});break}case"object":t.setEditorState(e,{tag:"history-merge"});break;case"function":t.update((()=>{D().isEmpty()&&e(t)}),{tag:"history-merge"})}else{const e=j();o.append(e);const{activeElement:r}=document;(null!==L()||null!==r&&r===t.getRootElement())&&e.select()}}),{tag:"history-merge"})}(t,x),S.current=!1},a=()=>{y(I,o)},l=(t,e)=>{const r=e.origin;if(r!==I){C(I,o,t,r instanceof w)}};d(o,f,p,document.activeElement===t.getRootElement(),k||{});const u=o=>{!function(t,e){if(t.update((()=>{const t=D();t.clear(),t.select()}),{tag:"skip-collab"}),null==e.cursors)return;const o=e.cursors;if(null==o)return;const r=e.cursorsContainer;if(null==r)return;const n=Array.from(o.values());for(let t=0;t<n.length;t++){const e=n[t].selection;if(e&&null!=e.selections){const o=e.selections;for(let e=0;e<o.length;e++)r.removeChild(o[t])}}}(t,I),_(o),i.set(e,o),S.current=!0};o.on("reload",u),o.on("status",s),o.on("sync",c),n.on("update",a),r.getSharedType().observeDeep(l);const h=t.registerUpdateListener((({prevEditorState:t,editorState:e,dirtyLeaves:r,dirtyElements:n,normalizedNodes:s,tags:c})=>{!1===c.has("skip-collab")&&m(I,o,t,e,n,r,s,c)}));return z(),()=>{!1===S.current&&B(),o.off("sync",c),o.off("status",s),o.off("reload",u),n.off("update",a),r.getSharedType().unobserveDeep(l),i.delete(e),h()}}),[I,p,z,B,i,t,e,x,f,o,E,k]);const F=s((()=>T(A("div",{ref:t=>{I.cursorsContainer=t}}),v&&v.current||document.body)),[I,v]);return a((()=>t.registerCommand(u,(t=>{if(void 0!==z&&void 0!==B){t?(console.log("Collaboration connected!"),z()):(console.log("Collaboration disconnected!"),B())}return!0}),h)),[z,B,t]),[F,I]}function _(t,e){const r=s((()=>p(e,e.root.getSharedType())),[e]);a((()=>i(t.registerCommand(x,(()=>(r.undo(),!0)),h),t.registerCommand(b,(()=>(r.redo(),!0)),h))));const n=c((()=>{r.clear()}),[r]);return o.useEffect((()=>{const e=()=>{t.dispatchCommand(k,r.undoStack.length>0),t.dispatchCommand(S,r.redoStack.length>0)};return r.on("stack-item-added",e),r.on("stack-item-popped",e),r.on("stack-cleared",e),()=>{r.off("stack-item-added",e),r.off("stack-item-popped",e),r.off("stack-cleared",e)}}),[t,r]),n}function I({id:o,providerFactory:r,shouldBootstrap:n,username:c,cursorColor:l,cursorsContainerRef:d,initialEditorState:m,excludedProperties:u,awarenessData:p}){const g=t(c,l),{yjsDocMap:y,name:C,color:x}=g,[b]=e();a((()=>(g.isCollabActive=!0,()=>{null==b._parentEditor&&(g.isCollabActive=!1)})),[g,b]);const k=s((()=>r(o,y)),[o,r,y]),[S,D]=R(b,o,k,y,C,x,n,d,m,u,p);return g.clientID=D.clientID,_(b,D),function(t,e,o,r,n){a((()=>i(t.registerCommand(E,(()=>(f(e,o,r,!0,n||{}),!1)),h),t.registerCommand(v,(()=>(f(e,o,r,!1,n||{}),!1)),h))),[r,t,o,e,n])}(b,k,C,x,p),S}export{I as CollaborationPlugin};
@@ -3,12 +3,15 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict';
8
10
 
9
11
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
10
12
  var lexical = require('lexical');
11
- var React = require('react');
13
+ var react = require('react');
14
+ var jsxRuntime = require('react/jsx-runtime');
12
15
 
13
16
  /**
14
17
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -27,8 +30,12 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
27
30
  * LICENSE file in the root directory of this source tree.
28
31
  *
29
32
  */
30
- const useLayoutEffectImpl = CAN_USE_DOM ? React.useLayoutEffect : React.useEffect;
31
- var useLayoutEffect = useLayoutEffectImpl;
33
+
34
+
35
+ // This workaround is no longer necessary in React 19,
36
+ // but we currently support React >=17.x
37
+ // https://github.com/facebook/react/pull/26395
38
+ const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
32
39
 
33
40
  /**
34
41
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -37,6 +44,7 @@ var useLayoutEffect = useLayoutEffectImpl;
37
44
  * LICENSE file in the root directory of this source tree.
38
45
  *
39
46
  */
47
+
40
48
  const HISTORY_MERGE_OPTIONS = {
41
49
  tag: 'history-merge'
42
50
  };
@@ -44,7 +52,7 @@ function LexicalComposer({
44
52
  initialConfig,
45
53
  children
46
54
  }) {
47
- const composerContext = React.useMemo(() => {
55
+ const composerContext = react.useMemo(() => {
48
56
  const {
49
57
  theme,
50
58
  namespace,
@@ -73,7 +81,7 @@ function LexicalComposer({
73
81
  // We only do this for init
74
82
  // eslint-disable-next-line react-hooks/exhaustive-deps
75
83
  []);
76
- useLayoutEffect(() => {
84
+ useLayoutEffectImpl(() => {
77
85
  const isEditable = initialConfig.editable;
78
86
  const [editor] = composerContext;
79
87
  editor.setEditable(isEditable !== undefined ? isEditable : true);
@@ -81,9 +89,10 @@ function LexicalComposer({
81
89
  // We only do this for init
82
90
  // eslint-disable-next-line react-hooks/exhaustive-deps
83
91
  }, []);
84
- return /*#__PURE__*/React.createElement(LexicalComposerContext.LexicalComposerContext.Provider, {
85
- value: composerContext
86
- }, children);
92
+ return /*#__PURE__*/jsxRuntime.jsx(LexicalComposerContext.LexicalComposerContext.Provider, {
93
+ value: composerContext,
94
+ children: children
95
+ });
87
96
  }
88
97
  function initializeEditor(editor, initialEditorState) {
89
98
  if (initialEditorState === null) {
@@ -3,11 +3,13 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import { createLexicalComposerContext, LexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
10
  import { createEditor, $getRoot, $createParagraphNode, $getSelection } from 'lexical';
9
- import * as React from 'react';
10
- import { useLayoutEffect as useLayoutEffect$1, useEffect, useMemo } from 'react';
11
+ import { useLayoutEffect, useEffect, useMemo } from 'react';
12
+ import { jsx } from 'react/jsx-runtime';
11
13
 
12
14
  /**
13
15
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -26,8 +28,12 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
26
28
  * LICENSE file in the root directory of this source tree.
27
29
  *
28
30
  */
29
- const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect$1 : useEffect;
30
- var useLayoutEffect = useLayoutEffectImpl;
31
+
32
+
33
+ // This workaround is no longer necessary in React 19,
34
+ // but we currently support React >=17.x
35
+ // https://github.com/facebook/react/pull/26395
36
+ const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
31
37
 
32
38
  /**
33
39
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -36,6 +42,7 @@ var useLayoutEffect = useLayoutEffectImpl;
36
42
  * LICENSE file in the root directory of this source tree.
37
43
  *
38
44
  */
45
+
39
46
  const HISTORY_MERGE_OPTIONS = {
40
47
  tag: 'history-merge'
41
48
  };
@@ -72,7 +79,7 @@ function LexicalComposer({
72
79
  // We only do this for init
73
80
  // eslint-disable-next-line react-hooks/exhaustive-deps
74
81
  []);
75
- useLayoutEffect(() => {
82
+ useLayoutEffectImpl(() => {
76
83
  const isEditable = initialConfig.editable;
77
84
  const [editor] = composerContext;
78
85
  editor.setEditable(isEditable !== undefined ? isEditable : true);
@@ -80,9 +87,10 @@ function LexicalComposer({
80
87
  // We only do this for init
81
88
  // eslint-disable-next-line react-hooks/exhaustive-deps
82
89
  }, []);
83
- return /*#__PURE__*/React.createElement(LexicalComposerContext.Provider, {
84
- value: composerContext
85
- }, children);
90
+ return /*#__PURE__*/jsx(LexicalComposerContext.Provider, {
91
+ value: composerContext,
92
+ children: children
93
+ });
86
94
  }
87
95
  function initializeEditor(editor, initialEditorState) {
88
96
  if (initialEditorState === null) {
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict'
8
10
  const LexicalComposer = process.env.NODE_ENV === 'development' ? require('./LexicalComposer.dev.js') : require('./LexicalComposer.prod.js');
9
11
  module.exports = LexicalComposer;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import * as modDev from './LexicalComposer.dev.mjs';
8
10
  import * as modProd from './LexicalComposer.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalComposer.dev.mjs') : import('./LexicalComposer.prod.mjs'));
8
10
  export const LexicalComposer = mod.LexicalComposer;
@@ -3,8 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- 'use strict';var e=require("@lexical/react/LexicalComposerContext"),f=require("lexical"),g=require("react");let m="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;var n=m?g.useLayoutEffect:g.useEffect;let p={tag:"history-merge"};
8
- function q(a,c){if(null!==c)if(void 0===c)a.update(()=>{var b=f.$getRoot();if(b.isEmpty()){let d=f.$createParagraphNode();b.append(d);b=m?document.activeElement:null;(null!==f.$getSelection()||null!==b&&b===a.getRootElement())&&d.select()}},p);else if(null!==c)switch(typeof c){case "string":let b=a.parseEditorState(c);a.setEditorState(b,p);break;case "object":a.setEditorState(c,p);break;case "function":a.update(()=>{f.$getRoot().isEmpty()&&c(a)},p)}}
9
- exports.LexicalComposer=function({initialConfig:a,children:c}){let b=g.useMemo(()=>{const {theme:d,namespace:h,editor__DEPRECATED:r,nodes:t,onError:u,editorState:v,html:w}=a,x=e.createLexicalComposerContext(null,d);let k=r||null;if(null===k){const l=f.createEditor({editable:a.editable,html:w,namespace:h,nodes:t,onError:y=>u(y,l),theme:d});q(l,v);k=l}return[k,x]},[]);n(()=>{let d=a.editable,[h]=b;h.setEditable(void 0!==d?d:!0)},[]);return g.createElement(e.LexicalComposerContext.Provider,{value:b},
10
- c)}
8
+
9
+ 'use strict';var e=require("@lexical/react/LexicalComposerContext"),f=require("lexical"),g=require("react"),m=require("react/jsx-runtime");let n="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,p=n?g.useLayoutEffect:g.useEffect,q={tag:"history-merge"};
10
+ function r(a,c){if(null!==c)if(void 0===c)a.update(()=>{var b=f.$getRoot();if(b.isEmpty()){let d=f.$createParagraphNode();b.append(d);b=n?document.activeElement:null;(null!==f.$getSelection()||null!==b&&b===a.getRootElement())&&d.select()}},q);else if(null!==c)switch(typeof c){case "string":let b=a.parseEditorState(c);a.setEditorState(b,q);break;case "object":a.setEditorState(c,q);break;case "function":a.update(()=>{f.$getRoot().isEmpty()&&c(a)},q)}}
11
+ exports.LexicalComposer=function({initialConfig:a,children:c}){let b=g.useMemo(()=>{const {theme:d,namespace:h,editor__DEPRECATED:t,nodes:u,onError:v,editorState:w,html:x}=a,y=e.createLexicalComposerContext(null,d);let k=t||null;if(null===k){const l=f.createEditor({editable:a.editable,html:x,namespace:h,nodes:u,onError:z=>v(z,l),theme:d});r(l,w);k=l}return[k,y]},[]);p(()=>{let d=a.editable,[h]=b;h.setEditable(void 0!==d?d:!0)},[]);return m.jsx(e.LexicalComposerContext.Provider,{value:b,children:c})}
@@ -3,5 +3,7 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- import{createLexicalComposerContext as e,LexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{createEditor as o,$getRoot as n,$createParagraphNode as i,$getSelection as r}from"lexical";import*as a from"react";import{useLayoutEffect as l,useEffect as c,useMemo as s}from"react";const d="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;var m=d?l:c;const u={tag:"history-merge"};function f({initialConfig:l,children:c}){const f=s((()=>{const{theme:t,namespace:a,editor__DEPRECATED:c,nodes:s,onError:m,editorState:f,html:p}=l,E=e(null,t);let v=c||null;if(null===v){const e=o({editable:l.editable,html:p,namespace:a,nodes:s,onError:t=>m(t,e),theme:t});!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=d?document.activeElement:null;(null!==r()||null!==n&&n===e.getRootElement())&&o.select()}}),u);else if(null!==t)switch(typeof t){case"string":{const o=e.parseEditorState(t);e.setEditorState(o,u);break}case"object":e.setEditorState(t,u);break;case"function":e.update((()=>{n().isEmpty()&&t(e)}),u)}}(e,f),v=e}return[v,E]}),[]);return m((()=>{const e=l.editable,[t]=f;t.setEditable(void 0===e||e)}),[]),a.createElement(t.Provider,{value:f},c)}export{f as LexicalComposer};
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}from"lexical";import{useLayoutEffect as l,useEffect as c,useMemo as a}from"react";import{jsx as d}from"react/jsx-runtime";const s="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,m=s?l:c,u={tag:"history-merge"};function p({initialConfig:l,children:c}){const p=a((()=>{const{theme:t,namespace:c,editor__DEPRECATED:a,nodes:d,onError:m,editorState:p,html:f}=l,E=e(null,t);let h=a||null;if(null===h){const e=o({editable:l.editable,html:f,namespace:c,nodes:d,onError:t=>m(t,e),theme:t});!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=s?document.activeElement:null;(null!==r()||null!==n&&n===e.getRootElement())&&o.select()}}),u);else if(null!==t)switch(typeof t){case"string":{const o=e.parseEditorState(t);e.setEditorState(o,u);break}case"object":e.setEditorState(t,u);break;case"function":e.update((()=>{n().isEmpty()&&t(e)}),u)}}(e,p),h=e}return[h,E]}),[]);return m((()=>{const e=l.editable,[t]=p;t.setEditable(void 0===e||e)}),[]),d(t.Provider,{value:p,children:c})}export{p as LexicalComposer};
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict';
8
10
 
9
11
  var react = require('react');
@@ -15,6 +17,7 @@ var react = require('react');
15
17
  * LICENSE file in the root directory of this source tree.
16
18
  *
17
19
  */
20
+
18
21
  const LexicalComposerContext = /*#__PURE__*/react.createContext(null);
19
22
  function createLexicalComposerContext(parent, theme) {
20
23
  let parentContext = null;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import { createContext, useContext } from 'react';
8
10
 
9
11
  /**
@@ -13,6 +15,7 @@ import { createContext, useContext } from 'react';
13
15
  * LICENSE file in the root directory of this source tree.
14
16
  *
15
17
  */
18
+
16
19
  const LexicalComposerContext = /*#__PURE__*/createContext(null);
17
20
  function createLexicalComposerContext(parent, theme) {
18
21
  let parentContext = null;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict'
8
10
  const LexicalComposerContext = process.env.NODE_ENV === 'development' ? require('./LexicalComposerContext.dev.js') : require('./LexicalComposerContext.prod.js');
9
11
  module.exports = LexicalComposerContext;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import * as modDev from './LexicalComposerContext.dev.mjs';
8
10
  import * as modProd from './LexicalComposerContext.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalComposerContext.dev.mjs') : import('./LexicalComposerContext.prod.mjs'));
8
10
  export const LexicalComposerContext = mod.LexicalComposerContext;
9
11
  export const createLexicalComposerContext = mod.createLexicalComposerContext;
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- 'use strict';var d=require("react");function e(a){let c=new URLSearchParams;c.append("code",a);for(let b=1;b<arguments.length;b++)c.append("v",arguments[b]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${c} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}let f=d.createContext(null);exports.LexicalComposerContext=f;
8
- exports.createLexicalComposerContext=function(a,c){let b=null;null!=a&&(b=a[1]);return{getTheme:function(){return null!=c?c:null!=b?b.getTheme():null}}};exports.useLexicalComposerContext=function(){let a=d.useContext(f);null==a&&e(8);return a}
8
+
9
+ 'use strict';var d=require("react"),e;function f(a){let c=new URLSearchParams;c.append("code",a);for(let b=1;b<arguments.length;b++)c.append("v",arguments[b]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${c} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}e=f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f["default"]:f;let g=d.createContext(null);
10
+ exports.LexicalComposerContext=g;exports.createLexicalComposerContext=function(a,c){let b=null;null!=a&&(b=a[1]);return{getTheme:function(){return null!=c?c:null!=b?b.getTheme():null}}};exports.useLexicalComposerContext=function(){let a=d.useContext(g);null==a&&e(8);return a}
@@ -3,5 +3,7 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- import{createContext as e,useContext as n}from"react";var r=function(e){const n=new URLSearchParams;n.append("code",e);for(let e=1;e<arguments.length;e++)n.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${n} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)};const l=e(null);function t(e,n){let r=null;return null!=e&&(r=e[1]),{getTheme:function(){return null!=n?n:null!=r?r.getTheme():null}}}function o(){const e=n(l);return null==e&&r(8),e}export{l as LexicalComposerContext,t as createLexicalComposerContext,o as useLexicalComposerContext};
8
+
9
+ import{createContext as e,useContext as n}from"react";function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=r((function(e){const n=new URLSearchParams;n.append("code",e);for(let e=1;e<arguments.length;e++)n.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${n} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));const l=e(null);function o(e,n){let r=null;return null!=e&&(r=e[1]),{getTheme:function(){return null!=n?n:null!=r?r.getTheme():null}}}function u(){const e=n(l);return null==e&&t(8),e}export{l as LexicalComposerContext,o as createLexicalComposerContext,u as useLexicalComposerContext};
@@ -3,26 +3,14 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict';
8
10
 
9
11
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
10
- var React = require('react');
11
-
12
- function _extends() {
13
- _extends = Object.assign ? Object.assign.bind() : function (target) {
14
- for (var i = 1; i < arguments.length; i++) {
15
- var source = arguments[i];
16
- for (var key in source) {
17
- if (Object.prototype.hasOwnProperty.call(source, key)) {
18
- target[key] = source[key];
19
- }
20
- }
21
- }
22
- return target;
23
- };
24
- return _extends.apply(this, arguments);
25
- }
12
+ var react = require('react');
13
+ var jsxRuntime = require('react/jsx-runtime');
26
14
 
27
15
  /**
28
16
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -41,8 +29,20 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
41
29
  * LICENSE file in the root directory of this source tree.
42
30
  *
43
31
  */
44
- const useLayoutEffectImpl = CAN_USE_DOM ? React.useLayoutEffect : React.useEffect;
45
- var useLayoutEffect = useLayoutEffectImpl;
32
+
33
+
34
+ // This workaround is no longer necessary in React 19,
35
+ // but we currently support React >=17.x
36
+ // https://github.com/facebook/react/pull/26395
37
+ const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
38
+
39
+ /**
40
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
41
+ *
42
+ * This source code is licensed under the MIT license found in the
43
+ * LICENSE file in the root directory of this source tree.
44
+ *
45
+ */
46
46
 
47
47
  function ContentEditable({
48
48
  ariaActiveDescendant,
@@ -66,21 +66,22 @@ function ContentEditable({
66
66
  ...rest
67
67
  }) {
68
68
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
69
- const [isEditable, setEditable] = React.useState(false);
70
- const ref = React.useCallback(rootElement => {
69
+ const [isEditable, setEditable] = react.useState(false);
70
+ const ref = react.useCallback(rootElement => {
71
71
  // defaultView is required for a root element.
72
72
  // In multi-window setups, the defaultView may not exist at certain points.
73
73
  if (rootElement && rootElement.ownerDocument && rootElement.ownerDocument.defaultView) {
74
74
  editor.setRootElement(rootElement);
75
75
  }
76
76
  }, [editor]);
77
- useLayoutEffect(() => {
77
+ useLayoutEffectImpl(() => {
78
78
  setEditable(editor.isEditable());
79
79
  return editor.registerEditableListener(currentIsEditable => {
80
80
  setEditable(currentIsEditable);
81
81
  });
82
82
  }, [editor]);
83
- return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
83
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
84
+ ...rest,
84
85
  "aria-activedescendant": !isEditable ? undefined : ariaActiveDescendant,
85
86
  "aria-autocomplete": !isEditable ? 'none' : ariaAutoComplete,
86
87
  "aria-controls": !isEditable ? undefined : ariaControls,
@@ -102,7 +103,7 @@ function ContentEditable({
102
103
  spellCheck: spellCheck,
103
104
  style: style,
104
105
  tabIndex: tabIndex
105
- }));
106
+ });
106
107
  }
107
108
 
108
109
  exports.ContentEditable = ContentEditable;
@@ -3,25 +3,12 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
- import * as React from 'react';
9
- import { useLayoutEffect as useLayoutEffect$1, useEffect, useState, useCallback } from 'react';
10
8
 
11
- function _extends() {
12
- _extends = Object.assign ? Object.assign.bind() : function (target) {
13
- for (var i = 1; i < arguments.length; i++) {
14
- var source = arguments[i];
15
- for (var key in source) {
16
- if (Object.prototype.hasOwnProperty.call(source, key)) {
17
- target[key] = source[key];
18
- }
19
- }
20
- }
21
- return target;
22
- };
23
- return _extends.apply(this, arguments);
24
- }
9
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
10
+ import { useLayoutEffect, useEffect, useState, useCallback } from 'react';
11
+ import { jsx } from 'react/jsx-runtime';
25
12
 
26
13
  /**
27
14
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -40,8 +27,20 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
40
27
  * LICENSE file in the root directory of this source tree.
41
28
  *
42
29
  */
43
- const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect$1 : useEffect;
44
- var useLayoutEffect = useLayoutEffectImpl;
30
+
31
+
32
+ // This workaround is no longer necessary in React 19,
33
+ // but we currently support React >=17.x
34
+ // https://github.com/facebook/react/pull/26395
35
+ const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
36
+
37
+ /**
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ *
43
+ */
45
44
 
46
45
  function ContentEditable({
47
46
  ariaActiveDescendant,
@@ -73,13 +72,14 @@ function ContentEditable({
73
72
  editor.setRootElement(rootElement);
74
73
  }
75
74
  }, [editor]);
76
- useLayoutEffect(() => {
75
+ useLayoutEffectImpl(() => {
77
76
  setEditable(editor.isEditable());
78
77
  return editor.registerEditableListener(currentIsEditable => {
79
78
  setEditable(currentIsEditable);
80
79
  });
81
80
  }, [editor]);
82
- return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
81
+ return /*#__PURE__*/jsx("div", {
82
+ ...rest,
83
83
  "aria-activedescendant": !isEditable ? undefined : ariaActiveDescendant,
84
84
  "aria-autocomplete": !isEditable ? 'none' : ariaAutoComplete,
85
85
  "aria-controls": !isEditable ? undefined : ariaControls,
@@ -101,7 +101,7 @@ function ContentEditable({
101
101
  spellCheck: spellCheck,
102
102
  style: style,
103
103
  tabIndex: tabIndex
104
- }));
104
+ });
105
105
  }
106
106
 
107
107
  export { ContentEditable };
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict'
8
10
  const LexicalContentEditable = process.env.NODE_ENV === 'development' ? require('./LexicalContentEditable.dev.js') : require('./LexicalContentEditable.prod.js');
9
11
  module.exports = LexicalContentEditable;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import * as modDev from './LexicalContentEditable.dev.mjs';
8
10
  import * as modProd from './LexicalContentEditable.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalContentEditable.dev.mjs') : import('./LexicalContentEditable.prod.mjs'));
8
10
  export const ContentEditable = mod.ContentEditable;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- 'use strict';var d=require("@lexical/react/LexicalComposerContext"),k=require("react");function n(){n=Object.assign?Object.assign.bind():function(h){for(var e=1;e<arguments.length;e++){var f=arguments[e],b;for(b in f)Object.prototype.hasOwnProperty.call(f,b)&&(h[b]=f[b])}return h};return n.apply(this,arguments)}var p="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?k.useLayoutEffect:k.useEffect;
8
- exports.ContentEditable=function({ariaActiveDescendant:h,ariaAutoComplete:e,ariaControls:f,ariaDescribedBy:b,ariaExpanded:q,ariaLabel:r,ariaLabelledBy:t,ariaMultiline:u,ariaOwns:v,ariaRequired:w,autoCapitalize:x,className:y,id:z,role:l="textbox",spellCheck:A=!0,style:B,tabIndex:C,"data-testid":D,...E}){let [g]=d.useLexicalComposerContext(),[a,m]=k.useState(!1),F=k.useCallback(c=>{c&&c.ownerDocument&&c.ownerDocument.defaultView&&g.setRootElement(c)},[g]);p(()=>{m(g.isEditable());return g.registerEditableListener(c=>
9
- {m(c)})},[g]);return k.createElement("div",n({},E,{"aria-activedescendant":a?h:void 0,"aria-autocomplete":a?e:"none","aria-controls":a?f:void 0,"aria-describedby":b,"aria-expanded":a?"combobox"===l?!!q:void 0:void 0,"aria-label":r,"aria-labelledby":t,"aria-multiline":u,"aria-owns":a?v:void 0,"aria-readonly":a?void 0:!0,"aria-required":w,autoCapitalize:x,className:y,contentEditable:a,"data-testid":D,id:z,ref:F,role:l,spellCheck:A,style:B,tabIndex:C}))}
8
+
9
+ 'use strict';var d=require("@lexical/react/LexicalComposerContext"),g=require("react"),h=require("react/jsx-runtime");let k="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?g.useLayoutEffect:g.useEffect;
10
+ exports.ContentEditable=function({ariaActiveDescendant:l,ariaAutoComplete:m,ariaControls:n,ariaDescribedBy:p,ariaExpanded:q,ariaLabel:r,ariaLabelledBy:t,ariaMultiline:u,ariaOwns:v,ariaRequired:w,autoCapitalize:x,className:y,id:z,role:e="textbox",spellCheck:A=!0,style:B,tabIndex:C,"data-testid":D,...E}){let [c]=d.useLexicalComposerContext(),[a,f]=g.useState(!1),F=g.useCallback(b=>{b&&b.ownerDocument&&b.ownerDocument.defaultView&&c.setRootElement(b)},[c]);k(()=>{f(c.isEditable());return c.registerEditableListener(b=>
11
+ {f(b)})},[c]);return h.jsx("div",{...E,"aria-activedescendant":a?l:void 0,"aria-autocomplete":a?m:"none","aria-controls":a?n:void 0,"aria-describedby":p,"aria-expanded":a?"combobox"===e?!!q:void 0:void 0,"aria-label":r,"aria-labelledby":t,"aria-multiline":u,"aria-owns":a?v:void 0,"aria-readonly":a?void 0:!0,"aria-required":w,autoCapitalize:x,className:y,contentEditable:a,"data-testid":D,id:z,ref:F,role:e,spellCheck:A,style:B,tabIndex:C})}
@@ -3,5 +3,7 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
7
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import*as a from"react";import{useLayoutEffect as t,useEffect as i,useState as r,useCallback as o}from"react";function n(){return n=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},n.apply(this,arguments)}var d="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t:i;function l({ariaActiveDescendant:t,ariaAutoComplete:i,ariaControls:l,ariaDescribedBy:c,ariaExpanded:s,ariaLabel:u,ariaLabelledBy:b,ariaMultiline:m,ariaOwns:p,ariaRequired:f,autoCapitalize:v,className:w,id:y,role:x="textbox",spellCheck:C=!0,style:E,tabIndex:h,"data-testid":L,...O}){const[g]=e(),[D,j]=r(!1),k=o((e=>{e&&e.ownerDocument&&e.ownerDocument.defaultView&&g.setRootElement(e)}),[g]);return d((()=>(j(g.isEditable()),g.registerEditableListener((e=>{j(e)})))),[g]),a.createElement("div",n({},O,{"aria-activedescendant":D?t:void 0,"aria-autocomplete":D?i:"none","aria-controls":D?l:void 0,"aria-describedby":c,"aria-expanded":D&&"combobox"===x?!!s:void 0,"aria-label":u,"aria-labelledby":b,"aria-multiline":m,"aria-owns":D?p:void 0,"aria-readonly":!D||void 0,"aria-required":f,autoCapitalize:v,className:w,contentEditable:D,"data-testid":L,id:y,ref:k,role:x,spellCheck:C,style:E,tabIndex:h}))}export{l as ContentEditable};
8
+
9
+ import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useLayoutEffect as a,useEffect as i,useState as t,useCallback as o}from"react";import{jsx as r}from"react/jsx-runtime";const d="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?a:i;function n({ariaActiveDescendant:a,ariaAutoComplete:i,ariaControls:n,ariaDescribedBy:l,ariaExpanded:c,ariaLabel:s,ariaLabelledBy:m,ariaMultiline:u,ariaOwns:b,ariaRequired:p,autoCapitalize:x,className:w,id:v,role:f="textbox",spellCheck:y=!0,style:C,tabIndex:E,"data-testid":D,...L}){const[h]=e(),[k,q]=t(!1),z=o((e=>{e&&e.ownerDocument&&e.ownerDocument.defaultView&&h.setRootElement(e)}),[h]);return d((()=>(q(h.isEditable()),h.registerEditableListener((e=>{q(e)})))),[h]),r("div",{...L,"aria-activedescendant":k?a:void 0,"aria-autocomplete":k?i:"none","aria-controls":k?n:void 0,"aria-describedby":l,"aria-expanded":k&&"combobox"===f?!!c:void 0,"aria-label":s,"aria-labelledby":m,"aria-multiline":u,"aria-owns":k?b:void 0,"aria-readonly":!k||void 0,"aria-required":p,autoCapitalize:x,className:w,contentEditable:k,"data-testid":D,id:v,ref:z,role:f,spellCheck:y,style:C,tabIndex:E})}export{n as ContentEditable};