@payloadcms/richtext-lexical 3.68.0-internal-debug.2eb12b9 → 3.68.0-internal-debug.dafc24d

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 (306) hide show
  1. package/dist/cell/rscEntry.js +13 -5
  2. package/dist/cell/rscEntry.js.map +1 -1
  3. package/dist/features/blocks/client/component/BlockContent.js +29 -9
  4. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  5. package/dist/features/blocks/client/component/components/BlockCollapsible.js +7 -3
  6. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  7. package/dist/features/blocks/client/component/components/BlockEditButton.js +6 -2
  8. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  9. package/dist/features/blocks/client/component/components/BlockRemoveButton.js +6 -2
  10. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  11. package/dist/features/blocks/client/component/index.js +124 -43
  12. package/dist/features/blocks/client/component/index.js.map +1 -1
  13. package/dist/features/blocks/client/component/index.scss +188 -0
  14. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +7 -3
  15. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  16. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +6 -2
  17. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  18. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +6 -2
  19. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  20. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +6 -2
  21. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  22. package/dist/features/blocks/client/componentInline/index.js +118 -37
  23. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  24. package/dist/features/blocks/client/componentInline/index.scss +90 -0
  25. package/dist/features/blocks/client/getBlockImageComponent.js +7 -3
  26. package/dist/features/blocks/client/getBlockImageComponent.js.map +1 -1
  27. package/dist/features/blocks/client/markdown/markdownTransformer.js +1 -0
  28. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  29. package/dist/features/blocks/client/nodes/BlocksNode.js +7 -3
  30. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  31. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +7 -3
  32. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  33. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +88 -27
  34. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  35. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +7 -3
  36. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  37. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +13 -4
  38. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
  39. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.scss +6 -0
  40. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +19 -6
  41. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
  42. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.scss +29 -0
  43. package/dist/features/blocks/premade/CodeBlock/Component/index.scss +97 -0
  44. package/dist/features/blocks/server/markdown/markdownTransformer.js +1 -0
  45. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  46. package/dist/features/converters/lexicalToJSX/Component/index.js +9 -5
  47. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  48. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js +7 -3
  49. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  50. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +7 -3
  51. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  52. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js +6 -2
  53. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  54. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js +6 -2
  55. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  56. package/dist/features/converters/lexicalToJSX/converter/converters/link.js +13 -5
  57. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  58. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +38 -14
  59. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  60. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js +18 -6
  61. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  62. package/dist/features/converters/lexicalToJSX/converter/converters/table.js +31 -11
  63. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  64. package/dist/features/converters/lexicalToJSX/converter/converters/text.js +43 -15
  65. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  66. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +31 -11
  67. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  68. package/dist/features/converters/lexicalToJSX/converter/index.js +8 -4
  69. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  70. package/dist/features/debug/jsxConverter/client/plugin/index.js +14 -5
  71. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  72. package/dist/features/debug/jsxConverter/client/plugin/style.scss +12 -0
  73. package/dist/features/debug/testRecorder/client/plugin/index.js +62 -21
  74. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  75. package/dist/features/debug/testRecorder/client/plugin/index.scss +53 -0
  76. package/dist/features/debug/treeView/client/plugin/index.js +8 -3
  77. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  78. package/dist/features/debug/treeView/client/plugin/index.scss +80 -0
  79. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +225 -72
  80. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  81. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.scss +87 -0
  82. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +32 -11
  83. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  84. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.scss +11 -0
  85. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +21 -9
  86. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  87. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +26 -9
  88. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  89. package/dist/features/experimental_table/client/plugins/TablePlugin/index.scss +233 -0
  90. package/dist/features/horizontalRule/client/plugin/index.js +1 -0
  91. package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
  92. package/dist/features/horizontalRule/client/plugin/index.scss +23 -0
  93. package/dist/features/indent/client/IndentPlugin.js +6 -2
  94. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  95. package/dist/features/link/client/plugins/autoLink/index.js +3 -0
  96. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  97. package/dist/features/link/client/plugins/clickableLink/index.js +6 -2
  98. package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
  99. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +76 -24
  100. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  101. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +8 -3
  102. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  103. package/dist/features/link/client/plugins/floatingLinkEditor/index.scss +92 -0
  104. package/dist/features/link/server/baseFields.js +1 -0
  105. package/dist/features/link/server/baseFields.js.map +1 -1
  106. package/dist/features/lists/checklist/client/plugin/index.js +6 -2
  107. package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
  108. package/dist/features/lists/plugin/index.js +6 -2
  109. package/dist/features/lists/plugin/index.js.map +1 -1
  110. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +14 -5
  111. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  112. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +7 -3
  113. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  114. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.scss +16 -0
  115. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +14 -5
  116. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  117. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +7 -3
  118. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  119. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.scss +16 -0
  120. package/dist/features/relationship/client/components/RelationshipComponent.js +56 -19
  121. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  122. package/dist/features/relationship/client/components/index.scss +95 -0
  123. package/dist/features/relationship/client/drawer/index.js +18 -6
  124. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  125. package/dist/features/relationship/client/nodes/RelationshipNode.js +7 -3
  126. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  127. package/dist/features/relationship/client/plugins/index.js +7 -3
  128. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  129. package/dist/features/textState/feature.client.js +18 -6
  130. package/dist/features/textState/feature.client.js.map +1 -1
  131. package/dist/features/toolbars/fixed/client/Toolbar/index.js +72 -23
  132. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  133. package/dist/features/toolbars/fixed/client/Toolbar/index.scss +113 -0
  134. package/dist/features/toolbars/inline/client/Toolbar/index.js +72 -23
  135. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  136. package/dist/features/toolbars/inline/client/Toolbar/index.scss +58 -0
  137. package/dist/features/toolbars/shared/ToolbarButton/index.js +8 -3
  138. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  139. package/dist/features/toolbars/shared/ToolbarButton/index.scss +46 -0
  140. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +60 -20
  141. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  142. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +37 -12
  143. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  144. package/dist/features/toolbars/shared/ToolbarDropdown/index.scss +129 -0
  145. package/dist/features/upload/client/component/index.js +92 -31
  146. package/dist/features/upload/client/component/index.js.map +1 -1
  147. package/dist/features/upload/client/component/index.scss +191 -0
  148. package/dist/features/upload/client/component/pending/index.js +14 -5
  149. package/dist/features/upload/client/component/pending/index.js.map +1 -1
  150. package/dist/features/upload/client/drawer/index.js +18 -6
  151. package/dist/features/upload/client/drawer/index.js.map +1 -1
  152. package/dist/features/upload/client/nodes/UploadNode.js +12 -4
  153. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  154. package/dist/features/upload/client/plugin/index.js +7 -3
  155. package/dist/features/upload/client/plugin/index.js.map +1 -1
  156. package/dist/field/Diff/converters/listitem/index.js +37 -12
  157. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  158. package/dist/field/Diff/converters/listitem/index.scss +47 -0
  159. package/dist/field/Diff/converters/relationship/index.js +37 -12
  160. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  161. package/dist/field/Diff/converters/relationship/index.scss +73 -0
  162. package/dist/field/Diff/converters/unknown/index.js +31 -10
  163. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  164. package/dist/field/Diff/converters/unknown/index.scss +40 -0
  165. package/dist/field/Diff/converters/upload/index.js +60 -19
  166. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  167. package/dist/field/Diff/converters/upload/index.scss +115 -0
  168. package/dist/field/Diff/index.js +8 -3
  169. package/dist/field/Diff/index.js.map +1 -1
  170. package/dist/field/Diff/index.scss +102 -0
  171. package/dist/field/Field.js +81 -27
  172. package/dist/field/Field.js.map +1 -1
  173. package/dist/field/RenderLexical/index.js +36 -12
  174. package/dist/field/RenderLexical/index.js.map +1 -1
  175. package/dist/field/index.js +19 -7
  176. package/dist/field/index.js.map +1 -1
  177. package/dist/field/index.scss +41 -0
  178. package/dist/field/rscEntry.js +7 -3
  179. package/dist/field/rscEntry.js.map +1 -1
  180. package/dist/index.js +2 -0
  181. package/dist/index.js.map +1 -1
  182. package/dist/lexical/EditorPlugin.js +13 -5
  183. package/dist/lexical/EditorPlugin.js.map +1 -1
  184. package/dist/lexical/LexicalEditor.js +163 -50
  185. package/dist/lexical/LexicalEditor.js.map +1 -1
  186. package/dist/lexical/LexicalEditor.scss +54 -0
  187. package/dist/lexical/LexicalProvider.js +49 -17
  188. package/dist/lexical/LexicalProvider.js.map +1 -1
  189. package/dist/lexical/config/client/EditorConfigProvider.js +7 -3
  190. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  191. package/dist/lexical/plugins/DecoratorPlugin/index.js +1 -0
  192. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  193. package/dist/lexical/plugins/DecoratorPlugin/index.scss +13 -0
  194. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +20 -7
  195. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  196. package/dist/lexical/plugins/InsertParagraphAtEnd/index.scss +54 -0
  197. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -0
  198. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  199. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +7 -3
  200. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  201. package/dist/lexical/plugins/SlashMenu/index.js +50 -16
  202. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  203. package/dist/lexical/plugins/SlashMenu/index.scss +68 -0
  204. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +20 -7
  205. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  206. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.scss +35 -0
  207. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +32 -11
  208. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  209. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.scss +80 -0
  210. package/dist/lexical/theme/EditorTheme.scss +357 -0
  211. package/dist/lexical/ui/ContentEditable.js +14 -5
  212. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  213. package/dist/lexical/ui/ContentEditable.scss +105 -0
  214. package/dist/lexical/ui/icons/AI/index.js +37 -13
  215. package/dist/lexical/ui/icons/AI/index.js.map +1 -1
  216. package/dist/lexical/ui/icons/Add/index.js +19 -7
  217. package/dist/lexical/ui/icons/Add/index.js.map +1 -1
  218. package/dist/lexical/ui/icons/AlignCenter/index.js +25 -9
  219. package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  220. package/dist/lexical/ui/icons/AlignJustify/index.js +25 -9
  221. package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  222. package/dist/lexical/ui/icons/AlignLeft/index.js +25 -9
  223. package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  224. package/dist/lexical/ui/icons/AlignRight/index.js +25 -9
  225. package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
  226. package/dist/lexical/ui/icons/Block/index.js +25 -9
  227. package/dist/lexical/ui/icons/Block/index.js.map +1 -1
  228. package/dist/lexical/ui/icons/Blockquote/index.js +13 -5
  229. package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
  230. package/dist/lexical/ui/icons/Bold/index.js +13 -5
  231. package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
  232. package/dist/lexical/ui/icons/Checklist/index.js +19 -7
  233. package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
  234. package/dist/lexical/ui/icons/Code/index.js +19 -7
  235. package/dist/lexical/ui/icons/Code/index.js.map +1 -1
  236. package/dist/lexical/ui/icons/CodeBlock/index.js +13 -5
  237. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  238. package/dist/lexical/ui/icons/Collapse/index.js +13 -5
  239. package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
  240. package/dist/lexical/ui/icons/H1/index.js +13 -5
  241. package/dist/lexical/ui/icons/H1/index.js.map +1 -1
  242. package/dist/lexical/ui/icons/H2/index.js +13 -5
  243. package/dist/lexical/ui/icons/H2/index.js.map +1 -1
  244. package/dist/lexical/ui/icons/H3/index.js +13 -5
  245. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  246. package/dist/lexical/ui/icons/H4/index.js +13 -5
  247. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  248. package/dist/lexical/ui/icons/H5/index.js +13 -5
  249. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  250. package/dist/lexical/ui/icons/H6/index.js +13 -5
  251. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  252. package/dist/lexical/ui/icons/HorizontalRule/index.js +13 -5
  253. package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  254. package/dist/lexical/ui/icons/IndentDecrease/index.js +31 -11
  255. package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  256. package/dist/lexical/ui/icons/IndentIncrease/index.js +31 -11
  257. package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  258. package/dist/lexical/ui/icons/InlineBlocks/index.js +13 -5
  259. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
  260. package/dist/lexical/ui/icons/Italic/index.js +13 -5
  261. package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
  262. package/dist/lexical/ui/icons/Link/index.js +13 -5
  263. package/dist/lexical/ui/icons/Link/index.js.map +1 -1
  264. package/dist/lexical/ui/icons/Meatballs/index.js +25 -9
  265. package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
  266. package/dist/lexical/ui/icons/OrderedList/index.js +37 -13
  267. package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
  268. package/dist/lexical/ui/icons/Relationship/index.js +37 -13
  269. package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
  270. package/dist/lexical/ui/icons/Strikethrough/index.js +19 -7
  271. package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  272. package/dist/lexical/ui/icons/Subscript/index.js +13 -5
  273. package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
  274. package/dist/lexical/ui/icons/Superscript/index.js +13 -5
  275. package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
  276. package/dist/lexical/ui/icons/Table/index.js +13 -5
  277. package/dist/lexical/ui/icons/Table/index.js.map +1 -1
  278. package/dist/lexical/ui/icons/Text/index.js +13 -5
  279. package/dist/lexical/ui/icons/Text/index.js.map +1 -1
  280. package/dist/lexical/ui/icons/TextState/index.js +7 -3
  281. package/dist/lexical/ui/icons/TextState/index.js.map +1 -1
  282. package/dist/lexical/ui/icons/Underline/index.js +19 -7
  283. package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
  284. package/dist/lexical/ui/icons/UnorderedList/index.js +43 -15
  285. package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  286. package/dist/lexical/ui/icons/Upload/index.js +25 -9
  287. package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
  288. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +2 -0
  289. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +1 -1
  290. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +2 -0
  291. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +1 -1
  292. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +2 -0
  293. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +1 -1
  294. package/dist/utilities/fieldsDrawer/Drawer.js +19 -7
  295. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  296. package/dist/utilities/fieldsDrawer/DrawerContent.js +19 -7
  297. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  298. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +7 -3
  299. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  300. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +7 -3
  301. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  302. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +2 -0
  303. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
  304. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +2 -0
  305. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  306. package/package.json +8 -7
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
3
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
4
4
  import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js';
5
5
  import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js';
@@ -10,6 +10,7 @@ import { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical';
10
10
  import * as React from 'react';
11
11
  import { useEffect, useState } from 'react';
12
12
  import { useEditorConfigContext } from './config/client/EditorConfigProvider.js';
13
+ import './LexicalEditor.scss';
13
14
  import { EditorPlugin } from './EditorPlugin.js';
14
15
  import { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js';
15
16
  import { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js';
@@ -64,50 +65,98 @@ export const LexicalEditor = (props)=>{
64
65
  editor,
65
66
  editorConfigContext
66
67
  ]);
67
- return /*#__PURE__*/ _jsxs(React.Fragment, {
68
+ return /*#__PURE__*/ _jsxDEV(React.Fragment, {
68
69
  children: [
69
70
  editorConfig.features.plugins?.map((plugin)=>{
70
71
  if (plugin.position === 'aboveContainer') {
71
- return /*#__PURE__*/ _jsx(EditorPlugin, {
72
+ return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
72
73
  clientProps: plugin.clientProps,
73
74
  plugin: plugin
74
- }, plugin.key);
75
+ }, plugin.key, false, {
76
+ fileName: "src/lexical/LexicalEditor.tsx",
77
+ lineNumber: 93,
78
+ columnNumber: 18
79
+ }, this);
75
80
  }
76
81
  }),
77
- /*#__PURE__*/ _jsxs("div", {
82
+ /*#__PURE__*/ _jsxDEV("div", {
78
83
  className: "editor-container",
79
84
  ref: editorContainerRef,
80
85
  children: [
81
86
  editorConfig.features.plugins?.map((plugin)=>{
82
87
  if (plugin.position === 'top') {
83
- return /*#__PURE__*/ _jsx(EditorPlugin, {
88
+ return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
84
89
  clientProps: plugin.clientProps,
85
90
  plugin: plugin
86
- }, plugin.key);
91
+ }, plugin.key, false, {
92
+ fileName: "src/lexical/LexicalEditor.tsx",
93
+ lineNumber: 100,
94
+ columnNumber: 15
95
+ }, this);
87
96
  }
88
97
  }),
89
- /*#__PURE__*/ _jsx(RichTextPlugin, {
90
- contentEditable: /*#__PURE__*/ _jsx("div", {
98
+ /*#__PURE__*/ _jsxDEV(RichTextPlugin, {
99
+ contentEditable: /*#__PURE__*/ _jsxDEV("div", {
91
100
  className: "editor-scroller",
92
- children: /*#__PURE__*/ _jsx("div", {
101
+ children: /*#__PURE__*/ _jsxDEV("div", {
93
102
  className: "editor",
94
103
  ref: onRef,
95
- children: /*#__PURE__*/ _jsx(LexicalContentEditable, {
104
+ children: /*#__PURE__*/ _jsxDEV(LexicalContentEditable, {
96
105
  editorConfig: editorConfig
97
- })
98
- })
99
- }),
106
+ }, void 0, false, {
107
+ fileName: "src/lexical/LexicalEditor.tsx",
108
+ lineNumber: 108,
109
+ columnNumber: 17
110
+ }, void 0)
111
+ }, void 0, false, {
112
+ fileName: "src/lexical/LexicalEditor.tsx",
113
+ lineNumber: 107,
114
+ columnNumber: 15
115
+ }, void 0)
116
+ }, void 0, false, {
117
+ fileName: "src/lexical/LexicalEditor.tsx",
118
+ lineNumber: 106,
119
+ columnNumber: 13
120
+ }, void 0),
100
121
  ErrorBoundary: LexicalErrorBoundary
101
- }),
102
- /*#__PURE__*/ _jsx(NormalizeSelectionPlugin, {}),
103
- isEditable && /*#__PURE__*/ _jsx(InsertParagraphAtEndPlugin, {}),
104
- /*#__PURE__*/ _jsx(DecoratorPlugin, {}),
105
- /*#__PURE__*/ _jsx(ClipboardPlugin, {}),
106
- /*#__PURE__*/ _jsx(TextPlugin, {
122
+ }, void 0, false, {
123
+ fileName: "src/lexical/LexicalEditor.tsx",
124
+ lineNumber: 104,
125
+ columnNumber: 9
126
+ }, this),
127
+ /*#__PURE__*/ _jsxDEV(NormalizeSelectionPlugin, {}, void 0, false, {
128
+ fileName: "src/lexical/LexicalEditor.tsx",
129
+ lineNumber: 114,
130
+ columnNumber: 9
131
+ }, this),
132
+ isEditable && /*#__PURE__*/ _jsxDEV(InsertParagraphAtEndPlugin, {}, void 0, false, {
133
+ fileName: "src/lexical/LexicalEditor.tsx",
134
+ lineNumber: 115,
135
+ columnNumber: 24
136
+ }, this),
137
+ /*#__PURE__*/ _jsxDEV(DecoratorPlugin, {}, void 0, false, {
138
+ fileName: "src/lexical/LexicalEditor.tsx",
139
+ lineNumber: 116,
140
+ columnNumber: 9
141
+ }, this),
142
+ /*#__PURE__*/ _jsxDEV(ClipboardPlugin, {}, void 0, false, {
143
+ fileName: "src/lexical/LexicalEditor.tsx",
144
+ lineNumber: 117,
145
+ columnNumber: 9
146
+ }, this),
147
+ /*#__PURE__*/ _jsxDEV(TextPlugin, {
107
148
  features: editorConfig.features
108
- }),
109
- /*#__PURE__*/ _jsx(SelectAllPlugin, {}),
110
- isEditable && /*#__PURE__*/ _jsx(OnChangePlugin, {
149
+ }, void 0, false, {
150
+ fileName: "src/lexical/LexicalEditor.tsx",
151
+ lineNumber: 118,
152
+ columnNumber: 9
153
+ }, this),
154
+ /*#__PURE__*/ _jsxDEV(SelectAllPlugin, {}, void 0, false, {
155
+ fileName: "src/lexical/LexicalEditor.tsx",
156
+ lineNumber: 119,
157
+ columnNumber: 9
158
+ }, this),
159
+ isEditable && /*#__PURE__*/ _jsxDEV(OnChangePlugin, {
111
160
  // Selection changes can be ignored here, reducing the
112
161
  // frequency that the FieldComponent and Payload receive updates.
113
162
  // Selection changes are only needed if you are saving selection state
@@ -120,69 +169,133 @@ export const LexicalEditor = (props)=>{
120
169
  }
121
170
  }
122
171
  }
123
- }),
124
- floatingAnchorElem && /*#__PURE__*/ _jsxs(React.Fragment, {
172
+ }, void 0, false, {
173
+ fileName: "src/lexical/LexicalEditor.tsx",
174
+ lineNumber: 121,
175
+ columnNumber: 11
176
+ }, this),
177
+ floatingAnchorElem && /*#__PURE__*/ _jsxDEV(React.Fragment, {
125
178
  children: [
126
- !isSmallWidthViewport && isEditable && /*#__PURE__*/ _jsxs(React.Fragment, {
179
+ !isSmallWidthViewport && isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
127
180
  children: [
128
- editorConfig.admin?.hideDraggableBlockElement ? null : /*#__PURE__*/ _jsx(DraggableBlockPlugin, {
181
+ editorConfig.admin?.hideDraggableBlockElement ? null : /*#__PURE__*/ _jsxDEV(DraggableBlockPlugin, {
129
182
  anchorElem: floatingAnchorElem
130
- }),
131
- editorConfig.admin?.hideAddBlockButton ? null : /*#__PURE__*/ _jsx(AddBlockHandlePlugin, {
183
+ }, void 0, false, {
184
+ fileName: "src/lexical/LexicalEditor.tsx",
185
+ lineNumber: 141,
186
+ columnNumber: 19
187
+ }, this),
188
+ editorConfig.admin?.hideAddBlockButton ? null : /*#__PURE__*/ _jsxDEV(AddBlockHandlePlugin, {
132
189
  anchorElem: floatingAnchorElem
133
- })
190
+ }, void 0, false, {
191
+ fileName: "src/lexical/LexicalEditor.tsx",
192
+ lineNumber: 144,
193
+ columnNumber: 19
194
+ }, this)
134
195
  ]
135
- }),
196
+ }, void 0, true, {
197
+ fileName: "src/lexical/LexicalEditor.tsx",
198
+ lineNumber: 139,
199
+ columnNumber: 15
200
+ }, this),
136
201
  editorConfig.features.plugins?.map((plugin)=>{
137
202
  if (plugin.position === 'floatingAnchorElem' && !(plugin.desktopOnly === true && isSmallWidthViewport)) {
138
- return /*#__PURE__*/ _jsx(EditorPlugin, {
203
+ return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
139
204
  anchorElem: floatingAnchorElem,
140
205
  clientProps: plugin.clientProps,
141
206
  plugin: plugin
142
- }, plugin.key);
207
+ }, plugin.key, false, {
208
+ fileName: "src/lexical/LexicalEditor.tsx",
209
+ lineNumber: 154,
210
+ columnNumber: 19
211
+ }, this);
143
212
  }
144
213
  }),
145
- isEditable && /*#__PURE__*/ _jsx(React.Fragment, {
146
- children: /*#__PURE__*/ _jsx(SlashMenuPlugin, {
214
+ isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
215
+ children: /*#__PURE__*/ _jsxDEV(SlashMenuPlugin, {
147
216
  anchorElem: floatingAnchorElem
148
- })
149
- })
217
+ }, void 0, false, {
218
+ fileName: "src/lexical/LexicalEditor.tsx",
219
+ lineNumber: 165,
220
+ columnNumber: 17
221
+ }, this)
222
+ }, void 0, false, {
223
+ fileName: "src/lexical/LexicalEditor.tsx",
224
+ lineNumber: 164,
225
+ columnNumber: 15
226
+ }, this)
150
227
  ]
151
- }),
152
- isEditable && /*#__PURE__*/ _jsxs(React.Fragment, {
228
+ }, void 0, true, {
229
+ fileName: "src/lexical/LexicalEditor.tsx",
230
+ lineNumber: 137,
231
+ columnNumber: 11
232
+ }, this),
233
+ isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
153
234
  children: [
154
- /*#__PURE__*/ _jsx(HistoryPlugin, {}),
155
- editorConfig?.features?.markdownTransformers?.length > 0 && /*#__PURE__*/ _jsx(MarkdownShortcutPlugin, {})
235
+ /*#__PURE__*/ _jsxDEV(HistoryPlugin, {}, void 0, false, {
236
+ fileName: "src/lexical/LexicalEditor.tsx",
237
+ lineNumber: 172,
238
+ columnNumber: 13
239
+ }, this),
240
+ editorConfig?.features?.markdownTransformers?.length > 0 && /*#__PURE__*/ _jsxDEV(MarkdownShortcutPlugin, {}, void 0, false, {
241
+ fileName: "src/lexical/LexicalEditor.tsx",
242
+ lineNumber: 173,
243
+ columnNumber: 74
244
+ }, this)
156
245
  ]
157
- }),
246
+ }, void 0, true, {
247
+ fileName: "src/lexical/LexicalEditor.tsx",
248
+ lineNumber: 171,
249
+ columnNumber: 11
250
+ }, this),
158
251
  editorConfig.features.plugins?.map((plugin)=>{
159
252
  if (plugin.position === 'normal') {
160
- return /*#__PURE__*/ _jsx(EditorPlugin, {
253
+ return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
161
254
  clientProps: plugin.clientProps,
162
255
  plugin: plugin
163
- }, plugin.key);
256
+ }, plugin.key, false, {
257
+ fileName: "src/lexical/LexicalEditor.tsx",
258
+ lineNumber: 179,
259
+ columnNumber: 15
260
+ }, this);
164
261
  }
165
262
  }),
166
263
  editorConfig.features.plugins?.map((plugin)=>{
167
264
  if (plugin.position === 'bottom') {
168
- return /*#__PURE__*/ _jsx(EditorPlugin, {
265
+ return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
169
266
  clientProps: plugin.clientProps,
170
267
  plugin: plugin
171
- }, plugin.key);
268
+ }, plugin.key, false, {
269
+ fileName: "src/lexical/LexicalEditor.tsx",
270
+ lineNumber: 186,
271
+ columnNumber: 15
272
+ }, this);
172
273
  }
173
274
  })
174
275
  ]
175
- }),
276
+ }, void 0, true, {
277
+ fileName: "src/lexical/LexicalEditor.tsx",
278
+ lineNumber: 96,
279
+ columnNumber: 7
280
+ }, this),
176
281
  editorConfig.features.plugins?.map((plugin)=>{
177
282
  if (plugin.position === 'belowContainer') {
178
- return /*#__PURE__*/ _jsx(EditorPlugin, {
283
+ return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
179
284
  clientProps: plugin.clientProps,
180
285
  plugin: plugin
181
- }, plugin.key);
286
+ }, plugin.key, false, {
287
+ fileName: "src/lexical/LexicalEditor.tsx",
288
+ lineNumber: 193,
289
+ columnNumber: 18
290
+ }, this);
182
291
  }
183
292
  })
184
293
  ]
185
- });
294
+ }, void 0, true, {
295
+ fileName: "src/lexical/LexicalEditor.tsx",
296
+ lineNumber: 90,
297
+ columnNumber: 5
298
+ }, this);
186
299
  };
187
300
 
188
301
  //# sourceMappingURL=LexicalEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.scss'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","useLexicalEditable","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","editorConfigContext","editor","isEditable","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","Fragment","features","plugins","map","plugin","position","clientProps","key","div","className","ref","contentEditable","ErrorBoundary","ignoreSelectionChange","editorState","tags","has","size","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","desktopOnly","markdownTransformers","length"],"mappings":"AAAA;;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,QAAQ,yCAAwC;AAC7E,SAASC,aAAa,QAAQ,yCAAwC;AACtE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ,UAAS;AAC3E,YAAYC,WAAW,QAAO;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI3C,SAASC,sBAAsB,QAAQ,0CAAyC;AAEhF,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,oBAAoB,QAAQ,kDAAiD;AACtF,SAASC,oBAAoB,QAAQ,kDAAiD;AACtF,SAASC,0BAA0B,QAAQ,0CAAyC;AACpF,SAASC,sBAAsB,QAAQ,sCAAqC;AAC5E,SAASC,wBAAwB,QAAQ,wCAAuC;AAChF,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,+BAA8B;AAC9D,SAASC,UAAU,QAAQ,gCAA+B;AAC1D,SAASC,sBAAsB,QAAQ,0BAAyB;AAEhE,OAAO,MAAMC,gBAKT,CAACC;IACH,MAAM,EAAEC,YAAY,EAAEC,kBAAkB,EAAEC,oBAAoB,EAAEC,QAAQ,EAAE,GAAGJ;IAC7E,MAAMK,sBAAsBnB;IAC5B,MAAM,CAACoB,OAAO,GAAGhC;IACjB,MAAMiC,aAAa5B;IAEnB,MAAM,CAAC6B,oBAAoBC,sBAAsB,GAAGxB,SAAgC;IACpF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AAEC,IAAI,CAACC;wBACnC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,KAAC3C;gCAAa4C,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;wBAElE;oBACF;oBACC/B,aAAayB,QAAQ,CAACC,OAAO,EAAEC,IAAI,CAACC;wBACnC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,KAAC3C;gCAAa4C,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;wBAElE;oBACF;;;YAED/B,aAAayB,QAAQ,CAACC,OAAO,EAAEC,IAAI,CAACC;gBACnC,IAAIA,OAAOC,QAAQ,KAAK,kBAAkB;oBACxC,qBAAO,KAAC3C;wBAAa4C,aAAaF,OAAOE,WAAW;wBAAmBF,QAAQA;uBAApBA,OAAOG,GAAG;gBACvE;YACF;;;AAGN,EAAC"}
1
+ {"version":3,"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.scss'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","useLexicalEditable","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","editorConfigContext","editor","isEditable","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","Fragment","features","plugins","map","plugin","position","clientProps","key","div","className","ref","contentEditable","ErrorBoundary","ignoreSelectionChange","editorState","tags","has","size","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","desktopOnly","markdownTransformers","length"],"mappings":"AAAA;;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,QAAQ,yCAAwC;AAC7E,SAASC,aAAa,QAAQ,yCAAwC;AACtE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ,UAAS;AAC3E,YAAYC,WAAW,QAAO;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI3C,SAASC,sBAAsB,QAAQ,0CAAyC;AAChF,OAAO,uBAAsB;AAC7B,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,oBAAoB,QAAQ,kDAAiD;AACtF,SAASC,oBAAoB,QAAQ,kDAAiD;AACtF,SAASC,0BAA0B,QAAQ,0CAAyC;AACpF,SAASC,sBAAsB,QAAQ,sCAAqC;AAC5E,SAASC,wBAAwB,QAAQ,wCAAuC;AAChF,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,+BAA8B;AAC9D,SAASC,UAAU,QAAQ,gCAA+B;AAC1D,SAASC,sBAAsB,QAAQ,0BAAyB;AAEhE,OAAO,MAAMC,gBAKT,CAACC;IACH,MAAM,EAAEC,YAAY,EAAEC,kBAAkB,EAAEC,oBAAoB,EAAEC,QAAQ,EAAE,GAAGJ;IAC7E,MAAMK,sBAAsBnB;IAC5B,MAAM,CAACoB,OAAO,GAAGhC;IACjB,MAAMiC,aAAa5B;IAEnB,MAAM,CAAC6B,oBAAoBC,sBAAsB,GAAGxB,SAAgC;IACpF,MAAMyB,QAAQ,CAACC;QACb,IAAIA,wBAAwB,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S,mBAAK,QAACxD;;;;;;;;;;;oBAGjEQ,aAAayB,QAAQ,CAACC,OAAO,EAAEC,IAAI,CAACC;wBACnC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,QAAC3C;gCAAa4C,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;;;;;wBAElE;oBACF;oBACC/B,aAAayB,QAAQ,CAACC,OAAO,EAAEC,IAAI,CAACC;wBACnC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,QAAC3C;gCAAa4C,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;;;;;wBAElE;oBACF;;;;;;;YAED/B,aAAayB,QAAQ,CAACC,OAAO,EAAEC,IAAI,CAACC;gBACnC,IAAIA,OAAOC,QAAQ,KAAK,kBAAkB;oBACxC,qBAAO,QAAC3C;wBAAa4C,aAAaF,OAAOE,WAAW;wBAAmBF,QAAQA;uBAApBA,OAAOG,GAAG;;;;;gBACvE;YACF;;;;;;;AAGN,EAAC"}
@@ -0,0 +1,54 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .rich-text-lexical {
5
+ .editor {
6
+ position: relative;
7
+ }
8
+
9
+ .editor-container {
10
+ position: relative;
11
+
12
+ font-family: var(--font-serif);
13
+ font-size: base(0.8);
14
+ letter-spacing: 0.02em;
15
+ }
16
+
17
+ &--show-gutter {
18
+ > .rich-text-lexical__wrap
19
+ > .editor-container
20
+ > .editor-scroller
21
+ > .editor
22
+ > div
23
+ > .LexicalEditorTheme__placeholder {
24
+ left: 3rem;
25
+ }
26
+ }
27
+
28
+ &:not(&--show-gutter)
29
+ > .rich-text-lexical__wrap
30
+ > .editor-container
31
+ > .editor-scroller
32
+ > .editor
33
+ > div
34
+ > .LexicalEditorTheme__placeholder {
35
+ left: 0;
36
+ }
37
+
38
+ .LexicalEditorTheme__placeholder {
39
+ position: absolute;
40
+ top: 8px;
41
+ font-size: base(0.8);
42
+ line-height: 1.5;
43
+ color: var(--theme-elevation-500);
44
+ /* Prevent text selection */
45
+ user-select: none;
46
+ -webkit-user-select: none;
47
+ -moz-user-select: none;
48
+ -ms-user-select: none;
49
+
50
+ /* Make it behave more like a background element (no interaction) */
51
+ pointer-events: none;
52
+ }
53
+ }
54
+ }
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
3
  import { LexicalComposer } from '@lexical/react/LexicalComposer.js';
4
4
  import { useEditDepth } from '@payloadcms/ui';
5
5
  import * as React from 'react';
@@ -14,16 +14,28 @@ const NestProviders = ({ children, providers })=>// eslint-disable-next-line @ty
14
14
  }
15
15
  const Component = providers[0];
16
16
  if (providers.length > 1) {
17
- return /*#__PURE__*/ _jsx(Component, {
18
- children: /*#__PURE__*/ _jsx(NestProviders, {
17
+ return /*#__PURE__*/ _jsxDEV(Component, {
18
+ children: /*#__PURE__*/ _jsxDEV(NestProviders, {
19
19
  providers: providers.slice(1),
20
20
  children: children
21
- })
22
- });
21
+ }, void 0, false, {
22
+ fileName: "src/lexical/LexicalProvider.tsx",
23
+ lineNumber: 45,
24
+ columnNumber: 9
25
+ }, this)
26
+ }, void 0, false, {
27
+ fileName: "src/lexical/LexicalProvider.tsx",
28
+ lineNumber: 44,
29
+ columnNumber: 7
30
+ }, this);
23
31
  }
24
- return /*#__PURE__*/ _jsx(Component, {
32
+ return /*#__PURE__*/ _jsxDEV(Component, {
25
33
  children: children
26
- });
34
+ }, void 0, false, {
35
+ fileName: "src/lexical/LexicalProvider.tsx",
36
+ lineNumber: 49,
37
+ columnNumber: 10
38
+ }, this);
27
39
  };
28
40
  export const LexicalProvider = (props)=>{
29
41
  const { composerKey, editorConfig, fieldProps, isSmallWidthViewport, onChange, readOnly, value } = props;
@@ -59,32 +71,52 @@ export const LexicalProvider = (props)=>{
59
71
  editorConfig
60
72
  ]);
61
73
  if (!initialConfig) {
62
- return /*#__PURE__*/ _jsx("p", {
74
+ return /*#__PURE__*/ _jsxDEV("p", {
63
75
  children: "Loading..."
64
- });
76
+ }, void 0, false, {
77
+ fileName: "src/lexical/LexicalProvider.tsx",
78
+ lineNumber: 98,
79
+ columnNumber: 12
80
+ }, this);
65
81
  }
66
82
  // We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.
67
83
  // Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.
68
- return /*#__PURE__*/ _jsx(LexicalComposer, {
84
+ return /*#__PURE__*/ _jsxDEV(LexicalComposer, {
69
85
  initialConfig: initialConfig,
70
- children: /*#__PURE__*/ _jsx(EditorConfigProvider, {
86
+ children: /*#__PURE__*/ _jsxDEV(EditorConfigProvider, {
71
87
  editorConfig: editorConfig,
72
88
  editorContainerRef: editorContainerRef,
73
89
  fieldProps: fieldProps,
74
90
  /**
75
91
  * Parent editor is not truly the parent editor, if the current editor is part of a drawer and the parent editor is the main editor.
76
92
  */ parentContext: parentContext?.editDepth === editDepth ? parentContext : undefined,
77
- children: /*#__PURE__*/ _jsx(NestProviders, {
93
+ children: /*#__PURE__*/ _jsxDEV(NestProviders, {
78
94
  providers: editorConfig.features.providers,
79
- children: /*#__PURE__*/ _jsx(LexicalEditorComponent, {
95
+ children: /*#__PURE__*/ _jsxDEV(LexicalEditorComponent, {
80
96
  editorConfig: editorConfig,
81
97
  editorContainerRef: editorContainerRef,
82
98
  isSmallWidthViewport: isSmallWidthViewport,
83
99
  onChange: onChange
84
- })
85
- })
86
- })
87
- }, composerKey + initialConfig.editable);
100
+ }, void 0, false, {
101
+ fileName: "src/lexical/LexicalProvider.tsx",
102
+ lineNumber: 115,
103
+ columnNumber: 11
104
+ }, this)
105
+ }, void 0, false, {
106
+ fileName: "src/lexical/LexicalProvider.tsx",
107
+ lineNumber: 114,
108
+ columnNumber: 9
109
+ }, this)
110
+ }, void 0, false, {
111
+ fileName: "src/lexical/LexicalProvider.tsx",
112
+ lineNumber: 105,
113
+ columnNumber: 7
114
+ }, this)
115
+ }, composerKey + initialConfig.editable, false, {
116
+ fileName: "src/lexical/LexicalProvider.tsx",
117
+ lineNumber: 104,
118
+ columnNumber: 5
119
+ }, this);
88
120
  };
89
121
 
90
122
  //# sourceMappingURL=LexicalProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lexical/LexicalProvider.tsx"],"sourcesContent":["'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n composerKey: string\n editorConfig: SanitizedClientEditorConfig\n fieldProps: LexicalRichTextFieldProps\n isSmallWidthViewport: boolean\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n readOnly: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({\n children,\n providers,\n}: {\n children: React.ReactNode\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n providers: any[]\n}) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const { composerKey, editorConfig, fieldProps, isSmallWidthViewport, onChange, readOnly, value } =\n props\n\n const parentContext = useEditorConfigContext()\n\n const editDepth = useEditDepth()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n // useMemo for the initialConfig that depends on readOnly and value\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (value && typeof value !== 'object') {\n throw new Error(\n 'The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: ' +\n JSON.stringify(value),\n )\n }\n\n if (value && Array.isArray(value) && !('root' in value)) {\n throw new Error(\n 'You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended',\n )\n }\n\n if (value && 'jsonContent' in value) {\n throw new Error(\n 'You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical',\n )\n }\n\n return {\n editable: readOnly !== true,\n editorState: value != null ? JSON.stringify(value) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: getEnabledNodes({ editorConfig }),\n onError: (error: Error) => {\n throw error\n },\n theme: editorConfig.lexical.theme,\n }\n // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will\n // cause the editor to lose focus.\n }, [editorConfig])\n\n if (!initialConfig) {\n return <p>Loading...</p>\n }\n\n // We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.\n // Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.\n return (\n <LexicalComposer initialConfig={initialConfig} key={composerKey + initialConfig.editable}>\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n fieldProps={fieldProps}\n /**\n * Parent editor is not truly the parent editor, if the current editor is part of a drawer and the parent editor is the main editor.\n */\n parentContext={parentContext?.editDepth === editDepth ? parentContext : undefined}\n >\n <NestProviders providers={editorConfig.features.providers}>\n <LexicalEditorComponent\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n isSmallWidthViewport={isSmallWidthViewport}\n onChange={onChange}\n />\n </NestProviders>\n </EditorConfigProvider>\n </LexicalComposer>\n )\n}\n"],"names":["LexicalComposer","useEditDepth","React","useMemo","EditorConfigProvider","useEditorConfigContext","LexicalEditor","LexicalEditorComponent","getEnabledNodes","NestProviders","children","providers","length","Component","slice","LexicalProvider","props","composerKey","editorConfig","fieldProps","isSmallWidthViewport","onChange","readOnly","value","parentContext","editDepth","editorContainerRef","useRef","initialConfig","Error","JSON","stringify","Array","isArray","editable","editorState","undefined","namespace","lexical","nodes","onError","error","theme","p","features"],"mappings":"AAAA;;AAIA,SAASA,eAAe,QAAQ,oCAAmC;AACnE,SAASC,YAAY,QAAQ,iBAAgB;AAC7C,YAAYC,WAAW,QAAO;AAC9B,SAASC,OAAO,QAAQ,QAAO;AAK/B,SACEC,oBAAoB,EACpBC,sBAAsB,QACjB,0CAAyC;AAChD,SAASC,iBAAiBC,sBAAsB,QAAQ,qBAAoB;AAC5E,SAASC,eAAe,QAAQ,mBAAkB;AAYlD,MAAMC,gBAAgB,CAAC,EACrBC,QAAQ,EACRC,SAAS,EAKV,GAFC,8DAA8D;;IAG9D,IAAI,CAACA,WAAWC,QAAQ;QACtB,OAAOF;IACT;IACA,MAAMG,YAAYF,SAAS,CAAC,EAAE;IAC9B,IAAIA,UAAUC,MAAM,GAAG,GAAG;QACxB,qBACE,KAACC;sBACC,cAAA,KAACJ;gBAAcE,WAAWA,UAAUG,KAAK,CAAC;0BAAKJ;;;IAGrD;IACA,qBAAO,KAACG;kBAAWH;;AACrB;AAEA,OAAO,MAAMK,kBAAkD,CAACC;IAC9D,MAAM,EAAEC,WAAW,EAAEC,YAAY,EAAEC,UAAU,EAAEC,oBAAoB,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAC9FP;IAEF,MAAMQ,gBAAgBnB;IAEtB,MAAMoB,YAAYxB;IAElB,MAAMyB,qBAAqBxB,MAAMyB,MAAM,CAAiB;IAExD,mEAAmE;IACnE,MAAMC,gBAAgBzB,QAA2B;QAC/C,IAAIoB,SAAS,OAAOA,UAAU,UAAU;YACtC,MAAM,IAAIM,MACR,kLACEC,KAAKC,SAAS,CAACR;QAErB;QAEA,IAAIA,SAASS,MAAMC,OAAO,CAACV,UAAU,CAAE,CAAA,UAAUA,KAAI,GAAI;YACvD,MAAM,IAAIM,MACR;QAEJ;QAEA,IAAIN,SAAS,iBAAiBA,OAAO;YACnC,MAAM,IAAIM,MACR;QAEJ;QAEA,OAAO;YACLK,UAAUZ,aAAa;YACvBa,aAAaZ,SAAS,OAAOO,KAAKC,SAAS,CAACR,SAASa;YACrDC,WAAWnB,aAAaoB,OAAO,CAACD,SAAS;YACzCE,OAAO/B,gBAAgB;gBAAEU;YAAa;YACtCsB,SAAS,CAACC;gBACR,MAAMA;YACR;YACAC,OAAOxB,aAAaoB,OAAO,CAACI,KAAK;QACnC;IAGF,GAFE,kKAAkK;IAClK,kCAAkC;IACjC;QAACxB;KAAa;IAEjB,IAAI,CAACU,eAAe;QAClB,qBAAO,KAACe;sBAAE;;IACZ;IAEA,wGAAwG;IACxG,gMAAgM;IAChM,qBACE,KAAC3C;QAAgB4B,eAAeA;kBAC9B,cAAA,KAACxB;YACCc,cAAcA;YACdQ,oBAAoBA;YACpBP,YAAYA;YACZ;;SAEC,GACDK,eAAeA,eAAeC,cAAcA,YAAYD,gBAAgBY;sBAExE,cAAA,KAAC3B;gBAAcE,WAAWO,aAAa0B,QAAQ,CAACjC,SAAS;0BACvD,cAAA,KAACJ;oBACCW,cAAcA;oBACdQ,oBAAoBA;oBACpBN,sBAAsBA;oBACtBC,UAAUA;;;;OAfkCJ,cAAcW,cAAcM,QAAQ;AAqB5F,EAAC"}
1
+ {"version":3,"sources":["../../src/lexical/LexicalProvider.tsx"],"sourcesContent":["'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n composerKey: string\n editorConfig: SanitizedClientEditorConfig\n fieldProps: LexicalRichTextFieldProps\n isSmallWidthViewport: boolean\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n readOnly: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({\n children,\n providers,\n}: {\n children: React.ReactNode\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n providers: any[]\n}) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const { composerKey, editorConfig, fieldProps, isSmallWidthViewport, onChange, readOnly, value } =\n props\n\n const parentContext = useEditorConfigContext()\n\n const editDepth = useEditDepth()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n // useMemo for the initialConfig that depends on readOnly and value\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (value && typeof value !== 'object') {\n throw new Error(\n 'The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: ' +\n JSON.stringify(value),\n )\n }\n\n if (value && Array.isArray(value) && !('root' in value)) {\n throw new Error(\n 'You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended',\n )\n }\n\n if (value && 'jsonContent' in value) {\n throw new Error(\n 'You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical',\n )\n }\n\n return {\n editable: readOnly !== true,\n editorState: value != null ? JSON.stringify(value) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: getEnabledNodes({ editorConfig }),\n onError: (error: Error) => {\n throw error\n },\n theme: editorConfig.lexical.theme,\n }\n // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will\n // cause the editor to lose focus.\n }, [editorConfig])\n\n if (!initialConfig) {\n return <p>Loading...</p>\n }\n\n // We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.\n // Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.\n return (\n <LexicalComposer initialConfig={initialConfig} key={composerKey + initialConfig.editable}>\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n fieldProps={fieldProps}\n /**\n * Parent editor is not truly the parent editor, if the current editor is part of a drawer and the parent editor is the main editor.\n */\n parentContext={parentContext?.editDepth === editDepth ? parentContext : undefined}\n >\n <NestProviders providers={editorConfig.features.providers}>\n <LexicalEditorComponent\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n isSmallWidthViewport={isSmallWidthViewport}\n onChange={onChange}\n />\n </NestProviders>\n </EditorConfigProvider>\n </LexicalComposer>\n )\n}\n"],"names":["LexicalComposer","useEditDepth","React","useMemo","EditorConfigProvider","useEditorConfigContext","LexicalEditor","LexicalEditorComponent","getEnabledNodes","NestProviders","children","providers","length","Component","slice","LexicalProvider","props","composerKey","editorConfig","fieldProps","isSmallWidthViewport","onChange","readOnly","value","parentContext","editDepth","editorContainerRef","useRef","initialConfig","Error","JSON","stringify","Array","isArray","editable","editorState","undefined","namespace","lexical","nodes","onError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Aa;YACvBa,aAAaZ,SAAS,OAAOO,KAAKC,SAAS,CAACR,SAASa;YACrDC,WAAWnB,aAAaoB,OAAO,CAACD,SAAS;YACzCE,OAAO/B,gBAAgB;gBAAEU;YAAa;YACtCsB,SAAS,CAACC;gBACR,MAAMA;YACR;YACAC,OAAOxB,aAAaoB,OAAO,CAACI,KAAK;QACnC;IAGF,GAFE,kKAAkK;IAClK,kCAAkC;IACjC;QAACxB;KAAa;IAEjB,IAAI,CAACU,eAAe;QAClB,qBAAO,QAACe;sBAAE;;;;;;IACZ;IAEA,wGAAwG;IACxG,gMAAgM;IAChM,qBACE,QAAC3C;QAAgB4B,eAAeA;kBAC9B,cAAA,QAACxB;YACCc,cAAcA;YACdQ,oBAAoBA;YACpBP,YAAYA;YACZ;;SAEC,GACDK,eAAeA,eAAeC,cAAcA,YAAYD,gBAAgBY;sBAExE,cAAA,QAAC3B;gBAAcE,WAAWO,aAAa0B,QAAQ,CAACjC,SAAS;0BACvD,cAAA,QAACJ;oBACCW,cAAcA;oBACdQ,oBAAoBA;oBACpBN,sBAAsBA;oBACtBC,UAAUA;;;;;;;;;;;;;;;;OAfkCJ,cAAcW,cAAcM,QAAQ;;;;;AAqB5F,EAAC"}
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
3
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
4
4
  import { useEditDepth } from '@payloadcms/ui';
5
5
  import * as React from 'react';
@@ -87,10 +87,14 @@ export const EditorConfigProvider = ({ children, editorConfig, editorContainerRe
87
87
  parentContext,
88
88
  uuid
89
89
  ]);
90
- return /*#__PURE__*/ _jsx(Context, {
90
+ return /*#__PURE__*/ _jsxDEV(Context, {
91
91
  value: editorContext,
92
92
  children: children
93
- });
93
+ }, void 0, false, {
94
+ fileName: "src/lexical/config/client/EditorConfigProvider.tsx",
95
+ lineNumber: 143,
96
+ columnNumber: 10
97
+ }, this);
94
98
  };
95
99
  export const useEditorConfigContext = ()=>{
96
100
  const context = use(Context);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lexical/config/client/EditorConfigProvider.tsx"],"sourcesContent":["'use client'\n\nimport type { LexicalEditor } from 'lexical'\nimport type { MarkRequired } from 'ts-essentials'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { createContext, use, useMemo, useRef, useState } from 'react'\n\nimport type { InlineBlockNode } from '../../../features/blocks/client/nodes/InlineBlocksNode.js'\nimport type { LexicalRichTextFieldProps } from '../../../types.js'\nimport type { SanitizedClientEditorConfig } from '../types.js'\n\n// Should always produce a 20 character pseudo-random string\nfunction generateQuickGuid(): string {\n return Math.random().toString(36).substring(2, 12) + Math.random().toString(36).substring(2, 12)\n}\n\nexport interface EditorConfigContextType {\n // Editor focus handling\n blurEditor: (editorContext: EditorConfigContextType) => void\n childrenEditors: React.RefObject<Map<string, EditorConfigContextType>>\n createdInlineBlock?: InlineBlockNode\n editDepth: number\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement>\n fieldProps: MarkRequired<LexicalRichTextFieldProps, 'path' | 'schemaPath'>\n focusedEditor: EditorConfigContextType | null\n // Editor focus handling\n focusEditor: (editorContext: EditorConfigContextType) => void\n parentEditor: EditorConfigContextType\n registerChild: (uuid: string, editorContext: EditorConfigContextType) => void\n setCreatedInlineBlock?: React.Dispatch<React.SetStateAction<InlineBlockNode | undefined>>\n unregisterChild?: (uuid: string) => void\n uuid: string\n}\n\n// @ts-expect-error: TODO: Fix this\nconst Context: React.Context<EditorConfigContextType> = createContext({\n editorConfig: null,\n fieldProps: null,\n uuid: null,\n})\n\nexport const EditorConfigProvider = ({\n children,\n editorConfig,\n editorContainerRef,\n fieldProps,\n parentContext,\n}: {\n children: React.ReactNode\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n\n fieldProps: LexicalRichTextFieldProps\n parentContext?: EditorConfigContextType\n}): React.ReactNode => {\n const [editor] = useLexicalComposerContext()\n // State to store the UUID\n const [uuid] = useState(() => generateQuickGuid())\n\n const childrenEditors = useRef<Map<string, EditorConfigContextType>>(new Map())\n const [focusedEditor, setFocusedEditor] = useState<EditorConfigContextType | null>(null)\n const focusHistory = useRef<Set<string>>(new Set())\n const [createdInlineBlock, setCreatedInlineBlock] = useState<InlineBlockNode>()\n\n const editDepth = useEditDepth()\n\n const editorContext = useMemo(\n () =>\n ({\n blurEditor: (editorContext: EditorConfigContextType) => {\n //setFocusedEditor(null) // Clear focused editor\n focusHistory.current.clear() // Reset focus history when focus is lost\n },\n childrenEditors,\n createdInlineBlock,\n editDepth,\n editor,\n editorConfig,\n editorContainerRef,\n fieldProps,\n focusedEditor,\n focusEditor: (editorContext: EditorConfigContextType) => {\n const editorUUID = editorContext.uuid\n\n // Avoid recursion by checking if this editor is already focused in this cycle\n if (focusHistory.current.has(editorUUID)) {\n return\n }\n\n // Add this editor to the history to prevent future recursions in this cycle\n focusHistory.current.add(editorUUID)\n setFocusedEditor(editorContext)\n\n // Propagate focus event to parent and children, ensuring they do not refocus this editor\n if (parentContext?.uuid) {\n parentContext.focusEditor(editorContext)\n }\n childrenEditors.current.forEach((childEditor) => {\n childEditor.focusEditor(editorContext)\n })\n\n focusHistory.current.clear()\n },\n parentEditor: parentContext,\n registerChild: (childUUID, childEditorContext) => {\n if (!childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.set(childUUID, childEditorContext)\n childrenEditors.current = newMap\n }\n },\n setCreatedInlineBlock,\n unregisterChild: (childUUID) => {\n if (childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.delete(childUUID)\n childrenEditors.current = newMap\n }\n },\n\n uuid,\n }) as EditorConfigContextType,\n [\n createdInlineBlock,\n setCreatedInlineBlock,\n editor,\n childrenEditors,\n editorConfig,\n editorContainerRef,\n editDepth,\n fieldProps,\n focusedEditor,\n parentContext,\n uuid,\n ],\n )\n\n return <Context value={editorContext}>{children}</Context>\n}\n\nexport const useEditorConfigContext = (): EditorConfigContextType => {\n const context = use(Context)\n if (context === undefined) {\n throw new Error('useEditorConfigContext must be used within an EditorConfigProvider')\n }\n return context\n}\n"],"names":["useLexicalComposerContext","useEditDepth","React","createContext","use","useMemo","useRef","useState","generateQuickGuid","Math","random","toString","substring","Context","editorConfig","fieldProps","uuid","EditorConfigProvider","children","editorContainerRef","parentContext","editor","childrenEditors","Map","focusedEditor","setFocusedEditor","focusHistory","Set","createdInlineBlock","setCreatedInlineBlock","editDepth","editorContext","blurEditor","current","clear","focusEditor","editorUUID","has","add","forEach","childEditor","parentEditor","registerChild","childUUID","childEditorContext","newMap","set","unregisterChild","delete","value","useEditorConfigContext","context","undefined","Error"],"mappings":"AAAA;;AAKA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,YAAY,QAAQ,iBAAgB;AAC7C,YAAYC,WAAW,QAAO;AAC9B,SAASC,aAAa,EAAEC,GAAG,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAMrE,4DAA4D;AAC5D,SAASC;IACP,OAAOC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,GAAG,MAAMH,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,GAAG;AAC/F;AAGE,wBAAwB;AAUxB,wBAAwB;AAS1B,mCAAmC;AACnC,MAAMC,wBAAkDV,cAAc;IACpEW,cAAc;IACdC,YAAY;IACZC,MAAM;AACR;AAEA,OAAO,MAAMC,uBAAuB,CAAC,EACnCC,QAAQ,EACRJ,YAAY,EACZK,kBAAkB,EAClBJ,UAAU,EACVK,aAAa,EAQd;IACC,MAAM,CAACC,OAAO,GAAGrB;IACjB,0BAA0B;IAC1B,MAAM,CAACgB,K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AAgBW,OAAO,GAAGY;gBAC5B;YACF;YAEA7B;QACF,CAAA,GACF;QACEY;QACAC;QACAR;QACAC;QACAR;QACAK;QACAW;QACAf;QACAS;QACAJ;QACAJ;KACD;IAGH,qBAAO,KAACH;QAAQoC,OAAOlB;kBAAgBb;;AACzC,EAAC;AAED,OAAO,MAAMgC,yBAAyB;IACpC,MAAMC,UAAU/C,IAAIS;IACpB,IAAIsC,YAAYC,WAAW;QACzB,MAAM,IAAIC,MAAM;IAClB;IACA,OAAOF;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../../src/lexical/config/client/EditorConfigProvider.tsx"],"sourcesContent":["'use client'\n\nimport type { LexicalEditor } from 'lexical'\nimport type { MarkRequired } from 'ts-essentials'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { createContext, use, useMemo, useRef, useState } from 'react'\n\nimport type { InlineBlockNode } from '../../../features/blocks/client/nodes/InlineBlocksNode.js'\nimport type { LexicalRichTextFieldProps } from '../../../types.js'\nimport type { SanitizedClientEditorConfig } from '../types.js'\n\n// Should always produce a 20 character pseudo-random string\nfunction generateQuickGuid(): string {\n return Math.random().toString(36).substring(2, 12) + Math.random().toString(36).substring(2, 12)\n}\n\nexport interface EditorConfigContextType {\n // Editor focus handling\n blurEditor: (editorContext: EditorConfigContextType) => void\n childrenEditors: React.RefObject<Map<string, EditorConfigContextType>>\n createdInlineBlock?: InlineBlockNode\n editDepth: number\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement>\n fieldProps: MarkRequired<LexicalRichTextFieldProps, 'path' | 'schemaPath'>\n focusedEditor: EditorConfigContextType | null\n // Editor focus handling\n focusEditor: (editorContext: EditorConfigContextType) => void\n parentEditor: EditorConfigContextType\n registerChild: (uuid: string, editorContext: EditorConfigContextType) => void\n setCreatedInlineBlock?: React.Dispatch<React.SetStateAction<InlineBlockNode | undefined>>\n unregisterChild?: (uuid: string) => void\n uuid: string\n}\n\n// @ts-expect-error: TODO: Fix this\nconst Context: React.Context<EditorConfigContextType> = createContext({\n editorConfig: null,\n fieldProps: null,\n uuid: null,\n})\n\nexport const EditorConfigProvider = ({\n children,\n editorConfig,\n editorContainerRef,\n fieldProps,\n parentContext,\n}: {\n children: React.ReactNode\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n\n fieldProps: LexicalRichTextFieldProps\n parentContext?: EditorConfigContextType\n}): React.ReactNode => {\n const [editor] = useLexicalComposerContext()\n // State to store the UUID\n const [uuid] = useState(() => generateQuickGuid())\n\n const childrenEditors = useRef<Map<string, EditorConfigContextType>>(new Map())\n const [focusedEditor, setFocusedEditor] = useState<EditorConfigContextType | null>(null)\n const focusHistory = useRef<Set<string>>(new Set())\n const [createdInlineBlock, setCreatedInlineBlock] = useState<InlineBlockNode>()\n\n const editDepth = useEditDepth()\n\n const editorContext = useMemo(\n () =>\n ({\n blurEditor: (editorContext: EditorConfigContextType) => {\n //setFocusedEditor(null) // Clear focused editor\n focusHistory.current.clear() // Reset focus history when focus is lost\n },\n childrenEditors,\n createdInlineBlock,\n editDepth,\n editor,\n editorConfig,\n editorContainerRef,\n fieldProps,\n focusedEditor,\n focusEditor: (editorContext: EditorConfigContextType) => {\n const editorUUID = editorContext.uuid\n\n // Avoid recursion by checking if this editor is already focused in this cycle\n if (focusHistory.current.has(editorUUID)) {\n return\n }\n\n // Add this editor to the history to prevent future recursions in this cycle\n focusHistory.current.add(editorUUID)\n setFocusedEditor(editorContext)\n\n // Propagate focus event to parent and children, ensuring they do not refocus this editor\n if (parentContext?.uuid) {\n parentContext.focusEditor(editorContext)\n }\n childrenEditors.current.forEach((childEditor) => {\n childEditor.focusEditor(editorContext)\n })\n\n focusHistory.current.clear()\n },\n parentEditor: parentContext,\n registerChild: (childUUID, childEditorContext) => {\n if (!childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.set(childUUID, childEditorContext)\n childrenEditors.current = newMap\n }\n },\n setCreatedInlineBlock,\n unregisterChild: (childUUID) => {\n if (childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.delete(childUUID)\n childrenEditors.current = newMap\n }\n },\n\n uuid,\n }) as EditorConfigContextType,\n [\n createdInlineBlock,\n setCreatedInlineBlock,\n editor,\n childrenEditors,\n editorConfig,\n editorContainerRef,\n editDepth,\n fieldProps,\n focusedEditor,\n parentContext,\n uuid,\n ],\n )\n\n return <Context value={editorContext}>{children}</Context>\n}\n\nexport const useEditorConfigContext = (): EditorConfigContextType => {\n const context = use(Context)\n if (context === undefined) {\n throw new Error('useEditorConfigContext must be used within an EditorConfigProvider')\n }\n return context\n}\n"],"names":["useLexicalComposerContext","useEditDepth","React","createContext","use","useMemo","useRef","useState","generateQuickGuid","Math","random","toString","substring","Context","editorConfig","fieldProps","uuid","EditorConfigProvider","children","editorContainerRef","parentContext","editor","childrenEditors","Map","focusedEditor","setFocusedEditor","focusHistory","Set","createdInlineBlock","setCreatedInlineBlock","editDepth","editorContext","blurEditor","current","clear","focusEditor","editorUUID","has","add","forEach","childEditor","parentEditor","registerChild","childUUID","childEditorContext","newMap","set","unregisterChild","delete","value","useEditorConfigContext","context","undefined","Error"],"mappings":"AAAA;;AAKA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,YAAY,QAAQ,iBAAgB;AAC7C,YAAYC,WAAW,QAAO;AAC9B,SAASC,aAAa,EAAEC,GAAG,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAMrE,4DAA4D;AAC5D,SAASC;IACP,OAAOC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,GAAG,MAAMH,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,GAAG;AAC/F;AAGE,wBAAwB;AAUxB,wBAAwB;AAS1B,mCAAmC;AAC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