@payloadcms/richtext-lexical 4.0.0-internal.f11981a → 4.0.0-internal.f2a04f7

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 (371) hide show
  1. package/dist/exports/client/Field-W2ABOM7M.js +2 -0
  2. package/dist/exports/client/Field-W2ABOM7M.js.map +7 -0
  3. package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
  4. package/dist/exports/client/{chunk-LN6VX25I.js.map → chunk-3LRZDIIG.js.map} +2 -2
  5. package/dist/exports/client/chunk-E6LSRRP2.js +2 -0
  6. package/dist/exports/client/chunk-E6LSRRP2.js.map +7 -0
  7. package/dist/exports/client/chunk-ZQX5HXUL.js +2 -0
  8. package/dist/exports/client/{chunk-43E5QYAA.js.map → chunk-ZQX5HXUL.js.map} +3 -3
  9. package/dist/exports/client/{component-D5QLYS7W.js → component-6DQLENIE.js} +2 -2
  10. package/dist/exports/client/componentInline-HNE5G4TE.js +2 -0
  11. package/dist/exports/client/index.js +28 -28
  12. package/dist/exports/client/index.js.map +4 -4
  13. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  14. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  15. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  16. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  17. package/dist/features/blocks/client/component/index.d.ts +0 -6
  18. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  19. package/dist/features/blocks/client/component/index.js +196 -101
  20. package/dist/features/blocks/client/component/index.js.map +1 -1
  21. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  22. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  23. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  24. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  25. package/dist/features/blocks/client/componentInline/index.css +0 -1
  26. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  27. package/dist/features/blocks/client/componentInline/index.js +30 -22
  28. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  29. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts +9 -0
  30. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts.map +1 -0
  31. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js +95 -0
  32. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -0
  33. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  34. package/dist/features/blocks/client/nodes/BlocksNode.js +0 -10
  35. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  36. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  37. package/dist/features/blocks/server/nodes/BlocksNode.js +1 -12
  38. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  39. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +2 -2
  40. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  41. package/dist/features/blocks/server/schema.d.ts +2 -0
  42. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  43. package/dist/features/blocks/server/schema.js +7 -9
  44. package/dist/features/blocks/server/schema.js.map +1 -1
  45. package/dist/features/blocks/server/validate.js +1 -1
  46. package/dist/features/blocks/server/validate.js.map +1 -1
  47. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  48. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  49. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  50. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  51. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  52. package/dist/features/converters/lexicalToHtml/async/converters/upload.js +3 -3
  53. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  54. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  55. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  56. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  57. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  58. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  59. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  60. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  61. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  62. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +3 -3
  63. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  64. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  65. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  66. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  67. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  68. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  69. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  70. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  71. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  72. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  73. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +4 -5
  74. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  75. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  76. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  77. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  78. package/dist/features/heading/constants.d.ts +2 -0
  79. package/dist/features/heading/constants.d.ts.map +1 -0
  80. package/dist/features/heading/constants.js +2 -0
  81. package/dist/features/heading/constants.js.map +1 -0
  82. package/dist/features/heading/server/index.d.ts.map +1 -1
  83. package/dist/features/heading/server/index.js +5 -1
  84. package/dist/features/heading/server/index.js.map +1 -1
  85. package/dist/features/heading/server/validate.d.ts +6 -0
  86. package/dist/features/heading/server/validate.d.ts.map +1 -0
  87. package/dist/features/heading/server/validate.js +15 -0
  88. package/dist/features/heading/server/validate.js.map +1 -0
  89. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +11 -1
  90. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  91. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +17 -0
  92. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  93. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +2 -2
  94. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  95. package/dist/features/horizontalRule/server/schema.d.ts +1 -0
  96. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -1
  97. package/dist/features/horizontalRule/server/schema.js +6 -5
  98. package/dist/features/horizontalRule/server/schema.js.map +1 -1
  99. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  100. package/dist/features/indent/client/IndentPlugin.js +122 -1
  101. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  102. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  103. package/dist/features/indent/server/i18n.js +74 -37
  104. package/dist/features/indent/server/i18n.js.map +1 -1
  105. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  106. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +8 -5
  107. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  108. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
  109. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  110. package/dist/features/link/nodes/AutoLinkNode.js +2 -10
  111. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  112. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  113. package/dist/features/link/nodes/LinkNode.js +2 -15
  114. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  115. package/dist/features/link/server/validate.js +1 -1
  116. package/dist/features/link/server/validate.js.map +1 -1
  117. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  118. package/dist/features/lists/checklist/server/index.js +5 -2
  119. package/dist/features/lists/checklist/server/index.js.map +1 -1
  120. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  121. package/dist/features/lists/orderedList/server/index.js +5 -2
  122. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  123. package/dist/features/lists/shared/constants.d.ts +2 -0
  124. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  125. package/dist/features/lists/shared/constants.js +2 -0
  126. package/dist/features/lists/shared/constants.js.map +1 -0
  127. package/dist/features/lists/shared/schema.d.ts.map +1 -1
  128. package/dist/features/lists/shared/schema.js.map +1 -1
  129. package/dist/features/lists/shared/validate.d.ts +5 -0
  130. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  131. package/dist/features/lists/shared/validate.js +15 -0
  132. package/dist/features/lists/shared/validate.js.map +1 -0
  133. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  134. package/dist/features/lists/unorderedList/server/index.js +5 -2
  135. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  136. package/dist/features/relationship/client/components/index.css +3 -6
  137. package/dist/features/relationship/client/index.d.ts +2 -2
  138. package/dist/features/relationship/client/index.d.ts.map +1 -1
  139. package/dist/features/relationship/client/index.js.map +1 -1
  140. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  141. package/dist/features/relationship/client/nodes/RelationshipNode.js +0 -3
  142. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  143. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  144. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  145. package/dist/features/relationship/client/plugins/index.js +27 -31
  146. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  147. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  148. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  149. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  150. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  151. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  152. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  153. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  154. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  155. package/dist/features/relationship/server/index.d.ts +8 -1
  156. package/dist/features/relationship/server/index.d.ts.map +1 -1
  157. package/dist/features/relationship/server/index.js +28 -11
  158. package/dist/features/relationship/server/index.js.map +1 -1
  159. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  160. package/dist/features/relationship/server/nodes/RelationshipNode.js +1 -5
  161. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  162. package/dist/features/relationship/server/schema.d.ts +3 -2
  163. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  164. package/dist/features/relationship/server/schema.js +9 -12
  165. package/dist/features/relationship/server/schema.js.map +1 -1
  166. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  167. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  168. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  169. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  170. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  171. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  172. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  173. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  174. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.css +0 -1
  175. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  176. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js +17 -44
  177. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  178. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  179. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js +41 -18
  180. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  181. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.css +0 -3
  182. package/dist/features/textState/defaultColors.js +1 -1
  183. package/dist/features/textState/defaultColors.js.map +1 -1
  184. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  185. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  186. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  187. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  188. package/dist/features/toolbars/fixed/client/Toolbar/index.css +77 -3
  189. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  190. package/dist/features/toolbars/fixed/client/Toolbar/index.js +19 -1
  191. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  192. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  193. package/dist/features/toolbars/inline/client/Toolbar/index.js +17 -2
  194. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  195. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  196. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  197. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  198. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  199. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  200. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  201. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -12
  202. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts +5 -0
  203. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts.map +1 -0
  204. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js +79 -0
  205. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -0
  206. package/dist/features/typesServer.d.ts +16 -11
  207. package/dist/features/typesServer.d.ts.map +1 -1
  208. package/dist/features/typesServer.js.map +1 -1
  209. package/dist/features/upload/client/component/index.css +0 -2
  210. package/dist/features/upload/client/index.d.ts +3 -2
  211. package/dist/features/upload/client/index.d.ts.map +1 -1
  212. package/dist/features/upload/client/index.js.map +1 -1
  213. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  214. package/dist/features/upload/client/nodes/UploadNode.js +0 -7
  215. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  216. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  217. package/dist/features/upload/client/plugin/index.js +50 -53
  218. package/dist/features/upload/client/plugin/index.js.map +1 -1
  219. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  220. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  221. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  222. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  223. package/dist/features/upload/server/index.d.ts +7 -3
  224. package/dist/features/upload/server/index.d.ts.map +1 -1
  225. package/dist/features/upload/server/index.js +18 -14
  226. package/dist/features/upload/server/index.js.map +1 -1
  227. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  228. package/dist/features/upload/server/nodes/UploadNode.js +1 -9
  229. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  230. package/dist/features/upload/server/schema.d.ts +4 -16
  231. package/dist/features/upload/server/schema.d.ts.map +1 -1
  232. package/dist/features/upload/server/schema.js +8 -10
  233. package/dist/features/upload/server/schema.js.map +1 -1
  234. package/dist/features/upload/server/validate.d.ts +2 -2
  235. package/dist/features/upload/server/validate.d.ts.map +1 -1
  236. package/dist/features/upload/server/validate.js +4 -1
  237. package/dist/features/upload/server/validate.js.map +1 -1
  238. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  239. package/dist/field/Diff/converters/listitem/index.js +2 -1
  240. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  241. package/dist/field/Diff/converters/relationship/index.css +0 -1
  242. package/dist/field/Diff/converters/unknown/index.css +0 -1
  243. package/dist/field/Diff/converters/upload/index.css +0 -1
  244. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  245. package/dist/field/Diff/index.css +0 -2
  246. package/dist/field/Diff/index.d.ts +3 -2
  247. package/dist/field/Diff/index.d.ts.map +1 -1
  248. package/dist/field/Diff/index.js +3 -2
  249. package/dist/field/Diff/index.js.map +1 -1
  250. package/dist/field/Field.d.ts.map +1 -1
  251. package/dist/field/Field.js +8 -1
  252. package/dist/field/Field.js.map +1 -1
  253. package/dist/field/RenderLexical/index.d.ts +3 -1
  254. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  255. package/dist/field/RenderLexical/index.js +23 -23
  256. package/dist/field/RenderLexical/index.js.map +1 -1
  257. package/dist/field/ViewSelector.d.ts.map +1 -1
  258. package/dist/field/ViewSelector.js +1 -0
  259. package/dist/field/ViewSelector.js.map +1 -1
  260. package/dist/field/bundled.css +1 -1
  261. package/dist/field/index.css +10 -11
  262. package/dist/field/rscEntry.d.ts +2 -2
  263. package/dist/field/rscEntry.d.ts.map +1 -1
  264. package/dist/field/rscEntry.js.map +1 -1
  265. package/dist/index.d.ts +4 -4
  266. package/dist/index.d.ts.map +1 -1
  267. package/dist/index.js +23 -1
  268. package/dist/index.js.map +1 -1
  269. package/dist/lexical/LexicalEditor.css +21 -10
  270. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  271. package/dist/lexical/LexicalEditor.js +61 -64
  272. package/dist/lexical/LexicalEditor.js.map +1 -1
  273. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
  274. package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
  275. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  276. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +2 -1
  277. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +1 -1
  278. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  279. package/dist/lexical/plugins/SlashMenu/index.css +0 -1
  280. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
  281. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  282. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  283. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +1 -0
  284. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  285. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -2
  286. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  287. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  288. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  289. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  290. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  291. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  292. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  293. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  294. package/dist/lexical/theme/EditorTheme.css +0 -2
  295. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  296. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  297. package/dist/lexical/ui/ContentEditable.js +32 -11
  298. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  299. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  300. package/dist/lexical/ui/icons/H3/index.js +13 -6
  301. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  302. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  303. package/dist/lexical/ui/icons/H4/index.js +13 -6
  304. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  305. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  306. package/dist/lexical/ui/icons/H5/index.js +13 -6
  307. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  308. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  309. package/dist/lexical/ui/icons/H6/index.js +13 -6
  310. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  311. package/dist/presets/llmInstructions.d.ts +2 -0
  312. package/dist/presets/llmInstructions.d.ts.map +1 -0
  313. package/dist/presets/llmInstructions.js +13 -0
  314. package/dist/presets/llmInstructions.js.map +1 -0
  315. package/dist/types/builtInNodes.d.ts +1 -1
  316. package/dist/types/builtInNodes.d.ts.map +1 -1
  317. package/dist/types/builtInNodes.js +8 -3
  318. package/dist/types/builtInNodes.js.map +1 -1
  319. package/dist/types/index.d.ts +3 -6
  320. package/dist/types/index.d.ts.map +1 -1
  321. package/dist/types/index.js.map +1 -1
  322. package/dist/types/jsonSchemaHelpers.d.ts +5 -1
  323. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  324. package/dist/types/jsonSchemaHelpers.js +7 -2
  325. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  326. package/dist/types/nodeTypes.d.ts +5 -0
  327. package/dist/types/nodeTypes.d.ts.map +1 -1
  328. package/dist/types/nodeTypes.js.map +1 -1
  329. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  330. package/dist/utilities/buildEditorState.js.map +1 -1
  331. package/dist/utilities/buildInitialState.d.ts +3 -2
  332. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  333. package/dist/utilities/buildInitialState.js +1 -0
  334. package/dist/utilities/buildInitialState.js.map +1 -1
  335. package/dist/utilities/generateImportMap.d.ts +2 -2
  336. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  337. package/dist/utilities/generateImportMap.js.map +1 -1
  338. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  339. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  340. package/dist/validate/hasText.d.ts +2 -2
  341. package/dist/validate/hasText.d.ts.map +1 -1
  342. package/dist/validate/hasText.js.map +1 -1
  343. package/dist/validate/index.d.ts +1 -1
  344. package/dist/validate/index.d.ts.map +1 -1
  345. package/package.json +45 -45
  346. package/dist/dependencyChecker.spec.js +0 -16
  347. package/dist/dependencyChecker.spec.js.map +0 -1
  348. package/dist/exports/client/Field-F22V5L4V.js +0 -2
  349. package/dist/exports/client/Field-F22V5L4V.js.map +0 -7
  350. package/dist/exports/client/bundled.css +0 -1
  351. package/dist/exports/client/chunk-43E5QYAA.js +0 -2
  352. package/dist/exports/client/chunk-ESITTE3C.js +0 -2
  353. package/dist/exports/client/chunk-ESITTE3C.js.map +0 -7
  354. package/dist/exports/client/chunk-LN6VX25I.js +0 -2
  355. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  356. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts +0 -11
  357. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts.map +0 -1
  358. package/dist/features/blocks/client/component/removeEmptyArrayValues.js +0 -20
  359. package/dist/features/blocks/client/component/removeEmptyArrayValues.js.map +0 -1
  360. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  361. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  362. package/dist/features/link/markdownTransformer.spec.js +0 -195
  363. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  364. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  365. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  366. package/dist/lexical/utils/url.spec.js +0 -114
  367. package/dist/lexical/utils/url.spec.js.map +0 -1
  368. package/dist/utilities/jsx/jsx.spec.js +0 -178
  369. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  370. /package/dist/exports/client/{component-D5QLYS7W.js.map → component-6DQLENIE.js.map} +0 -0
  371. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-HNE5G4TE.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"buildEditorState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildEditorState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAEhB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAE9B;;;GAGG;AACH,KAAK,UAAU,CAAC,CAAC,IACf,WAAW,CAAC,CAAC,CAAC,SAAS,gBAAgB,CAAC,MAAM,KAAK,SAAS,qBAAqB,CAAC,GAC9E,KAAK,GACL,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,SACG,IAAI,GACJ,qBAAqB,GACrB,gBAAgB,CAAC,qBAAqB,CAAC,GACvC,SAAS,GAAG,gBAAgB,EAChC,EACA,KAAK,EACL,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAA;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAuDlC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,gBAAgB,CAAC,gBAAgB,CAC1C,CAAA"}
1
+ {"version":3,"file":"buildEditorState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildEditorState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAEhB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAE9B;;;GAGG;AACH,KAAK,UAAU,CAAC,CAAC,IACf,WAAW,CAAC,CAAC,CAAC,SAAS,gBAAgB,CAAC,MAAM,KAAK,SAAS,qBAAqB,CAAC,GAC9E,KAAK,GACL,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,SAAS,IAAI,GAAG,qBAAqB,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,SAAS,GAC1F,gBAAgB,EAClB,EACA,KAAK,EACL,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAA;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAuDlC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,gBAAgB,CAAC,gBAAgB,CAC1C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildEditorState.js","names":["buildEditorState","nodes","text","editorJSON","root","type","children","direction","format","indent","version","push","detail","mode","style","textFormat","textStyle","length","buildDefaultEditorState"],"sources":["../../src/utilities/buildEditorState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n DefaultTypedEditorState,\n TypedEditorState,\n} from '../types/nodeTypes.js'\n\n/**\n * The node union to build with. Accepts either a node union directly (e.g. `DefaultNodeTypes`) or a\n * generated `richText` field type (e.g. `Post['richText']`), whose nodes are extracted automatically.\n */\ntype BuildNodes<T> =\n NonNullable<T> extends TypedEditorState<infer TNode extends SerializedLexicalNode>\n ? TNode\n : Extract<NonNullable<T>, SerializedLexicalNode>\n\n/**\n * Helper to build lexical editor state JSON from text and/or nodes.\n *\n * @param nodes - The nodes to include in the editor state. If you pass the `text` argument, this will append your nodes after the first paragraph node.\n * @param text - The text content to include in the editor state. This will create a paragraph node with a text node for you and set that as the first node.\n * @returns The constructed editor state JSON.\n *\n * @example\n *\n * just passing text:\n *\n * ```ts\n * const editorState = buildEditorState<DefaultNodeTypes>({ text: 'Hello world' }) // result typed as DefaultTypedEditorState\n * ```\n *\n * @example\n *\n * passing nodes:\n *\n * ```ts\n * const editorState = // result typed as TypedEditorState<DefaultNodeTypes | SerializedBlockNode> (or TypedEditorState<SerializedBlockNode>)\n * buildEditorState<DefaultNodeTypes | SerializedBlockNode>({ // or just buildEditorState<SerializedBlockNode> if you *only* want to allow block nodes\n * nodes: [\n * {\n * type: 'block',\n * fields: {\n * id: 'id',\n * blockName: 'Cool block',\n * blockType: 'myBlock',\n * },\n * format: 'left',\n * version: 1,\n * }\n * ],\n * })\n * ```\n *\n * @example\n *\n * passing a generated `richText` field type — the result is exactly that field's type:\n *\n * ```ts\n * post.richText = buildEditorState<Post['richText']>({ text: 'Hello world' })\n * ```\n */\nexport function buildEditorState<\n T extends\n | null\n | SerializedLexicalNode\n | TypedEditorState<SerializedLexicalNode>\n | undefined = DefaultNodeTypes,\n>({\n nodes,\n text,\n}: {\n nodes?: TypedEditorState<BuildNodes<T>>['root']['children']\n text?: string\n}): TypedEditorState<BuildNodes<T>> {\n const editorJSON: DefaultTypedEditorState = {\n root: {\n type: 'root',\n children: [],\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n }\n\n if (text) {\n editorJSON.root.children.push({\n type: 'paragraph',\n children: [\n {\n type: 'text',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text,\n version: 1,\n },\n ],\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n textStyle: '',\n version: 1,\n })\n }\n\n if (nodes?.length) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n editorJSON.root.children.push(...(nodes as any))\n }\n\n if (editorJSON.root.children.length === 0) {\n // An error will be thrown if the root node has no children\n editorJSON.root.children.push({\n type: 'paragraph',\n children: [],\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n textStyle: '',\n version: 1,\n })\n }\n\n return editorJSON as TypedEditorState<BuildNodes<T>>\n}\n\n/**\n *\n * Alias for `buildEditorState<DefaultNodeTypes>`\n *\n * @experimental this API may change or be removed in a minor release\n * @internal\n */\nexport const buildDefaultEditorState: typeof buildEditorState<DefaultNodeTypes> =\n buildEditorState<DefaultNodeTypes>\n"],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CA,OAAO,SAASA,iBAMd;EACAC,KAAK;EACLC;AAAI,CAIL;EACC,MAAMC,UAAA,GAAsC;IAC1CC,IAAA,EAAM;MACJC,IAAA,EAAM;MACNC,QAAA,EAAU,EAAE;MACZC,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRC,OAAA,EAAS;IACX;EACF;EAEA,IAAIR,IAAA,EAAM;IACRC,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,CAAC;MAC5BN,IAAA,EAAM;MACNC,QAAA,EAAU,CACR;QACED,IAAA,EAAM;QACNO,MAAA,EAAQ;QACRJ,MAAA,EAAQ;QACRK,IAAA,EAAM;QACNC,KAAA,EAAO;QACPZ,IAAA;QACAQ,OAAA,EAAS;MACX,EACD;MACDH,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRM,UAAA,EAAY;MACZC,SAAA,EAAW;MACXN,OAAA,EAAS;IACX;EACF;EAEA,IAAIT,KAAA,EAAOgB,MAAA,EAAQ;IACjB;IACAd,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,IAAKV,KAAA;EACpC;EAEA,IAAIE,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACW,MAAM,KAAK,GAAG;IACzC;IACAd,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,CAAC;MAC5BN,IAAA,EAAM;MACNC,QAAA,EAAU,EAAE;MACZC,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRM,UAAA,EAAY;MACZC,SAAA,EAAW;MACXN,OAAA,EAAS;IACX;EACF;EAEA,OAAOP,UAAA;AACT;AAEA;;;;;;;AAOA,OAAO,MAAMe,uBAAA,GACXlB,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"buildEditorState.js","names":["buildEditorState","nodes","text","editorJSON","root","type","children","direction","format","indent","version","push","detail","mode","style","textFormat","textStyle","length","buildDefaultEditorState"],"sources":["../../src/utilities/buildEditorState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n DefaultTypedEditorState,\n TypedEditorState,\n} from '../types/nodeTypes.js'\n\n/**\n * The node union to build with. Accepts either a node union directly (e.g. `DefaultNodeTypes`) or a\n * generated `richText` field type (e.g. `Post['richText']`), whose nodes are extracted automatically.\n */\ntype BuildNodes<T> =\n NonNullable<T> extends TypedEditorState<infer TNode extends SerializedLexicalNode>\n ? TNode\n : Extract<NonNullable<T>, SerializedLexicalNode>\n\n/**\n * Helper to build lexical editor state JSON from text and/or nodes.\n *\n * @param nodes - The nodes to include in the editor state. If you pass the `text` argument, this will append your nodes after the first paragraph node.\n * @param text - The text content to include in the editor state. This will create a paragraph node with a text node for you and set that as the first node.\n * @returns The constructed editor state JSON.\n *\n * @example\n *\n * just passing text:\n *\n * ```ts\n * const editorState = buildEditorState<DefaultNodeTypes>({ text: 'Hello world' }) // result typed as DefaultTypedEditorState\n * ```\n *\n * @example\n *\n * passing nodes:\n *\n * ```ts\n * const editorState = // result typed as TypedEditorState<DefaultNodeTypes | SerializedBlockNode> (or TypedEditorState<SerializedBlockNode>)\n * buildEditorState<DefaultNodeTypes | SerializedBlockNode>({ // or just buildEditorState<SerializedBlockNode> if you *only* want to allow block nodes\n * nodes: [\n * {\n * type: 'block',\n * fields: {\n * id: 'id',\n * blockName: 'Cool block',\n * blockType: 'myBlock',\n * },\n * format: 'left',\n * version: 1,\n * }\n * ],\n * })\n * ```\n *\n * @example\n *\n * passing a generated `richText` field type — the result is exactly that field's type:\n *\n * ```ts\n * post.richText = buildEditorState<Post['richText']>({ text: 'Hello world' })\n * ```\n */\nexport function buildEditorState<\n T extends null | SerializedLexicalNode | TypedEditorState<SerializedLexicalNode> | undefined =\n DefaultNodeTypes,\n>({\n nodes,\n text,\n}: {\n nodes?: TypedEditorState<BuildNodes<T>>['root']['children']\n text?: string\n}): TypedEditorState<BuildNodes<T>> {\n const editorJSON: DefaultTypedEditorState = {\n root: {\n type: 'root',\n children: [],\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n }\n\n if (text) {\n editorJSON.root.children.push({\n type: 'paragraph',\n children: [\n {\n type: 'text',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text,\n version: 1,\n },\n ],\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n textStyle: '',\n version: 1,\n })\n }\n\n if (nodes?.length) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n editorJSON.root.children.push(...(nodes as any))\n }\n\n if (editorJSON.root.children.length === 0) {\n // An error will be thrown if the root node has no children\n editorJSON.root.children.push({\n type: 'paragraph',\n children: [],\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n textStyle: '',\n version: 1,\n })\n }\n\n return editorJSON as TypedEditorState<BuildNodes<T>>\n}\n\n/**\n *\n * Alias for `buildEditorState<DefaultNodeTypes>`\n *\n * @experimental this API may change or be removed in a minor release\n * @internal\n */\nexport const buildDefaultEditorState: typeof buildEditorState<DefaultNodeTypes> =\n buildEditorState<DefaultNodeTypes>\n"],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CA,OAAO,SAASA,iBAGd;EACAC,KAAK;EACLC;AAAI,CAIL;EACC,MAAMC,UAAA,GAAsC;IAC1CC,IAAA,EAAM;MACJC,IAAA,EAAM;MACNC,QAAA,EAAU,EAAE;MACZC,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRC,OAAA,EAAS;IACX;EACF;EAEA,IAAIR,IAAA,EAAM;IACRC,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,CAAC;MAC5BN,IAAA,EAAM;MACNC,QAAA,EAAU,CACR;QACED,IAAA,EAAM;QACNO,MAAA,EAAQ;QACRJ,MAAA,EAAQ;QACRK,IAAA,EAAM;QACNC,KAAA,EAAO;QACPZ,IAAA;QACAQ,OAAA,EAAS;MACX,EACD;MACDH,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRM,UAAA,EAAY;MACZC,SAAA,EAAW;MACXN,OAAA,EAAS;IACX;EACF;EAEA,IAAIT,KAAA,EAAOgB,MAAA,EAAQ;IACjB;IACAd,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,IAAKV,KAAA;EACpC;EAEA,IAAIE,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACW,MAAM,KAAK,GAAG;IACzC;IACAd,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,CAAC;MAC5BN,IAAA,EAAM;MACNC,QAAA,EAAU,EAAE;MACZC,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRM,UAAA,EAAY;MACZC,SAAA,EAAW;MACXN,OAAA,EAAS;IACX;EACF;EAEA,OAAOP,UAAA;AACT;AAEA;;;;;;;AAOA,OAAO,MAAMe,uBAAA,GACXlB,gBAAA","ignoreList":[]}
@@ -1,9 +1,10 @@
1
1
  import type { SerializedLexicalNode } from 'lexical';
2
- import type { ClientFieldSchemaMap, ComponentRenderer, DocumentPreferences, FieldSchemaMap, FormState, Operation, PayloadRequest, RichTextField, SanitizedFieldPermissions } from 'payload';
2
+ import type { ClientFieldSchemaMap, ComponentRenderer, DocumentPreferences, FieldOperation, FieldSchemaMap, FormState, PayloadRequest, RichTextField, SanitizedFieldPermissions } from 'payload';
3
3
  export type InitialLexicalFormState = {
4
4
  [nodeID: string]: {
5
5
  [key: string]: any;
6
6
  formState?: FormState;
7
+ schemaPath?: string;
7
8
  };
8
9
  };
9
10
  type Props = {
@@ -16,7 +17,7 @@ type Props = {
16
17
  fieldSchemaMap: FieldSchemaMap;
17
18
  id?: number | string;
18
19
  lexicalFieldSchemaPath: string;
19
- operation: Operation;
20
+ operation: FieldOperation;
20
21
  permissions?: SanitizedFieldPermissions;
21
22
  preferences: DocumentPreferences;
22
23
  renderComponent: ComponentRenderer;
@@ -1 +1 @@
1
- {"version":3,"file":"buildInitialState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildInitialState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,EACb,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAMhB,MAAM,MAAM,uBAAuB,GAAG;IACpC,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,SAAS,CAAC,EAAE,SAAS,CAAA;KACtB,CAAA;CACF,CAAA;AAED,KAAK,KAAK,GAAG;IACX,OAAO,EAAE;QACP,oBAAoB,EAAE,oBAAoB,CAAA;QAC1C,cAAc,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,YAAY,CAAC,EAAE,GAAG,CAAA;QAClB,KAAK,EAAE,aAAa,CAAA;QACpB,cAAc,EAAE,cAAc,CAAA;QAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACpB,sBAAsB,EAAE,MAAM,CAAA;QAC9B,SAAS,EAAE,SAAS,CAAA;QACpB,WAAW,CAAC,EAAE,yBAAyB,CAAA;QACvC,WAAW,EAAE,mBAAmB,CAAA;QAChC,eAAe,EAAE,iBAAiB,CAAA;QAClC,aAAa,EAAE,GAAG,CAAA;QAClB,GAAG,EAAE,cAAc,CAAA;KACpB,CAAA;IACD,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;CAClC,CAAA;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,YAAY,EAAE,oBAAoB,EAClC,QAAQ,GACT,EAAE,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA4D1C"}
1
+ {"version":3,"file":"buildInitialState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildInitialState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,SAAS,EACT,cAAc,EACd,aAAa,EACb,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAMhB,MAAM,MAAM,uBAAuB,GAAG;IACpC,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,SAAS,CAAC,EAAE,SAAS,CAAA;QACrB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACF,CAAA;AAED,KAAK,KAAK,GAAG;IACX,OAAO,EAAE;QACP,oBAAoB,EAAE,oBAAoB,CAAA;QAC1C,cAAc,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,YAAY,CAAC,EAAE,GAAG,CAAA;QAClB,KAAK,EAAE,aAAa,CAAA;QACpB,cAAc,EAAE,cAAc,CAAA;QAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACpB,sBAAsB,EAAE,MAAM,CAAA;QAC9B,SAAS,EAAE,cAAc,CAAA;QACzB,WAAW,CAAC,EAAE,yBAAyB,CAAA;QACvC,WAAW,EAAE,mBAAmB,CAAA;QAChC,eAAe,EAAE,iBAAiB,CAAA;QAClC,aAAa,EAAE,GAAG,CAAA;QAClB,GAAG,EAAE,cAAc,CAAA;KACpB,CAAA;IACD,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;CAClC,CAAA;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,YAAY,EAAE,oBAAoB,EAClC,QAAQ,GACT,EAAE,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA6D1C"}
@@ -43,6 +43,7 @@ export async function buildInitialState({
43
43
  initialState[id] = {};
44
44
  }
45
45
  initialState[id].formState = formStateResult;
46
+ initialState[id].schemaPath = schemaFieldsPath;
46
47
  if (node.type === 'block') {
47
48
  const currentFieldPreferences = context.preferences?.fields?.[context.field.name];
48
49
  const collapsedArray = currentFieldPreferences?.collapsed;
@@ -1 +1 @@
1
- {"version":3,"file":"buildInitialState.js","names":["fieldSchemasToFormState","buildInitialState","context","initialState","initialStateFromArgs","nodeData","node","children","type","blockNode","id","fields","schemaFieldsPath","lexicalFieldSchemaPath","blockType","formStateResult","clientFieldSchemaMap","collectionSlug","data","documentData","fieldSchemaMap","get","initialBlockData","operation","permissions","preferences","readOnly","disabled","renderAllFields","renderFieldFn","req","schemaPath","formState","currentFieldPreferences","field","name","collapsedArray","collapsed","Array","isArray","includes"],"sources":["../../src/utilities/buildInitialState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n ClientFieldSchemaMap,\n ComponentRenderer,\n DocumentPreferences,\n FieldSchemaMap,\n FormState,\n Operation,\n PayloadRequest,\n RichTextField,\n SanitizedFieldPermissions,\n} from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { SerializedBlockNode } from '../types/nodeTypes.js'\n\nexport type InitialLexicalFormState = {\n [nodeID: string]: {\n [key: string]: any\n formState?: FormState\n }\n}\n\ntype Props = {\n context: {\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n disabled?: boolean\n documentData?: any\n field: RichTextField\n fieldSchemaMap: FieldSchemaMap\n id?: number | string\n lexicalFieldSchemaPath: string\n operation: Operation\n permissions?: SanitizedFieldPermissions\n preferences: DocumentPreferences\n renderComponent: ComponentRenderer\n renderFieldFn: any\n req: PayloadRequest\n }\n initialState?: InitialLexicalFormState\n nodeData: SerializedLexicalNode[]\n}\n\nexport async function buildInitialState({\n context,\n initialState: initialStateFromArgs,\n nodeData,\n}: Props): Promise<InitialLexicalFormState> {\n let initialState: InitialLexicalFormState = initialStateFromArgs ?? {}\n for (const node of nodeData) {\n if ('children' in node) {\n initialState = await buildInitialState({\n context,\n initialState,\n nodeData: node.children as SerializedLexicalNode[],\n })\n }\n\n if (node.type === 'block' || node.type === 'inlineBlock') {\n const blockNode = node as SerializedBlockNode\n const id = blockNode?.fields?.id\n if (!id) {\n continue\n }\n\n const schemaFieldsPath =\n node.type === 'block'\n ? `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockNode.fields.blockType}.fields`\n : `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockNode.fields.blockType}.fields`\n\n // Build form state for the block\n\n const formStateResult = await fieldSchemasToFormState({\n id: context.id,\n clientFieldSchemaMap: context.clientFieldSchemaMap,\n collectionSlug: context.collectionSlug,\n data: blockNode.fields,\n documentData: context.documentData,\n fields: (context.fieldSchemaMap.get(schemaFieldsPath) as any)?.fields,\n fieldSchemaMap: context.fieldSchemaMap,\n initialBlockData: blockNode.fields,\n operation: context.operation as any, // TODO: Type\n permissions: true,\n preferences: context.preferences,\n readOnly: context.disabled,\n renderAllFields: true, // If this function runs, the parent lexical field is being re-rendered => thus we can assume all its sub-fields need to be re-rendered\n renderFieldFn: context.renderFieldFn,\n req: context.req,\n schemaPath: schemaFieldsPath,\n })\n\n if (!initialState[id]) {\n initialState[id] = {}\n }\n\n initialState[id].formState = formStateResult\n\n if (node.type === 'block') {\n const currentFieldPreferences = context.preferences?.fields?.[context.field.name]\n const collapsedArray = currentFieldPreferences?.collapsed\n if (Array.isArray(collapsedArray) && collapsedArray.includes(id)) {\n initialState[id].collapsed = true\n }\n }\n }\n }\n return initialState\n}\n"],"mappings":"AAaA,SAASA,uBAAuB,QAAQ;AAgCxC,OAAO,eAAeC,kBAAkB;EACtCC,OAAO;EACPC,YAAA,EAAcC,oBAAoB;EAClCC;AAAQ,CACF;EACN,IAAIF,YAAA,GAAwCC,oBAAA,IAAwB,CAAC;EACrE,KAAK,MAAME,IAAA,IAAQD,QAAA,EAAU;IAC3B,IAAI,cAAcC,IAAA,EAAM;MACtBH,YAAA,GAAe,MAAMF,iBAAA,CAAkB;QACrCC,OAAA;QACAC,YAAA;QACAE,QAAA,EAAUC,IAAA,CAAKC;MACjB;IACF;IAEA,IAAID,IAAA,CAAKE,IAAI,KAAK,WAAWF,IAAA,CAAKE,IAAI,KAAK,eAAe;MACxD,MAAMC,SAAA,GAAYH,IAAA;MAClB,MAAMI,EAAA,GAAKD,SAAA,EAAWE,MAAA,EAAQD,EAAA;MAC9B,IAAI,CAACA,EAAA,EAAI;QACP;MACF;MAEA,MAAME,gBAAA,GACJN,IAAA,CAAKE,IAAI,KAAK,UACV,GAAGN,OAAA,CAAQW,sBAAsB,mDAAmDJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS,GACvH,GAAGZ,OAAA,CAAQW,sBAAsB,0DAA0DJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS;MAEpI;MAEA,MAAMC,eAAA,GAAkB,MAAMf,uBAAA,CAAwB;QACpDU,EAAA,EAAIR,OAAA,CAAQQ,EAAE;QACdM,oBAAA,EAAsBd,OAAA,CAAQc,oBAAoB;QAClDC,cAAA,EAAgBf,OAAA,CAAQe,cAAc;QACtCC,IAAA,EAAMT,SAAA,CAAUE,MAAM;QACtBQ,YAAA,EAAcjB,OAAA,CAAQiB,YAAY;QAClCR,MAAA,EAAST,OAAA,CAAQkB,cAAc,CAACC,GAAG,CAACT,gBAAA,GAA2BD,MAAA;QAC/DS,cAAA,EAAgBlB,OAAA,CAAQkB,cAAc;QACtCE,gBAAA,EAAkBb,SAAA,CAAUE,MAAM;QAClCY,SAAA,EAAWrB,OAAA,CAAQqB,SAAS;QAC5BC,WAAA,EAAa;QACbC,WAAA,EAAavB,OAAA,CAAQuB,WAAW;QAChCC,QAAA,EAAUxB,OAAA,CAAQyB,QAAQ;QAC1BC,eAAA,EAAiB;QACjBC,aAAA,EAAe3B,OAAA,CAAQ2B,aAAa;QACpCC,GAAA,EAAK5B,OAAA,CAAQ4B,GAAG;QAChBC,UAAA,EAAYnB;MACd;MAEA,IAAI,CAACT,YAAY,CAACO,EAAA,CAAG,EAAE;QACrBP,YAAY,CAACO,EAAA,CAAG,GAAG,CAAC;MACtB;MAEAP,YAAY,CAACO,EAAA,CAAG,CAACsB,SAAS,GAAGjB,eAAA;MAE7B,IAAIT,IAAA,CAAKE,IAAI,KAAK,SAAS;QACzB,MAAMyB,uBAAA,GAA0B/B,OAAA,CAAQuB,WAAW,EAAEd,MAAA,GAAST,OAAA,CAAQgC,KAAK,CAACC,IAAI,CAAC;QACjF,MAAMC,cAAA,GAAiBH,uBAAA,EAAyBI,SAAA;QAChD,IAAIC,KAAA,CAAMC,OAAO,CAACH,cAAA,KAAmBA,cAAA,CAAeI,QAAQ,CAAC9B,EAAA,GAAK;UAChEP,YAAY,CAACO,EAAA,CAAG,CAAC2B,SAAS,GAAG;QAC/B;MACF;IACF;EACF;EACA,OAAOlC,YAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"buildInitialState.js","names":["fieldSchemasToFormState","buildInitialState","context","initialState","initialStateFromArgs","nodeData","node","children","type","blockNode","id","fields","schemaFieldsPath","lexicalFieldSchemaPath","blockType","formStateResult","clientFieldSchemaMap","collectionSlug","data","documentData","fieldSchemaMap","get","initialBlockData","operation","permissions","preferences","readOnly","disabled","renderAllFields","renderFieldFn","req","schemaPath","formState","currentFieldPreferences","field","name","collapsedArray","collapsed","Array","isArray","includes"],"sources":["../../src/utilities/buildInitialState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n ClientFieldSchemaMap,\n ComponentRenderer,\n DocumentPreferences,\n FieldOperation,\n FieldSchemaMap,\n FormState,\n PayloadRequest,\n RichTextField,\n SanitizedFieldPermissions,\n} from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { SerializedBlockNode } from '../types/nodeTypes.js'\n\nexport type InitialLexicalFormState = {\n [nodeID: string]: {\n [key: string]: any\n formState?: FormState\n schemaPath?: string\n }\n}\n\ntype Props = {\n context: {\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n disabled?: boolean\n documentData?: any\n field: RichTextField\n fieldSchemaMap: FieldSchemaMap\n id?: number | string\n lexicalFieldSchemaPath: string\n operation: FieldOperation\n permissions?: SanitizedFieldPermissions\n preferences: DocumentPreferences\n renderComponent: ComponentRenderer\n renderFieldFn: any\n req: PayloadRequest\n }\n initialState?: InitialLexicalFormState\n nodeData: SerializedLexicalNode[]\n}\n\nexport async function buildInitialState({\n context,\n initialState: initialStateFromArgs,\n nodeData,\n}: Props): Promise<InitialLexicalFormState> {\n let initialState: InitialLexicalFormState = initialStateFromArgs ?? {}\n for (const node of nodeData) {\n if ('children' in node) {\n initialState = await buildInitialState({\n context,\n initialState,\n nodeData: node.children as SerializedLexicalNode[],\n })\n }\n\n if (node.type === 'block' || node.type === 'inlineBlock') {\n const blockNode = node as SerializedBlockNode\n const id = blockNode?.fields?.id\n if (!id) {\n continue\n }\n\n const schemaFieldsPath =\n node.type === 'block'\n ? `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockNode.fields.blockType}.fields`\n : `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockNode.fields.blockType}.fields`\n\n // Build form state for the block\n\n const formStateResult = await fieldSchemasToFormState({\n id: context.id,\n clientFieldSchemaMap: context.clientFieldSchemaMap,\n collectionSlug: context.collectionSlug,\n data: blockNode.fields,\n documentData: context.documentData,\n fields: (context.fieldSchemaMap.get(schemaFieldsPath) as any)?.fields,\n fieldSchemaMap: context.fieldSchemaMap,\n initialBlockData: blockNode.fields,\n operation: context.operation,\n permissions: true,\n preferences: context.preferences,\n readOnly: context.disabled,\n renderAllFields: true, // If this function runs, the parent lexical field is being re-rendered => thus we can assume all its sub-fields need to be re-rendered\n renderFieldFn: context.renderFieldFn,\n req: context.req,\n schemaPath: schemaFieldsPath,\n })\n\n if (!initialState[id]) {\n initialState[id] = {}\n }\n\n initialState[id].formState = formStateResult\n initialState[id].schemaPath = schemaFieldsPath\n\n if (node.type === 'block') {\n const currentFieldPreferences = context.preferences?.fields?.[context.field.name]\n const collapsedArray = currentFieldPreferences?.collapsed\n if (Array.isArray(collapsedArray) && collapsedArray.includes(id)) {\n initialState[id].collapsed = true\n }\n }\n }\n }\n return initialState\n}\n"],"mappings":"AAaA,SAASA,uBAAuB,QAAQ;AAiCxC,OAAO,eAAeC,kBAAkB;EACtCC,OAAO;EACPC,YAAA,EAAcC,oBAAoB;EAClCC;AAAQ,CACF;EACN,IAAIF,YAAA,GAAwCC,oBAAA,IAAwB,CAAC;EACrE,KAAK,MAAME,IAAA,IAAQD,QAAA,EAAU;IAC3B,IAAI,cAAcC,IAAA,EAAM;MACtBH,YAAA,GAAe,MAAMF,iBAAA,CAAkB;QACrCC,OAAA;QACAC,YAAA;QACAE,QAAA,EAAUC,IAAA,CAAKC;MACjB;IACF;IAEA,IAAID,IAAA,CAAKE,IAAI,KAAK,WAAWF,IAAA,CAAKE,IAAI,KAAK,eAAe;MACxD,MAAMC,SAAA,GAAYH,IAAA;MAClB,MAAMI,EAAA,GAAKD,SAAA,EAAWE,MAAA,EAAQD,EAAA;MAC9B,IAAI,CAACA,EAAA,EAAI;QACP;MACF;MAEA,MAAME,gBAAA,GACJN,IAAA,CAAKE,IAAI,KAAK,UACV,GAAGN,OAAA,CAAQW,sBAAsB,mDAAmDJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS,GACvH,GAAGZ,OAAA,CAAQW,sBAAsB,0DAA0DJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS;MAEpI;MAEA,MAAMC,eAAA,GAAkB,MAAMf,uBAAA,CAAwB;QACpDU,EAAA,EAAIR,OAAA,CAAQQ,EAAE;QACdM,oBAAA,EAAsBd,OAAA,CAAQc,oBAAoB;QAClDC,cAAA,EAAgBf,OAAA,CAAQe,cAAc;QACtCC,IAAA,EAAMT,SAAA,CAAUE,MAAM;QACtBQ,YAAA,EAAcjB,OAAA,CAAQiB,YAAY;QAClCR,MAAA,EAAST,OAAA,CAAQkB,cAAc,CAACC,GAAG,CAACT,gBAAA,GAA2BD,MAAA;QAC/DS,cAAA,EAAgBlB,OAAA,CAAQkB,cAAc;QACtCE,gBAAA,EAAkBb,SAAA,CAAUE,MAAM;QAClCY,SAAA,EAAWrB,OAAA,CAAQqB,SAAS;QAC5BC,WAAA,EAAa;QACbC,WAAA,EAAavB,OAAA,CAAQuB,WAAW;QAChCC,QAAA,EAAUxB,OAAA,CAAQyB,QAAQ;QAC1BC,eAAA,EAAiB;QACjBC,aAAA,EAAe3B,OAAA,CAAQ2B,aAAa;QACpCC,GAAA,EAAK5B,OAAA,CAAQ4B,GAAG;QAChBC,UAAA,EAAYnB;MACd;MAEA,IAAI,CAACT,YAAY,CAACO,EAAA,CAAG,EAAE;QACrBP,YAAY,CAACO,EAAA,CAAG,GAAG,CAAC;MACtB;MAEAP,YAAY,CAACO,EAAA,CAAG,CAACsB,SAAS,GAAGjB,eAAA;MAC7BZ,YAAY,CAACO,EAAA,CAAG,CAACqB,UAAU,GAAGnB,gBAAA;MAE9B,IAAIN,IAAA,CAAKE,IAAI,KAAK,SAAS;QACzB,MAAMyB,uBAAA,GAA0B/B,OAAA,CAAQuB,WAAW,EAAEd,MAAA,GAAST,OAAA,CAAQgC,KAAK,CAACC,IAAI,CAAC;QACjF,MAAMC,cAAA,GAAiBH,uBAAA,EAAyBI,SAAA;QAChD,IAAIC,KAAA,CAAMC,OAAO,CAACH,cAAA,KAAmBA,cAAA,CAAeI,QAAQ,CAAC9B,EAAA,GAAK;UAChEP,YAAY,CAACO,EAAA,CAAG,CAAC2B,SAAS,GAAG;QAC/B;MACF;IACF;EACF;EACA,OAAOlC,YAAA;AACT","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  import type { RichTextAdapter } from 'payload';
2
2
  import type { ResolvedServerFeatureMap } from '../features/typesServer.js';
3
- import type { LexicalEditorProps } from '../types/index.js';
3
+ import type { LexicalEditorArgs } from '../types/index.js';
4
4
  export declare const getGenerateImportMap: (args: {
5
- lexicalEditorArgs?: LexicalEditorProps;
5
+ lexicalEditorArgs?: LexicalEditorArgs;
6
6
  resolvedFeatureMap: ResolvedServerFeatureMap;
7
7
  }) => RichTextAdapter['generateImportMap'];
8
8
  //# sourceMappingURL=generateImportMap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateImportMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateImportMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,eAAO,MAAM,oBAAoB,SACxB;IACL,iBAAiB,CAAC,EAAE,kBAAkB,CAAA;IACtC,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,mBAAmB,CAiDtC,CAAA"}
1
+ {"version":3,"file":"generateImportMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateImportMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,eAAO,MAAM,oBAAoB,SACxB;IACL,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,mBAAmB,CAiDtC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"generateImportMap.js","names":["genImportMapIterateFields","getGenerateImportMap","args","addToImportMap","baseDir","config","importMap","imports","lexicalEditorArgs","views","resolvedFeature","resolvedFeatureMap","values","componentImports","Array","isArray","Object","ClientFeature","nodes","length","node","getSubFields","subFields","fields"],"sources":["../../src/utilities/generateImportMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { genImportMapIterateFields } from 'payload'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { LexicalEditorProps } from '../types/index.js'\n\nexport const getGenerateImportMap =\n (args: {\n lexicalEditorArgs?: LexicalEditorProps\n resolvedFeatureMap: ResolvedServerFeatureMap\n }): RichTextAdapter['generateImportMap'] =>\n ({ addToImportMap, baseDir, config, importMap, imports }) => {\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell')\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField')\n addToImportMap('@payloadcms/richtext-lexical/rsc#LexicalDiffComponent')\n\n addToImportMap(args.lexicalEditorArgs?.views)\n\n for (const resolvedFeature of args.resolvedFeatureMap.values()) {\n if ('componentImports' in resolvedFeature) {\n if (typeof resolvedFeature.componentImports === 'function') {\n resolvedFeature.componentImports({\n addToImportMap,\n baseDir,\n config,\n importMap,\n imports,\n })\n } else if (Array.isArray(resolvedFeature.componentImports)) {\n addToImportMap(resolvedFeature.componentImports)\n } else if (typeof resolvedFeature.componentImports === 'object') {\n addToImportMap(Object.values(resolvedFeature.componentImports))\n }\n }\n\n addToImportMap(resolvedFeature.ClientFeature)\n\n /*\n * Now run for all possible sub-fields\n */\n if (resolvedFeature.nodes?.length) {\n for (const node of resolvedFeature.nodes) {\n if (typeof node?.getSubFields !== 'function') {\n continue\n }\n const subFields = node.getSubFields({})\n if (subFields?.length) {\n genImportMapIterateFields({\n addToImportMap,\n baseDir,\n config,\n fields: subFields,\n importMap,\n imports,\n })\n }\n }\n }\n }\n }\n"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ;AAK1C,OAAO,MAAMC,oBAAA,GACVC,IAAA,IAID,CAAC;EAAEC,cAAc;EAAEC,OAAO;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAO,CAAE;EACtDJ,cAAA,CAAe;EACfA,cAAA,CAAe;EACfA,cAAA,CAAe;EAEfA,cAAA,CAAeD,IAAA,CAAKM,iBAAiB,EAAEC,KAAA;EAEvC,KAAK,MAAMC,eAAA,IAAmBR,IAAA,CAAKS,kBAAkB,CAACC,MAAM,IAAI;IAC9D,IAAI,sBAAsBF,eAAA,EAAiB;MACzC,IAAI,OAAOA,eAAA,CAAgBG,gBAAgB,KAAK,YAAY;QAC1DH,eAAA,CAAgBG,gBAAgB,CAAC;UAC/BV,cAAA;UACAC,OAAA;UACAC,MAAA;UACAC,SAAA;UACAC;QACF;MACF,OAAO,IAAIO,KAAA,CAAMC,OAAO,CAACL,eAAA,CAAgBG,gBAAgB,GAAG;QAC1DV,cAAA,CAAeO,eAAA,CAAgBG,gBAAgB;MACjD,OAAO,IAAI,OAAOH,eAAA,CAAgBG,gBAAgB,KAAK,UAAU;QAC/DV,cAAA,CAAea,MAAA,CAAOJ,MAAM,CAACF,eAAA,CAAgBG,gBAAgB;MAC/D;IACF;IAEAV,cAAA,CAAeO,eAAA,CAAgBO,aAAa;IAE5C;;;IAGA,IAAIP,eAAA,CAAgBQ,KAAK,EAAEC,MAAA,EAAQ;MACjC,KAAK,MAAMC,IAAA,IAAQV,eAAA,CAAgBQ,KAAK,EAAE;QACxC,IAAI,OAAOE,IAAA,EAAMC,YAAA,KAAiB,YAAY;UAC5C;QACF;QACA,MAAMC,SAAA,GAAYF,IAAA,CAAKC,YAAY,CAAC,CAAC;QACrC,IAAIC,SAAA,EAAWH,MAAA,EAAQ;UACrBnB,yBAAA,CAA0B;YACxBG,cAAA;YACAC,OAAA;YACAC,MAAA;YACAkB,MAAA,EAAQD,SAAA;YACRhB,SAAA;YACAC;UACF;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"generateImportMap.js","names":["genImportMapIterateFields","getGenerateImportMap","args","addToImportMap","baseDir","config","importMap","imports","lexicalEditorArgs","views","resolvedFeature","resolvedFeatureMap","values","componentImports","Array","isArray","Object","ClientFeature","nodes","length","node","getSubFields","subFields","fields"],"sources":["../../src/utilities/generateImportMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { genImportMapIterateFields } from 'payload'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { LexicalEditorArgs } from '../types/index.js'\n\nexport const getGenerateImportMap =\n (args: {\n lexicalEditorArgs?: LexicalEditorArgs\n resolvedFeatureMap: ResolvedServerFeatureMap\n }): RichTextAdapter['generateImportMap'] =>\n ({ addToImportMap, baseDir, config, importMap, imports }) => {\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell')\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField')\n addToImportMap('@payloadcms/richtext-lexical/rsc#LexicalDiffComponent')\n\n addToImportMap(args.lexicalEditorArgs?.views)\n\n for (const resolvedFeature of args.resolvedFeatureMap.values()) {\n if ('componentImports' in resolvedFeature) {\n if (typeof resolvedFeature.componentImports === 'function') {\n resolvedFeature.componentImports({\n addToImportMap,\n baseDir,\n config,\n importMap,\n imports,\n })\n } else if (Array.isArray(resolvedFeature.componentImports)) {\n addToImportMap(resolvedFeature.componentImports)\n } else if (typeof resolvedFeature.componentImports === 'object') {\n addToImportMap(Object.values(resolvedFeature.componentImports))\n }\n }\n\n addToImportMap(resolvedFeature.ClientFeature)\n\n /*\n * Now run for all possible sub-fields\n */\n if (resolvedFeature.nodes?.length) {\n for (const node of resolvedFeature.nodes) {\n if (typeof node?.getSubFields !== 'function') {\n continue\n }\n const subFields = node.getSubFields({})\n if (subFields?.length) {\n genImportMapIterateFields({\n addToImportMap,\n baseDir,\n config,\n fields: subFields,\n importMap,\n imports,\n })\n }\n }\n }\n }\n }\n"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ;AAK1C,OAAO,MAAMC,oBAAA,GACVC,IAAA,IAID,CAAC;EAAEC,cAAc;EAAEC,OAAO;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAO,CAAE;EACtDJ,cAAA,CAAe;EACfA,cAAA,CAAe;EACfA,cAAA,CAAe;EAEfA,cAAA,CAAeD,IAAA,CAAKM,iBAAiB,EAAEC,KAAA;EAEvC,KAAK,MAAMC,eAAA,IAAmBR,IAAA,CAAKS,kBAAkB,CAACC,MAAM,IAAI;IAC9D,IAAI,sBAAsBF,eAAA,EAAiB;MACzC,IAAI,OAAOA,eAAA,CAAgBG,gBAAgB,KAAK,YAAY;QAC1DH,eAAA,CAAgBG,gBAAgB,CAAC;UAC/BV,cAAA;UACAC,OAAA;UACAC,MAAA;UACAC,SAAA;UACAC;QACF;MACF,OAAO,IAAIO,KAAA,CAAMC,OAAO,CAACL,eAAA,CAAgBG,gBAAgB,GAAG;QAC1DV,cAAA,CAAeO,eAAA,CAAgBG,gBAAgB;MACjD,OAAO,IAAI,OAAOH,eAAA,CAAgBG,gBAAgB,KAAK,UAAU;QAC/DV,cAAA,CAAea,MAAA,CAAOJ,MAAM,CAACF,eAAA,CAAgBG,gBAAgB;MAC/D;IACF;IAEAV,cAAA,CAAeO,eAAA,CAAgBO,aAAa;IAE5C;;;IAGA,IAAIP,eAAA,CAAgBQ,KAAK,EAAEC,MAAA,EAAQ;MACjC,KAAK,MAAMC,IAAA,IAAQV,eAAA,CAAgBQ,KAAK,EAAE;QACxC,IAAI,OAAOE,IAAA,EAAMC,YAAA,KAAiB,YAAY;UAC5C;QACF;QACA,MAAMC,SAAA,GAAYF,IAAA,CAAKC,YAAY,CAAC,CAAC;QACrC,IAAIC,SAAA,EAAWH,MAAA,EAAQ;UACrBnB,yBAAA,CAA0B;YACxBG,cAAA;YACAC,OAAA;YACAC,MAAA;YACAkB,MAAA,EAAQD,SAAA;YACRhB,SAAA;YACAC;UACF;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
@@ -54,7 +54,8 @@ async function upgradeGlobal({
54
54
  slug: global.slug,
55
55
  data: document,
56
56
  depth: 0,
57
- locale: locale || undefined
57
+ locale: locale || undefined,
58
+ overrideAccess: true
58
59
  });
59
60
  }
60
61
  }
@@ -68,7 +69,8 @@ async function upgradeCollection({
68
69
  console.log(`Lexical Upgrade: ${locale}: Upgrading collection:`, collection.slug, '(' + cur + '/' + max + ')');
69
70
  const documentCount = (await payload.count({
70
71
  collection: collection.slug,
71
- locale: locale || undefined
72
+ locale: locale || undefined,
73
+ overrideAccess: true
72
74
  })).totalDocs;
73
75
  let page = 1;
74
76
  let upgraded = 0;
@@ -95,7 +97,8 @@ async function upgradeCollection({
95
97
  collection: collection.slug,
96
98
  data: document,
97
99
  depth: 0,
98
- locale: locale || undefined
100
+ locale: locale || undefined,
101
+ overrideAccess: true
99
102
  });
100
103
  }
101
104
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["upgradeDocumentFieldsRecursively","upgradeLexicalData","payload","collections","config","allLocales","localization","localeCodes","totalCollections","length","locale","curCollection","collection","upgradeCollection","cur","max","global","globals","upgradeGlobal","console","log","slug","document","findGlobal","depth","undefined","overrideAccess","found","upgradeDocument","fields","updateGlobal","data","documentCount","count","totalDocs","page","upgraded","documents","find","pagination","docs","id","update"],"sources":["../../../src/utilities/upgradeLexicalData/index.ts"],"sourcesContent":["import type { CollectionConfig, Field, GlobalConfig, Payload } from 'payload'\n\nimport { upgradeDocumentFieldsRecursively } from './upgradeDocumentFieldsRecursively.js'\n\n/**\n * This goes through every single document in your payload app and re-saves it, if it has a lexical editor.\n * This way, the data is automatically converted to the new format, and that automatic conversion gets applied to every single document in your app.\n *\n * @param payload\n */\nexport async function upgradeLexicalData({ payload }: { payload: Payload }) {\n const collections = payload.config.collections\n\n const allLocales = payload.config.localization ? payload.config.localization.localeCodes : [null]\n\n const totalCollections = collections.length\n for (const locale of allLocales) {\n let curCollection = 0\n for (const collection of collections) {\n curCollection++\n await upgradeCollection({\n collection,\n cur: curCollection,\n locale,\n max: totalCollections,\n payload,\n })\n }\n for (const global of payload.config.globals) {\n await upgradeGlobal({\n global,\n locale,\n payload,\n })\n }\n }\n}\n\nasync function upgradeGlobal({\n global,\n locale,\n payload,\n}: {\n global: GlobalConfig\n locale: null | string\n payload: Payload\n}) {\n console.log(`Lexical Upgrader: ${locale}: Upgrading global:`, global.slug)\n\n const document = await payload.findGlobal({\n slug: global.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n })\n\n const found = upgradeDocument({\n document,\n fields: global.fields,\n payload,\n })\n\n if (found) {\n await payload.updateGlobal({\n slug: global.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n })\n }\n}\n\nasync function upgradeCollection({\n collection,\n cur,\n locale,\n max,\n payload,\n}: {\n collection: CollectionConfig\n cur: number\n locale: null | string\n max: number\n payload: Payload\n}) {\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' + cur + '/' + max + ')',\n )\n\n const documentCount = (\n await payload.count({\n collection: collection.slug,\n locale: locale || undefined,\n })\n ).totalDocs\n\n let page = 1\n let upgraded = 0\n\n while (upgraded < documentCount) {\n const documents = await payload.find({\n collection: collection.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n page,\n pagination: true,\n })\n\n for (const document of documents.docs) {\n upgraded++\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' +\n cur +\n '/' +\n max +\n ') - Upgrading Document: ' +\n document.id +\n ' (' +\n upgraded +\n '/' +\n documentCount +\n ')',\n )\n const found = upgradeDocument({\n document,\n fields: collection.fields,\n payload,\n })\n\n if (found) {\n await payload.update({\n id: document.id,\n collection: collection.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n })\n }\n }\n page++\n }\n}\n\nfunction upgradeDocument({\n document,\n fields,\n payload,\n}: {\n document: Record<string, unknown>\n fields: Field[]\n payload: Payload\n}): boolean {\n return !!upgradeDocumentFieldsRecursively({\n data: document,\n fields,\n found: 0,\n payload,\n })\n}\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["upgradeDocumentFieldsRecursively","upgradeLexicalData","payload","collections","config","allLocales","localization","localeCodes","totalCollections","length","locale","curCollection","collection","upgradeCollection","cur","max","global","globals","upgradeGlobal","console","log","slug","document","findGlobal","depth","undefined","overrideAccess","found","upgradeDocument","fields","updateGlobal","data","documentCount","count","totalDocs","page","upgraded","documents","find","pagination","docs","id","update"],"sources":["../../../src/utilities/upgradeLexicalData/index.ts"],"sourcesContent":["import type { CollectionConfig, Field, GlobalConfig, Payload } from 'payload'\n\nimport { upgradeDocumentFieldsRecursively } from './upgradeDocumentFieldsRecursively.js'\n\n/**\n * This goes through every single document in your payload app and re-saves it, if it has a lexical editor.\n * This way, the data is automatically converted to the new format, and that automatic conversion gets applied to every single document in your app.\n *\n * @param payload\n */\nexport async function upgradeLexicalData({ payload }: { payload: Payload }) {\n const collections = payload.config.collections\n\n const allLocales = payload.config.localization ? payload.config.localization.localeCodes : [null]\n\n const totalCollections = collections.length\n for (const locale of allLocales) {\n let curCollection = 0\n for (const collection of collections) {\n curCollection++\n await upgradeCollection({\n collection,\n cur: curCollection,\n locale,\n max: totalCollections,\n payload,\n })\n }\n for (const global of payload.config.globals) {\n await upgradeGlobal({\n global,\n locale,\n payload,\n })\n }\n }\n}\n\nasync function upgradeGlobal({\n global,\n locale,\n payload,\n}: {\n global: GlobalConfig\n locale: null | string\n payload: Payload\n}) {\n console.log(`Lexical Upgrader: ${locale}: Upgrading global:`, global.slug)\n\n const document = await payload.findGlobal({\n slug: global.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n })\n\n const found = upgradeDocument({\n document,\n fields: global.fields,\n payload,\n })\n\n if (found) {\n await payload.updateGlobal({\n slug: global.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n })\n }\n}\n\nasync function upgradeCollection({\n collection,\n cur,\n locale,\n max,\n payload,\n}: {\n collection: CollectionConfig\n cur: number\n locale: null | string\n max: number\n payload: Payload\n}) {\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' + cur + '/' + max + ')',\n )\n\n const documentCount = (\n await payload.count({\n collection: collection.slug,\n locale: locale || undefined,\n overrideAccess: true,\n })\n ).totalDocs\n\n let page = 1\n let upgraded = 0\n\n while (upgraded < documentCount) {\n const documents = await payload.find({\n collection: collection.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n page,\n pagination: true,\n })\n\n for (const document of documents.docs) {\n upgraded++\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' +\n cur +\n '/' +\n max +\n ') - Upgrading Document: ' +\n document.id +\n ' (' +\n upgraded +\n '/' +\n documentCount +\n ')',\n )\n const found = upgradeDocument({\n document,\n fields: collection.fields,\n payload,\n })\n\n if (found) {\n await payload.update({\n id: document.id,\n collection: collection.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n })\n }\n }\n page++\n }\n}\n\nfunction upgradeDocument({\n document,\n fields,\n payload,\n}: {\n document: Record<string, unknown>\n fields: Field[]\n payload: Payload\n}): boolean {\n return !!upgradeDocumentFieldsRecursively({\n data: document,\n fields,\n found: 0,\n payload,\n })\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1,8 +1,8 @@
1
- import type { SerializedEditorState, SerializedLexicalNode } from 'lexical';
1
+ import type { SerializedEditorState } from 'lexical';
2
2
  /**
3
3
  * This function checks if the editor state is empty (has any text). If the editor state has no nodes,
4
4
  * or only an empty paragraph node (no TextNode with length > 0), it returns false.
5
5
  * Otherwise, it returns true.
6
6
  */
7
- export declare function hasText(value: null | SerializedEditorState<SerializedLexicalNode> | undefined): value is SerializedEditorState<SerializedLexicalNode>;
7
+ export declare function hasText(value: null | SerializedEditorState | undefined): value is SerializedEditorState;
8
8
  //# sourceMappingURL=hasText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hasText.d.ts","sourceRoot":"","sources":["../../src/validate/hasText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EAGtB,MAAM,SAAS,CAAA;AAEhB;;;;GAIG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,IAAI,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,GAAG,SAAS,GACrE,KAAK,IAAI,qBAAqB,CAAC,qBAAqB,CAAC,CA6BvD"}
1
+ {"version":3,"file":"hasText.d.ts","sourceRoot":"","sources":["../../src/validate/hasText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAA+C,MAAM,SAAS,CAAA;AAEjG;;;;GAIG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,IAAI,GAAG,qBAAqB,GAAG,SAAS,GAC9C,KAAK,IAAI,qBAAqB,CA6BhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"hasText.js","names":["hasText","value","hasChildren","root","children","length","hasOnlyEmptyParagraph","type","paragraphNode","paragraphNodeChild"],"sources":["../../src/validate/hasText.ts"],"sourcesContent":["import type {\n SerializedEditorState,\n SerializedLexicalNode,\n SerializedParagraphNode,\n SerializedTextNode,\n} from 'lexical'\n\n/**\n * This function checks if the editor state is empty (has any text). If the editor state has no nodes,\n * or only an empty paragraph node (no TextNode with length > 0), it returns false.\n * Otherwise, it returns true.\n */\nexport function hasText(\n value: null | SerializedEditorState<SerializedLexicalNode> | undefined,\n): value is SerializedEditorState<SerializedLexicalNode> {\n const hasChildren = !!value?.root?.children?.length\n if (!hasChildren) {\n return false\n }\n\n let hasOnlyEmptyParagraph = false\n if (value?.root?.children?.length === 1) {\n if (value?.root?.children[0]?.type === 'paragraph') {\n const paragraphNode = value?.root?.children[0] as SerializedParagraphNode\n\n if (!paragraphNode?.children || paragraphNode?.children?.length === 0) {\n hasOnlyEmptyParagraph = true\n } else if (paragraphNode?.children?.length === 1) {\n const paragraphNodeChild = paragraphNode?.children[0]\n if (paragraphNodeChild?.type === 'text') {\n if (!(paragraphNodeChild as SerializedTextNode | undefined)?.['text']?.length) {\n hasOnlyEmptyParagraph = true\n }\n }\n }\n }\n }\n\n if (hasOnlyEmptyParagraph) {\n return false\n }\n\n return true\n}\n"],"mappings":"AAOA;;;;GAKA,OAAO,SAASA,QACdC,KAAsE;EAEtE,MAAMC,WAAA,GAAc,CAAC,CAACD,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA;EAC7C,IAAI,CAACH,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,IAAII,qBAAA,GAAwB;EAC5B,IAAIL,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA,KAAW,GAAG;IACvC,IAAIJ,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE,EAAEG,IAAA,KAAS,aAAa;MAClD,MAAMC,aAAA,GAAgBP,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE;MAE9C,IAAI,CAACI,aAAA,EAAeJ,QAAA,IAAYI,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QACrEC,qBAAA,GAAwB;MAC1B,OAAO,IAAIE,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QAChD,MAAMI,kBAAA,GAAqBD,aAAA,EAAeJ,QAAQ,CAAC,EAAE;QACrD,IAAIK,kBAAA,EAAoBF,IAAA,KAAS,QAAQ;UACvC,IAAI,CAAEE,kBAAA,GAAwD,OAAO,EAAEJ,MAAA,EAAQ;YAC7EC,qBAAA,GAAwB;UAC1B;QACF;MACF;IACF;EACF;EAEA,IAAIA,qBAAA,EAAuB;IACzB,OAAO;EACT;EAEA,OAAO;AACT","ignoreList":[]}
1
+ {"version":3,"file":"hasText.js","names":["hasText","value","hasChildren","root","children","length","hasOnlyEmptyParagraph","type","paragraphNode","paragraphNodeChild"],"sources":["../../src/validate/hasText.ts"],"sourcesContent":["import type { SerializedEditorState, SerializedParagraphNode, SerializedTextNode } from 'lexical'\n\n/**\n * This function checks if the editor state is empty (has any text). If the editor state has no nodes,\n * or only an empty paragraph node (no TextNode with length > 0), it returns false.\n * Otherwise, it returns true.\n */\nexport function hasText(\n value: null | SerializedEditorState | undefined,\n): value is SerializedEditorState {\n const hasChildren = !!value?.root?.children?.length\n if (!hasChildren) {\n return false\n }\n\n let hasOnlyEmptyParagraph = false\n if (value?.root?.children?.length === 1) {\n if (value?.root?.children[0]?.type === 'paragraph') {\n const paragraphNode = value?.root?.children[0] as SerializedParagraphNode\n\n if (!paragraphNode?.children || paragraphNode?.children?.length === 0) {\n hasOnlyEmptyParagraph = true\n } else if (paragraphNode?.children?.length === 1) {\n const paragraphNodeChild = paragraphNode?.children[0]\n if (paragraphNodeChild?.type === 'text') {\n if (!(paragraphNodeChild as SerializedTextNode | undefined)?.['text']?.length) {\n hasOnlyEmptyParagraph = true\n }\n }\n }\n }\n }\n\n if (hasOnlyEmptyParagraph) {\n return false\n }\n\n return true\n}\n"],"mappings":"AAEA;;;;GAKA,OAAO,SAASA,QACdC,KAA+C;EAE/C,MAAMC,WAAA,GAAc,CAAC,CAACD,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA;EAC7C,IAAI,CAACH,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,IAAII,qBAAA,GAAwB;EAC5B,IAAIL,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA,KAAW,GAAG;IACvC,IAAIJ,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE,EAAEG,IAAA,KAAS,aAAa;MAClD,MAAMC,aAAA,GAAgBP,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE;MAE9C,IAAI,CAACI,aAAA,EAAeJ,QAAA,IAAYI,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QACrEC,qBAAA,GAAwB;MAC1B,OAAO,IAAIE,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QAChD,MAAMI,kBAAA,GAAqBD,aAAA,EAAeJ,QAAQ,CAAC,EAAE;QACrD,IAAIK,kBAAA,EAAoBF,IAAA,KAAS,QAAQ;UACvC,IAAI,CAAEE,kBAAA,GAAwD,OAAO,EAAEJ,MAAA,EAAQ;YAC7EC,qBAAA,GAAwB;UAC1B;QACF;MACF;IACF;EACF;EAEA,IAAIA,qBAAA,EAAuB;IACzB,OAAO;EACT;EAEA,OAAO;AACT","ignoreList":[]}
@@ -3,5 +3,5 @@ import type { RichTextField, Validate } from 'payload';
3
3
  import type { SanitizedServerEditorConfig } from '../lexical/config/types.js';
4
4
  export declare const richTextValidateHOC: ({ editorConfig, }: {
5
5
  editorConfig: SanitizedServerEditorConfig;
6
- }) => Validate<SerializedEditorState<import("lexical").SerializedLexicalNode>, unknown, unknown, RichTextField>;
6
+ }) => Validate<SerializedEditorState, unknown, unknown, RichTextField>;
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEtD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAK7E,eAAO,MAAM,mBAAmB,sBAE7B;IACD,YAAY,EAAE,2BAA2B,CAAA;CAC1C,8GAiCA,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEtD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAK7E,eAAO,MAAM,mBAAmB,sBAE7B;IACD,YAAY,EAAE,2BAA2B,CAAA;CAC1C,qEAiCA,CAAA"}
package/package.json CHANGED
@@ -1,13 +1,8 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "4.0.0-internal.f11981a",
3
+ "version": "4.0.0-internal.f2a04f7",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/payloadcms/payload.git",
9
- "directory": "packages/richtext-lexical"
10
- },
11
6
  "license": "MIT",
12
7
  "author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
13
8
  "maintainers": [
@@ -17,10 +12,20 @@
17
12
  "url": "https://payloadcms.com"
18
13
  }
19
14
  ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/payloadcms/payload.git",
18
+ "directory": "packages/richtext-lexical"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "type": "module",
20
24
  "sideEffects": [
21
25
  "*.css"
22
26
  ],
23
- "type": "module",
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
24
29
  "exports": {
25
30
  ".": {
26
31
  "import": "./dist/index.js",
@@ -403,39 +408,29 @@
403
408
  "default": "./dist/exports/shared.js"
404
409
  }
405
410
  },
406
- "main": "./dist/index.js",
407
- "types": "./dist/index.d.ts",
408
- "files": [
409
- "dist"
410
- ],
411
- "lint-staged": {
412
- "**/package.json": "sort-package-json",
413
- "*.{md,mdx,yml,json}": "prettier --write",
414
- "*.{js,jsx,ts,tsx}": [
415
- "eslint --flag v10_config_lookup_from_file --cache --fix",
416
- "prettier --write"
417
- ]
411
+ "publishConfig": {
412
+ "registry": "https://registry.npmjs.org/"
418
413
  },
419
414
  "dependencies": {
420
- "@lexical/clipboard": "0.48.0",
421
- "@lexical/headless": "0.48.0",
422
- "@lexical/html": "0.48.0",
423
- "@lexical/link": "0.48.0",
424
- "@lexical/list": "0.48.0",
425
- "@lexical/mark": "0.48.0",
426
- "@lexical/markdown": "0.48.0",
427
- "@lexical/react": "0.48.0",
428
- "@lexical/rich-text": "0.48.0",
429
- "@lexical/selection": "0.48.0",
430
- "@lexical/table": "0.48.0",
431
- "@lexical/utils": "0.48.0",
415
+ "@lexical/clipboard": "0.52.0",
416
+ "@lexical/headless": "0.52.0",
417
+ "@lexical/html": "0.52.0",
418
+ "@lexical/link": "0.52.0",
419
+ "@lexical/list": "0.52.0",
420
+ "@lexical/mark": "0.52.0",
421
+ "@lexical/markdown": "0.52.0",
422
+ "@lexical/react": "0.52.0",
423
+ "@lexical/rich-text": "0.52.0",
424
+ "@lexical/selection": "0.52.0",
425
+ "@lexical/table": "0.52.0",
426
+ "@lexical/utils": "0.52.0",
432
427
  "acorn": "8.16.0",
433
428
  "bson-objectid": "2.0.4",
434
429
  "csstype": "3.2.3",
435
430
  "dequal": "2.0.3",
436
431
  "escape-html": "1.0.3",
437
432
  "jsox": "1.2.125",
438
- "lexical": "0.48.0",
433
+ "lexical": "0.52.0",
439
434
  "mdast-util-from-markdown": "2.0.3",
440
435
  "mdast-util-mdx-jsx": "3.2.0",
441
436
  "micromark-extension-mdx-jsx": "3.0.2",
@@ -443,8 +438,8 @@
443
438
  "react-error-boundary": "6.1.1",
444
439
  "ts-essentials": "10.0.3",
445
440
  "uuid": "14.0.0",
446
- "@payloadcms/translations": "4.0.0-internal.f11981a",
447
- "@payloadcms/ui": "4.0.0-internal.f11981a"
441
+ "@payloadcms/ui": "4.0.0-internal.f2a04f7",
442
+ "@payloadcms/translations": "4.0.0-internal.f2a04f7"
448
443
  },
449
444
  "devDependencies": {
450
445
  "@babel/cli": "7.27.2",
@@ -452,33 +447,38 @@
452
447
  "@babel/preset-env": "7.27.2",
453
448
  "@babel/preset-react": "7.27.1",
454
449
  "@babel/preset-typescript": "7.27.1",
455
- "@lexical/eslint-plugin": "0.48.0",
450
+ "@lexical/eslint-plugin": "0.52.0",
456
451
  "@types/escape-html": "1.0.4",
457
452
  "@types/json-schema": "7.0.15",
458
453
  "@types/node": "24.12.3",
459
- "@types/react": "19.2.14",
460
- "@types/react-dom": "19.2.3",
454
+ "@types/react": "19.3.0",
455
+ "@types/react-dom": "19.3.0",
461
456
  "babel-plugin-react-compiler": "19.1.0-rc.3",
462
457
  "babel-plugin-transform-remove-imports": "^1.8.0",
463
458
  "esbuild": "0.27.1",
464
459
  "esbuild-sass-plugin": "3.3.1",
465
460
  "swc-plugin-transform-remove-imports": "8.3.0",
466
461
  "@payloadcms/eslint-config": "3.28.0",
467
- "payload": "4.0.0-internal.f11981a"
462
+ "payload": "4.0.0-internal.f2a04f7"
468
463
  },
469
464
  "peerDependencies": {
470
- "@faceless-ui/modal": "3.0.1",
465
+ "@faceless-ui/modal": "3.0.2",
471
466
  "@faceless-ui/scroll-info": "2.0.0",
472
467
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
473
468
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
474
- "payload": "4.0.0-internal.f11981a"
469
+ "payload": "4.0.0-internal.f2a04f7"
470
+ },
471
+ "lint-staged": {
472
+ "*.{cjs,css,cts,graphql,html,json,jsonc,md,mdx,mjs,mts,scss,toml,yaml,yml}": "oxfmt --no-error-on-unmatched-pattern",
473
+ ".swcrc": "oxfmt --no-error-on-unmatched-pattern",
474
+ "*.{js,jsx,ts,tsx}": [
475
+ "eslint --flag v10_config_lookup_from_file --cache --fix",
476
+ "oxfmt --no-error-on-unmatched-pattern"
477
+ ]
475
478
  },
476
479
  "engines": {
477
480
  "node": ">=24.15.0"
478
481
  },
479
- "publishConfig": {
480
- "registry": "https://registry.npmjs.org/"
481
- },
482
482
  "scripts": {
483
483
  "build": "pnpm build:reactcompiler",
484
484
  "build:babel": "rm -rf dist_optimized && babel dist --out-dir dist_optimized --source-maps --extensions .ts,.js,.tsx,.jsx,.cjs,.mjs && rm -rf dist && mv dist_optimized dist",
@@ -493,8 +493,8 @@
493
493
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
494
494
  "build:without_reactcompiler": "rm -rf dist && rm -rf tsconfig.tsbuildinfo && pnpm copyfiles && pnpm build:types && pnpm build:swc && pnpm build:esbuild && pnpm build:esbuild:postproces && rm -rf dist/exports/client && mv dist/exports/client_unoptimized dist/exports/client",
495
495
  "clean": "rimraf -g {dist,*.tsbuildinfo,esbuild}",
496
- "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
497
- "copyfiles:debug": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
496
+ "copyfiles": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,css,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
497
+ "copyfiles:debug": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
498
498
  "lint": "eslint .",
499
499
  "lint:fix": "eslint . --fix"
500
500
  }
@@ -1,16 +0,0 @@
1
- import { lexicalTargetVersion } from './index';
2
- import { fileURLToPath } from 'url';
3
- import path from 'path';
4
- import fs from 'fs/promises';
5
- import { describe, it, expect } from 'vitest';
6
- const filename = fileURLToPath(import.meta.url);
7
- const dirname = path.dirname(filename);
8
- describe('Lexical dependency checker', () => {
9
- it('ensure lexical version installed in package.json matches dependency checker version', async () => {
10
- const packageJsonString = await fs.readFile(path.resolve(dirname, '../package.json'), 'utf-8');
11
- const packageJson = JSON.parse(packageJsonString);
12
- const packageJsonLexicalVersion = packageJson.dependencies['lexical'];
13
- expect(packageJsonLexicalVersion).toBe(lexicalTargetVersion);
14
- });
15
- });
16
- //# sourceMappingURL=dependencyChecker.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dependencyChecker.spec.js","names":["lexicalTargetVersion","fileURLToPath","path","fs","describe","it","expect","filename","import","meta","url","dirname","packageJsonString","readFile","resolve","packageJson","JSON","parse","packageJsonLexicalVersion","dependencies","toBe"],"sources":["../src/dependencyChecker.spec.ts"],"sourcesContent":["import { lexicalTargetVersion } from './index'\nimport { fileURLToPath } from 'url'\nimport path from 'path'\nimport fs from 'fs/promises'\nimport { describe, it, expect } from 'vitest'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\ndescribe('Lexical dependency checker', () => {\n it('ensure lexical version installed in package.json matches dependency checker version', async () => {\n const packageJsonString = await fs.readFile(path.resolve(dirname, '../package.json'), 'utf-8')\n const packageJson = JSON.parse(packageJsonString)\n const packageJsonLexicalVersion = packageJson.dependencies['lexical']\n\n expect(packageJsonLexicalVersion).toBe(lexicalTargetVersion)\n })\n})\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,OAAOC,IAAA,MAAU;AACjB,OAAOC,EAAA,MAAQ;AACf,SAASC,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ;AAErC,MAAMC,QAAA,GAAWN,aAAA,CAAcO,MAAA,CAAAC,IAAA,CAAYC,GAAG;AAC9C,MAAMC,OAAA,GAAUT,IAAA,CAAKS,OAAO,CAACJ,QAAA;AAE7BH,QAAA,CAAS,8BAA8B;EACrCC,EAAA,CAAG,uFAAuF;IACxF,MAAMO,iBAAA,GAAoB,MAAMT,EAAA,CAAGU,QAAQ,CAACX,IAAA,CAAKY,OAAO,CAACH,OAAA,EAAS,oBAAoB;IACtF,MAAMI,WAAA,GAAcC,IAAA,CAAKC,KAAK,CAACL,iBAAA;IAC/B,MAAMM,yBAAA,GAA4BH,WAAA,CAAYI,YAAY,CAAC,UAAU;IAErEb,MAAA,CAAOY,yBAAA,EAA2BE,IAAI,CAACpB,oBAAA;EACzC;AACF","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- "use client";import{b as Be,c as Oe,e as $,f as K,h as Ie,i as Fe,j as $e,k as Ke,l as Se,m as Pe,n as ze}from"./chunk-LN6VX25I.js";import{a as Ae,b as P}from"./chunk-RJ5MAOKZ.js";import{jsx as D,jsxs as le}from"react/jsx-runtime";import{BulkUploadProvider as rn,FieldDescription as nn,FieldError as sn,FieldLabel as ln,isFieldRTL as an,RenderCustomComponent as At,useConfig as cn,useEditDepth as un,useEffectEvent as dn,useField as fn,useLocale as mn}from"@payloadcms/ui";import{mergeFieldStyles as pn}from"@payloadcms/ui/shared";import{dequal as gn}from"dequal/lite";import Bt,{useCallback as Ot,useEffect as It,useMemo as hn,useState as Ft}from"react";import{ErrorBoundary as yn}from"react-error-boundary";import"./bundled.css";import{jsx as z}from"react/jsx-runtime";import{LexicalComposer as Ur}from"@lexical/react/LexicalComposer.js";import{useEditDepth as Jr}from"@payloadcms/ui";import*as _t from"react";import{useMemo as qr}from"react";import{c as Lr}from"react/compiler-runtime";import{jsx as E,jsxs as se}from"react/jsx-runtime";import{useLexicalComposerContext as Mr}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as Ar}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as Br}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Or}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as Ir}from"@lexical/react/LexicalRichTextPlugin.js";import{useLexicalEditable as Fr}from"@lexical/react/useLexicalEditable";import{BLUR_COMMAND as $r,COMMAND_PRIORITY_LOW as Rt,FOCUS_COMMAND as Kr}from"lexical";import*as Q from"react";import{useEffect as zr,useState as jr}from"react";import{jsx as je}from"react/jsx-runtime";import"react";var j=({anchorElem:e,clientProps:t,plugin:o})=>o.position==="floatingAnchorElem"&&e?o.Component&&je(o.Component,{anchorElem:e,clientProps:t}):o.Component&&je(o.Component,{clientProps:t});import{c as jt}from"react/compiler-runtime";import{copyToClipboard as He}from"@lexical/clipboard";import{useLexicalComposerContext as Ht}from"@lexical/react/LexicalComposerContext.js";import{objectKlassEquals as Vt}from"@lexical/utils";import Ve from"bson-objectid";import{$getSelection as Wt,$isNodeSelection as Yt,COMMAND_PRIORITY_LOW as Gt,COPY_COMMAND as Ut}from"lexical";import{useEffect as Jt}from"react";var Te=e=>{if("fields"in e&&typeof e.fields=="object"&&e.fields!==null&&"id"in e.fields?e.fields.id=new Ve.default().toHexString():"id"in e&&(e.id=new Ve.default().toHexString()),e.children)for(let t of e.children)Te(t)};function We(){let e=jt(3),[t]=Ht(),o,n;return e[0]!==t?(o=()=>t.registerCommand(Ut,r=>{let a=Wt();if(Yt(a)){let l=a.getNodes()[0]?.exportJSON(),u=JSON.parse(JSON.stringify(l));Te(u);let d={namespace:t._config.namespace,nodes:[u]},m=JSON.stringify(d);return He(t,null,{"application/x-lexical-editor":m,"text/plain":""}).catch(qt),!0}return He(t,Vt(r,ClipboardEvent)?r:null).then(()=>{if(!(r instanceof ClipboardEvent)||!r.clipboardData)throw new Error("No clipboard event");let s=r.clipboardData.getData("application/x-lexical-editor");if(!s)return!0;let l=JSON.parse(s);for(let d of l.nodes)Te(d);let u=JSON.stringify(l);r.clipboardData.setData("application/x-lexical-editor",u)}).catch(s=>{throw r instanceof ClipboardEvent&&r.clipboardData?.setData("application/x-lexical-editor",""),s}),!0},Gt),n=[t],e[0]=t,e[1]=o,e[2]=n):(o=e[1],n=e[2]),Jt(o,n),null}function qt(e){throw e}import{c as Qt}from"react/compiler-runtime";import{useLexicalComposerContext as Xt}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as fe,mergeRegister as Zt}from"@lexical/utils";import{$createNodeSelection as eo,$getEditor as oe,$getNearestNodeFromDOMNode as to,$getSelection as me,$isDecoratorNode as H,$isElementNode as Re,$isLineBreakNode as oo,$isNodeSelection as pe,$isRangeSelection as Ye,$isRootOrShadowRoot as ro,$isTextNode as no,$setSelection as Ge,CLICK_COMMAND as io,COMMAND_PRIORITY_LOW as Y,KEY_ARROW_DOWN_COMMAND as so,KEY_ARROW_UP_COMMAND as lo,KEY_BACKSPACE_COMMAND as ao,KEY_DELETE_COMMAND as co,SELECTION_CHANGE_COMMAND as uo}from"lexical";import{useEffect as fo}from"react";function Ue(){let e=Qt(3),[t]=Xt(),o=Co,n,r;return e[0]!==t?(n=()=>Zt(t.registerCommand(io,xo,Y),t.registerCommand(co,o,Y),t.registerCommand(ao,o,Y),t.registerCommand(uo,yo,Y),t.registerCommand(lo,go,Y),t.registerCommand(so,mo,Y)),r=[t],e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]),fo(n,r),null}function mo(e){let t=me();if(pe(t)){e.preventDefault();let s=t.getNodes()[0]?.getNextSibling();if(H(s)){let d=oe().getElementByKey(s.getKey());return d&&re({element:d,node:s}),!0}if(!Re(s))return!0;let l=s.getFirstDescendant()??s;return l&&(fe(l,ge)?.selectEnd(),e.preventDefault()),!0}if(!Ye(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=fe(n,po),a=r?.getNextSibling();if(!r||a!==Je(r))return!1;if(H(a)){let s=oe().getElementByKey(a.getKey());if(s)return re({element:s,node:a}),e.preventDefault(),!0}return!1}function po(e){return Je(e)!==null}function go(e){let t=me();if(pe(t)){let s=t.getNodes()[0]?.getPreviousSibling();if(H(s)){let d=oe().getElementByKey(s.getKey());return d?(re({element:d,node:s}),e.preventDefault(),!0):!1}if(!Re(s))return!1;let l=s.getLastDescendant()??s;return l?(fe(l,ge)?.selectStart(),e.preventDefault(),!0):!1}if(!Ye(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=fe(n,ho),a=r?.getPreviousSibling();if(!r||a!==qe(r))return!1;if(H(a)){let s=oe().getElementByKey(a.getKey());if(s)return re({element:s,node:a}),e.preventDefault(),!0}return!1}function ho(e){return qe(e)!==null}function yo(){let e=No();return document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),e?(e.element?.classList.add("decorator-selected"),!0):!1}function xo(e){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let t=bo(e);if(!t)return!0;let{target:o}=e;return!(o instanceof HTMLElement)||o.isContentEditable||o.closest('button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role="button"]')?Ge(null):re(t),!0}function Co(e){let t=me();return pe(t)?(e.preventDefault(),t.getNodes().forEach(Eo),!0):!1}function Eo(e){e.remove()}function bo(e){if(!(e.target instanceof HTMLElement))return;let t=e.target.closest('[data-lexical-decorator="true"]');if(!(t instanceof HTMLElement))return;let o=to(t);return H(o)?{element:t,node:o}:void 0}function No(){let e=me();if(!pe(e))return;let t=e.getNodes();if(t.length!==1)return;let o=t[0];return H(o)?{decorator:o,element:oe().getElementByKey(o.getKey())}:void 0}function re({element:e,node:t}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=eo();o.add(t.getKey()),Ge(o),e.scrollIntoView({behavior:"smooth",block:"nearest"}),e.classList.add("decorator-selected")}function ge(e){if(H(e)&&!e.isInline())return!0;if(!Re(e)||ro(e))return!1;let t=e.getFirstChild(),o=t===null||oo(t)||no(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function Je(e){let t=e.getNextSibling();for(;t!==null;){if(ge(t))return t;t=t.getNextSibling()}return null}function qe(e){let t=e.getPreviousSibling();for(;t!==null;){if(ge(t))return t;t=t.getPreviousSibling()}return null}import{jsx as ke}from"react/jsx-runtime";import{useLexicalComposerContext as ko}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as _o,isHTMLElement as vo}from"lexical";import*as et from"react";import{useCallback as Do,useEffect as Ze,useRef as Lo,useState as Mo}from"react";import{createPortal as Ao}from"react-dom";var G=(e,t,o,n,r=50,a=25)=>{let s=0;if(e&&!e.contains(n)){let{bottom:l,left:u,right:d,top:m}=e.getBoundingClientRect(),c=m+window.scrollY,i=l+window.scrollY;if(o<c-a||o>i+a||t<u-r||t>d+r)return-1;(t<u||t>d)&&(s=t<u?t-u:t-d)}return s};import{$getNodeByKey as ye}from"lexical";function U(e){let t=e.getBoundingClientRect(),o=getComputedStyle(e).getPropertyValue("transform");if(!o||o==="none")return t;let n=o.split(",").pop();return t.y=t.y-Number(n?.replace(")","")),t}function he(e){let t=(u,d)=>u?parseFloat(window.getComputedStyle(u)[d]):0,{marginBottom:o,marginTop:n}=window.getComputedStyle(e),r=t(e.previousElementSibling,"marginBottom"),a=t(e.nextElementSibling,"marginTop"),s=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),a),marginTop:s}}import{$getRoot as wo}from"lexical";function V(e){return e.getEditorState().read(()=>wo().getChildrenKeys())}var So=1,Po=-1,Qe=0,B={props:null,result:null};function To(e,t,o=20){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r<=o*o}function J(e){let{anchorElem:t,cache_threshold:o=20,editor:n,fuzzy:r=!1,horizontalOffset:a=0,point:{x:s,y:l},startIndex:u=0,useEdgeAsDefault:d=!1}=e;if(o>0&&B.props&&B.result&&B.props.fuzzy===e.fuzzy&&B.props.horizontalOffset===e.horizontalOffset&&B.props.useEdgeAsDefault===e.useEdgeAsDefault&&To(B.props.point,e.point,o))return B.result;let m=t.getBoundingClientRect(),c=V(n),i={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return n.getEditorState().read(()=>{if(d){let p=n.getElementByKey(c[0]),g=n.getElementByKey(c[c.length-1]);if(p&&g){let[f,C]=[U(p),U(g)];if(l<f.top?(i.blockElem=p,i.distance=f.top-l,i.blockNode=ye(c[0]),i.foundAtIndex=0):l>C.bottom&&(i.distance=l-C.bottom,i.blockNode=ye(c[c.length-1]),i.blockElem=g,i.foundAtIndex=c.length-1),i?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let x=u,y=Qe;for(;x>=0&&x<c.length;){let p=c[x],g=n.getElementByKey(p);if(g===null)break;let f=new K(s+a,l),C=Ke.fromDOMRect(U(g)),{marginBottom:h,marginTop:b}=he(g),_=C.generateNewRect({bottom:C.bottom+h,left:m.left,right:m.right,top:C.top-b}),{distance:w,isOnBottomSide:k,isOnTopSide:L}=_.distanceFromPoint(f);if(w===0){i.blockElem=g,i.blockNode=ye(p),i.foundAtIndex=x,i.distance=w,i.blockNode&&i.blockNode.getType()==="paragraph"&&i.blockNode.getTextContent()===""&&(!r&&!e.returnEmptyParagraphs&&(i.blockElem=null,i.blockNode=null),i.isFoundNodeEmptyParagraph=!0);break}else r&&w<i.distance&&(i.blockElem=g,i.blockNode=ye(p),i.distance=w,i.foundAtIndex=x);y===Qe&&(L?y=Po:k?y=So:y=1/0),x+=y}}),B.props=e,B.result={blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph},{blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph}}function xe(e,t){return!!e.closest(`.${t}`)}var Ro=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Xe(e){if(!e||Ro.includes(e.tagName)||e.offsetHeight===0||e.offsetWidth===0)return!1;let t=window.getComputedStyle(e);return!(t.display==="table-cell"||t.position==="absolute"||t.visibility==="hidden"||t.opacity==="0")}function Ce(e,t,o,n=0){if(!e){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let r=e.getBoundingClientRect(),a=window.getComputedStyle(e),s=t.getBoundingClientRect(),l=o.getBoundingClientRect(),u;if(["LexicalEditorTheme__block","LexicalEditorTheme__upload","LexicalEditorTheme__relationship"].some(c=>e.classList.contains(c)||e.firstElementChild?.classList.contains(c)))u=r.top+8-l.top;else{let c=Xe(e)?parseInt(a.lineHeight,10):0;u=r.top+(c-s.height)/2-l.top}let m=n;t.style.opacity="1",t.style.transform=`translate(${m}px, ${u}px)`}var Bo="add-block-menu",Ee=1/0;function Oo(e){return e===0?1/0:Ee>=0&&Ee<e?Ee:Math.floor(e/2)}function Io(e,t,o){let n=t.parentElement,{editorConfig:r}=P(),a=r?.admin?.hideGutter?-24:12,s=Lo(null),[l,u]=Mo(null);Ze(()=>{function m(c){let i=c.target;if(!vo(i))return;let x=G(n,c.pageX,c.pageY,i);if(x===-1){u(null);return}if(xe(i,Bo))return;let y=V(e),{blockElem:p,blockNode:g,foundAtIndex:f}=J({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-x,point:new K(c.x,c.y),returnEmptyParagraphs:!0,startIndex:Oo(y.length),useEdgeAsDefault:!1});Ee=f,p&&g&&(l?.node!==g||l?.elem!==p)&&u({elem:p,node:g})}return document?.addEventListener("mousemove",m),()=>{document?.removeEventListener("mousemove",m)}},[n,t,e,l]),Ze(()=>{s.current&&l?.node&&Ce(l?.elem,s.current,t,a)},[t,l,a]);let d=Do(m=>{let c=l;c?.node&&(e.update(()=>{let i=!0;if((c?.node.getType()!=="paragraph"||c.node.getTextContent()!=="")&&(i=!1),!i){let x=_o();c?.node.insertAfter(x),setTimeout(()=>{c={elem:e.getElementByKey(x.getKey()),node:x},u(c)},0)}}),setTimeout(()=>{e.update(()=>{e.focus(),c?.node&&"select"in c.node&&typeof c.node.select=="function"&&c.node.select()})},1),setTimeout(()=>{e.dispatchCommand(Fe,{node:c?.node})},2),m.stopPropagation(),m.preventDefault())},[e,l]);return Ao(ke(et.Fragment,{children:ke("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:m=>{d(m)},ref:s,type:"button",children:ke("div",{className:o?"icon":""})})}),t)}function tt(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=ko();return Io(n,o,n._editable)}import{jsx as be,jsxs as $o}from"react/jsx-runtime";import{useLexicalComposerContext as Ko}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as nt}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as it,$getNodeByKey as zo,isHTMLElement as _e}from"lexical";import*as ut from"react";import{useEffect as ve,useRef as ne,useState as st}from"react";import{createPortal as jo}from"react-dom";var ot=0,Fo=-24;var W=0;function rt(e,t,o,n,r,a,s,l,u,d=!1){let{height:m,top:c}=n.getBoundingClientRect(),{top:i,width:x}=s.getBoundingClientRect(),{marginBottom:y,marginTop:p}=he(n),g=c,f=a>=c+m/2+window.scrollY,C=!1;if(r?.elem)if(n!==r?.elem)(f&&r?.elem&&r?.elem===n.nextElementSibling||!f&&r?.elem&&r?.elem===n.previousElementSibling)&&(W++,W<200&&(C=!0));else{W++;let w=r?.boundingBox?.y,k=n.getBoundingClientRect().y;(f===r?.isBelow&&w===k||W<200)&&(C=!1)}if(C)return{isBelow:f,willStayInSamePosition:C};d?g+=m/2:f?g+=m+y/2:g-=p/2;let h=0;d||(f?h=-ot:h=ot);let b=g-i+h,_=Fo-t;return o.style.width=`calc(${x}px - ${e} - var(--spacer-5))`,o.style.opacity=".8",o.style.transform=`translate(${_}px, calc(${b}px - 2px))`,r?.elem&&(r.elem.style.opacity="",r?.elem===n?f?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop="")),W=0,{isBelow:f,willStayInSamePosition:C}}var Ho="draggable-block-menu",lt="application/x-lexical-drag-block",ie=1/0;function at(e){return e===0?1/0:ie>=0&&ie<e?ie:Math.floor(e/2)}function Vo(e,t){let{transform:o}=t.style;e.setDragImage(t,0,0),setTimeout(()=>{t.style.transform=o})}function ct(e,t){e&&(e.style.opacity="0"),t&&(t.style.opacity="",t.style.marginBottom="",t.style.marginTop="")}function Wo(e,t,o){let n=t.parentElement,r=ne(null),a=ne(null),s=ne(null),l=ne(!1),u=ne([]),[d,m]=st(null),[c,i]=st(null),{editorConfig:x}=P(),y=x?.admin?.hideGutter?-44:-8;ve(()=>{function f(C){let h=C.target;if(!_e(h))return;let b=G(n,C.pageX,C.pageY,h);if(b===-1){m(null);return}if(xe(h,Ho))return;let _=V(e),{blockElem:w,foundAtIndex:k,isFoundNodeEmptyParagraph:L}=J({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-b,point:new K(C.x,C.y),startIndex:at(_.length),useEdgeAsDefault:!1,verbose:!1});ie=k,!(!w&&!L)&&d!==w&&m(w)}return document?.addEventListener("mousemove",f),()=>{document?.removeEventListener("mousemove",f)}},[n,t,e,d]),ve(()=>{r.current&&Ce(d,r.current,t,y)},[t,d,y]),ve(()=>{function f(h){if(!l.current)return!1;let[b]=nt(h);if(b)return!1;let{pageY:_,target:w}=h;if(!_e(w))return!1;let k=G(n,h.pageX,h.pageY,w,100,50),L=V(e),{blockElem:S,foundAtIndex:I,isFoundNodeEmptyParagraph:R}=J({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-k,point:new K(h.x,h.y),startIndex:at(L.length),useEdgeAsDefault:!0,verbose:!0});ie=I;let F=a.current;if(S===null||F===null)return!1;if(h.preventDefault(),h.dataTransfer.dropEffect="move",d!==S){let{isBelow:v,willStayInSamePosition:M}=rt(x?.admin?.hideGutter?"0px":"var(--spacer-5)",y+(x?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),F,S,c,_,t,h,s,R);M||i({boundingBox:S.getBoundingClientRect(),elem:S,isBelow:v})}else c?.elem&&(ct(F,c.elem),i({boundingBox:S.getBoundingClientRect(),elem:S,isBelow:!1}));return!0}function C(h){if(!l.current)return!1;let[b]=nt(h);if(b)return!1;let{dataTransfer:_,pageY:w,target:k}=h,L=_?.getData(lt)||"";return e.update(()=>{let S=zo(L);if(!S||!_e(k))return!1;let I=G(n,h.pageX,h.pageY,k,100,50),{blockElem:R,isFoundNodeEmptyParagraph:F}=J({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-I,point:new K(h.x,h.y),useEdgeAsDefault:!0});if(!R)return!1;let v=it(R);if(!v)return!1;if(v===S)return!0;let{height:M,top:ae}=U(R),Ne=w>=ae+M/2+window.scrollY;F?(v.insertBefore(S),v.remove()):Ne?v.insertAfter(S):v.insertBefore(S),d!==null&&m(null),document.querySelectorAll(".lexical-block-highlighter").forEach(T=>{T.remove()});let we=e.getElementByKey(S.getKey()),ce=setTimeout(()=>{let T=we?.getBoundingClientRect();if(!T)return;let N=document.createElement("div");N.className="lexical-block-highlighter",N.style.backgroundColor="var(--color-bg-inverse)",N.style.transition="opacity 0.5s ease-in-out",N.style.zIndex="1",N.style.pointerEvents="none",N.style.boxSizing="border-box",N.style.borderRadius="4px",N.style.position="absolute",document.body.appendChild(N),N.style.opacity="0.1",N.style.height=`${T.height+8}px`,N.style.width=`${T.width+8}px`,N.style.top=`${T.top+window.scrollY-4}px`,N.style.left=`${T.left-4}px`;let ue=setTimeout(()=>{N.style.opacity="0";let de=setTimeout(()=>{N.remove()},500);u.current.push(de)},1e3);u.current.push(ue)},120);u.current.push(ce)}),!0}return document.addEventListener("dragover",f),document.addEventListener("drop",C),()=>{document.removeEventListener("dragover",f),document.removeEventListener("drop",C),u.current.forEach(clearTimeout),u.current=[]}},[n,y,t,e,c,d,x?.admin?.hideGutter]);function p(f){let C=f.dataTransfer;if(!C||!d)return;Vo(C,d),C.effectAllowed="move";let h="";e.update(()=>{let b=it(d);b&&(h=b.getKey())}),l.current=!0,C.setData(lt,h)}function g(){l.current=!1,c?.elem&&ct(a.current,c?.elem)}return jo($o(ut.Fragment,{children:[be("button",{"aria-label":"Drag to move",className:"icon draggable-block-menu",draggable:!0,onDragEnd:g,onDragStart:p,ref:r,type:"button",children:be("div",{className:o?"icon":""})}),be("div",{className:"draggable-block-target-line",ref:a}),be("div",{className:"debug-highlight",ref:s})]}),t)}function dt(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=Ko();return Wo(n,o,n._editable)}import{c as Yo}from"react/compiler-runtime";import{jsx as De}from"react/jsx-runtime";import{useLexicalComposerContext as Go}from"@lexical/react/LexicalComposerContext";import{useTranslation as Uo}from"@payloadcms/ui";import{$createParagraphNode as Jo,$getRoot as qo}from"lexical";import"react";var ft="insert-paragraph-at-end",mt=()=>{let e=Yo(5),[t]=Go(),{editorConfig:o}=P(),{t:n}=Uo();if(o?.admin?.hideInsertParagraphAtEnd)return null;let r;e[0]!==t?(r=()=>{t.update(Qo)},e[0]=t,e[1]=r):r=e[1];let a=r,s;return e[2]!==a||e[3]!==n?(s=De("button",{"aria-label":n("lexical:general:insertParagraph"),className:ft,onClick:a,type:"button",children:De("span",{className:`${ft}-inside`,children:De(Be,{size:16})})}),e[2]=a,e[3]=n,e[4]=s):s=e[4],s};function Qo(){let e=Jo();qo().append(e),e.select()}import{c as Xo}from"react/compiler-runtime";import{registerMarkdownShortcuts as Zo}from"@lexical/markdown";import{useLexicalComposerContext as er}from"@lexical/react/LexicalComposerContext";import*as pt from"react";var gt=()=>{let e=Xo(4),{editorConfig:t}=P(),[o]=er(),n,r;return e[0]!==o||e[1]!==t.features.markdownTransformers?(n=()=>Zo(o,t.features.markdownTransformers??[]),r=[o,t.features.markdownTransformers],e[0]=o,e[1]=t.features.markdownTransformers,e[2]=n,e[3]=r):(n=e[2],r=e[3]),pt.useEffect(n,r),null};import{c as tr}from"react/compiler-runtime";import{useLexicalComposerContext as or}from"@lexical/react/LexicalComposerContext.js";import{$getRoot as rr}from"lexical";import{useEffect as nr}from"react";function ir(e){e.update(()=>{let t=o=>{let n=o.getType();if((n==="block"||n==="inlineBlock")&&o.markDirty(),"getChildren"in o&&typeof o.getChildren=="function")for(let r of o.getChildren())t(r)};t(rr())})}function ht(){let e=tr(5),[t]=or(),{currentView:o,views:n}=$(),r,a;return e[0]!==o||e[1]!==t||e[2]!==n?(r=()=>{n&&(o==="default"?n.default?Se(t,n.default?.nodes):Pe(t):n[o]&&(Pe(t),Se(t,n[o]?.nodes)),ir(t))},a=[t,n,o],e[0]=o,e[1]=t,e[2]=n,e[3]=r,e[4]=a):(r=e[3],a=e[4]),nr(r,a),null}import{useLexicalComposerContext as sr}from"@lexical/react/LexicalComposerContext";import{$getSelection as lr,$isRangeSelection as ar,RootNode as cr}from"lexical";import{useEffect as ur}from"react";function yt(){let[e]=sr();return ur(()=>e.registerNodeTransform(cr,t=>{let o=lr();if(ar(o)){let n=o.anchor.getNode(),r=o.focus.getNode();(!n.isAttached()||!r.isAttached())&&(t.selectEnd(),console.warn("updateEditor: selection has been moved to the end of the editor because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node."))}return!1}),[e]),null}import{useLexicalComposerContext as dr}from"@lexical/react/LexicalComposerContext";import{$getSelection as fr,COMMAND_PRIORITY_LOW as mr,SELECT_ALL_COMMAND as pr}from"lexical";import{useEffect as gr}from"react";function xt(){let[e]=dr();return gr(()=>e.registerCommand(pr,()=>{if(fr())return!1;let o=document.activeElement;return o instanceof HTMLInputElement&&o.select(),!0},mr),[e]),null}import{jsx as q,jsxs as Et}from"react/jsx-runtime";import{useLexicalComposerContext as yr}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as bt}from"@payloadcms/ui";import{useCallback as xr,useMemo as Cr,useState as Er}from"react";import"react";import*as Nt from"react-dom";import{c as hr}from"react/compiler-runtime";import"react";function Ct(e,t){let o=hr(4),{maxLength:n,minLength:r}=t,a=n===void 0?75:n,s=r===void 0?1:r,l;return o[0]!==a||o[1]!==s||o[2]!==e?(l=u=>{let{query:d}=u,m="[^"+e+Ie+"\\s]",i=new RegExp("(^|\\s|\\()(["+e+"]((?:"+m+"){0,"+a+"}))$").exec(d);if(i!==null){let x=i[1],y=i[3];if(y.length>=s)return{leadOffset:i.index+x.length,matchingString:y,replaceableString:i[2]}}return null},o[0]=a,o[1]=s,o[2]=e,o[3]=l):l=o[3],l}var O="slash-menu-popup";function br({isSelected:e,item:t,onClick:o,onMouseEnter:n,ref:r}){let{fieldProps:{featureClientSchemaMap:a,schemaPath:s}}=P(),{i18n:l}=bt(),u=`${O}__item ${O}__item-${t.key}`;e&&(u+=` ${O}__item--selected`);let d=t.key;return t.label&&(d=typeof t.label=="function"?t.label({featureClientSchemaMap:a,i18n:l,schemaPath:s}):t.label),d.length>25&&(d=d.substring(0,25)+"..."),Et("button",{"aria-selected":e,className:u,id:O+"__item-"+t.key,onClick:o,onMouseEnter:n,ref:r,role:"option",tabIndex:-1,type:"button",children:[t?.Icon&&q(t.Icon,{}),q("span",{className:`${O}__item-text`,children:d})]},t.key)}function wt({anchorElem:e=document.body}){let[t]=yr(),[o,n]=Er(null),{editorConfig:r}=P(),{i18n:a}=bt(),{fieldProps:{featureClientSchemaMap:s,schemaPath:l}}=P(),u=Ct("/",{minLength:0}),d=xr(()=>{let c=[];for(let i of r.features.slashMenu.dynamicGroups)if(o){let x=i({editor:t,queryString:o});c=c.concat(x)}return c},[t,o,r?.features]),m=Cr(()=>{let c=[];for(let i of r?.features.slashMenu.groups??[])c.push(i);if(o){let i=o.toLowerCase().replace(/[\s\-_]/g,"");c=c.map(y=>{let p=y.items.filter(g=>{let f=g.key;return g.label&&(f=typeof g.label=="function"?g.label({featureClientSchemaMap:s,i18n:a,schemaPath:l}):g.label),new RegExp(o,"gi").exec(f)||f.toLowerCase().replace(/[\s\-_]/g,"").includes(i)?!0:g.keywords!=null?g.keywords.some(h=>new RegExp(o,"gi").exec(h)?!0:h.toLowerCase().replace(/[\s\-_]/g,"").includes(i)):!1});return p.length?{...y,items:p}:null}),c=c.filter(y=>y!=null);let x=d();for(let y of x){let p=c.find(g=>g.key===y.key);p?c=c.filter(g=>g.key!==y.key):p={...y,items:[]},p?.items?.length&&(p.items=p.items.concat(p.items)),c.push(p)}}return c},[o,r?.features.slashMenu.groups,d,s,a,l]);return q($e,{anchorElem:e,groups:m,menuRenderFn:(c,{selectedItemKey:i,selectItemAndCleanUp:x,setSelectedItemKey:y})=>c.current&&m.length?Nt.createPortal(q("div",{className:O,"data-theme":"dark",children:m.map(p=>{let g=p.key;return p.label&&s&&(g=typeof p.label=="function"?p.label({featureClientSchemaMap:s,i18n:a,schemaPath:l}):p.label),Et("div",{className:`${O}__group ${O}__group-${p.key}`,children:[q("div",{className:`${O}__group-title`,children:g}),p.items.map((f,C)=>q(br,{index:C,isSelected:i===f.key,item:f,onClick:()=>{y(f.key),x(f)},onMouseEnter:()=>{y(f.key)},ref:h=>{f.ref={current:h}}},f.key))]},p.key)})}),c.current):null,onQueryChange:n,triggerFn:u})}import{c as Nr}from"react/compiler-runtime";import{useLexicalComposerContext as wr}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as Sr,TextNode as Pr}from"lexical";import{useEffect as Tr}from"react";function St(e){let t=Nr(6),{features:o}=e,[n]=wr(),r;t[0]!==n||t[1]!==o.enabledFormats?(r=()=>{let s=Rr(o.enabledFormats);if(s.length!==0)return n.registerNodeTransform(Pr,l=>{s.forEach(u=>{l.hasFormat(u)&&l.toggleFormat(u)})})},t[0]=n,t[1]=o.enabledFormats,t[2]=r):r=t[2];let a;return t[3]!==n||t[4]!==o?(a=[n,o],t[3]=n,t[4]=o,t[5]=a):a=t[5],Tr(r,a),null}function Rr(e){let t=Object.keys(Sr),o=new Set(e);return t.filter(n=>!o.has(n))}import{c as kr}from"react/compiler-runtime";import{jsx as Pt}from"react/jsx-runtime";import{useLexicalComposerContext as _r}from"@lexical/react/LexicalComposerContext";import{ContentEditable as vr}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as Dr}from"@payloadcms/ui";import"react";function Tt(e){let t=kr(5),{className:o,editorConfig:n}=e,{t:r}=Dr(),[,a]=_r(),{getTheme:s}=a,l;if(t[0]!==o||t[1]!==n?.admin?.placeholder||t[2]!==s||t[3]!==r){let u=s();l=Pt(vr,{"aria-placeholder":r("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:Pt("p",{className:u?.placeholder,children:n?.admin?.placeholder??r("lexical:general:placeholder")})}),t[0]=o,t[1]=n?.admin?.placeholder,t[2]=s,t[3]=r,t[4]=l}else l=t[4];return l}var kt=e=>{let t=Lr(13),{editorConfig:o,editorContainerRef:n,isSmallWidthViewport:r,onChange:a,rtl:s}=e,l=P(),[u]=Mr(),d=Fr(),[m,c]=jr(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=f=>{f!==null&&c(f)},t[0]=i):i=t[0];let x=i,y,p;t[1]!==u||t[2]!==l?(y=()=>{if(!l?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}l?.parentEditor?.uuid&&l.parentEditor?.registerChild(l.uuid,l);let f=()=>{l.focusEditor(l)},C=()=>{l.blurEditor(l)},h=u.registerCommand(Kr,()=>(f(),!0),Rt),b=u.registerCommand($r,()=>(C(),!0),Rt);return()=>{h(),b(),l.parentEditor?.unregisterChild?.(l.uuid)}},p=[u,l],t[1]=u,t[2]=l,t[3]=y,t[4]=p):(y=t[3],p=t[4]),zr(y,p);let g;return t[5]!==o||t[6]!==n||t[7]!==m||t[8]!==d||t[9]!==r||t[10]!==a||t[11]!==s?(g=se(Q.Fragment,{children:[o.features.plugins?.map(Hr),se("div",{className:"editor-container",dir:s?"rtl":void 0,ref:n,children:[o.features.plugins?.map(Vr),E(Ir,{contentEditable:E("div",{className:"editor-scroller",children:E("div",{className:"editor",ref:x,children:E(Tt,{editorConfig:o})})}),ErrorBoundary:Ar}),E(yt,{}),d&&E(mt,{}),E(Ue,{}),E(We,{}),E(St,{features:o.features}),E(xt,{}),E(ht,{}),d&&E(Or,{ignoreSelectionChange:!0,onChange:(f,C,h)=>{(!h.has("focus")||h.size>1)&&a?.(f,C,h)}}),m&&se(Q.Fragment,{children:[!r&&d&&se(Q.Fragment,{children:[o.admin?.hideDraggableBlockElement?null:E(dt,{anchorElem:m}),o.admin?.hideAddBlockButton?null:E(tt,{anchorElem:m})]}),o.features.plugins?.map(f=>{if(f.position==="floatingAnchorElem"&&!(f.desktopOnly===!0&&r))return E(j,{anchorElem:m,clientProps:f.clientProps,plugin:f},f.key)}),d&&E(Q.Fragment,{children:E(wt,{anchorElem:m})})]}),d&&se(Q.Fragment,{children:[E(Br,{}),o?.features?.markdownTransformers?.length>0&&E(gt,{})]}),o.features.plugins?.map(Wr),o.features.plugins?.map(Yr)]}),o.features.plugins?.map(Gr)]}),t[5]=o,t[6]=n,t[7]=m,t[8]=d,t[9]=r,t[10]=a,t[11]=s,t[12]=g):g=t[12],g};function Hr(e){if(e.position==="aboveContainer")return E(j,{clientProps:e.clientProps,plugin:e},e.key)}function Vr(e){if(e.position==="top")return E(j,{clientProps:e.clientProps,plugin:e},e.key)}function Wr(e){if(e.position==="normal")return E(j,{clientProps:e.clientProps,plugin:e},e.key)}function Yr(e){if(e.position==="bottom")return E(j,{clientProps:e.clientProps,plugin:e},e.key)}function Gr(e){if(e.position==="belowContainer")return E(j,{clientProps:e.clientProps,plugin:e},e.key)}var vt=({children:e,providers:t})=>{if(!t?.length)return e;let o=t[0];return t.length>1?z(o,{children:z(vt,{providers:t.slice(1),children:e})}):z(o,{children:e})},Dt=e=>{let{composerKey:t,editorConfig:o,fieldProps:n,isSmallWidthViewport:r,onChange:a,readOnly:s,rtl:l,value:u}=e,{currentView:d,views:m}=$(),c=P(),i=Jr(),x=_t.useRef(null),y=qr(()=>{if(u&&typeof u!="object")throw new Error("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: "+JSON.stringify(u));if(u&&Array.isArray(u)&&!("root"in u))throw new Error("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");if(u&&"jsonContent"in u)throw new Error("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");let p=m?.[d]?.nodes;return{editable:s!==!0,editorState:u!=null?JSON.stringify(u):void 0,namespace:o.lexical.namespace,nodes:ze({editorConfig:o,nodeViews:p}),onError:g=>{throw g},theme:o.lexical.theme}},[o,m,d]);return y?z(Ur,{initialConfig:y,children:z(Ae,{editorConfig:o,editorContainerRef:x,fieldProps:n,parentContext:c?.editDepth===i?c:void 0,children:z(vt,{providers:o.features.providers,children:z(kt,{editorConfig:o,editorContainerRef:x,isSmallWidthViewport:r,onChange:a,rtl:l})})})},t+y.editable+d):z("p",{children:"Loading..."})};import{c as Qr}from"react/compiler-runtime";import{jsx as X,jsxs as Xr}from"react/jsx-runtime";import{ChevronIcon as Zr,Popup as en,PopupList as Lt}from"@payloadcms/ui";import"react";function Mt(){let e=Qr(5),{currentView:t,setCurrentView:o,views:n}=$();if(!n||Object.keys(n).length===0)return null;let r,a;if(e[0]!==t||e[1]!==o||e[2]!==n){a=Symbol.for("react.early_return_sentinel");e:{let s=Object.keys(n);if(!s.some(on)){a=null;break e}let u=["default",...s.filter(tn)],d=t.charAt(0).toUpperCase()+t.slice(1);r=X("div",{className:"lexical-view-selector",children:X(en,{button:Xr("button",{className:"lexical-view-selector__button",type:"button",children:[X("span",{className:"lexical-view-selector__label",children:d}),X(Zr,{className:"lexical-view-selector__icon"})]}),buttonType:"custom",horizontalAlign:"left",render:m=>{let{close:c}=m;return X(Lt.ButtonGroup,{children:u.map(i=>{let x=i.charAt(0).toUpperCase()+i.slice(1);return X(Lt.Button,{active:i===t,disabled:i===t,onClick:()=>{o?.(i),c()},children:x},i)})})},size:"large"})})}e[0]=t,e[1]=o,e[2]=n,e[3]=r,e[4]=a}else r=e[3],a=e[4];return a!==Symbol.for("react.early_return_sentinel")?a:r}function tn(e){return e!=="default"}function on(e){return e!=="default"}var Z="rich-text-lexical",xn=e=>{let{editorConfig:t,field:o,field:{admin:{className:n,description:r,readOnly:a}={},label:s,localized:l,required:u},path:d,readOnly:m,schemaPath:c,validate:i}=e,x=m||a,y=mn(),{config:{localization:p}}=cn(),g=an({fieldLocalized:l,locale:y,localizationConfig:p||void 0}),f=un(),{isControlledByParent:C}=$(),h=Ot((A,te)=>typeof i=="function"?i(A,{...te,required:u}):!0,[i,u]),{customComponents:{AfterInput:b,BeforeInput:_,Description:w,Error:k,Label:L}={},disabled:S,initialValue:I,path:R,setValue:F,showError:v,value:M}=fn({potentiallyStalePath:d,validate:h}),ae=x||S,[ee,Ne]=Ft(!1),[Le,we]=Ft(),ce=Bt.useRef(I),T=Bt.useRef(M);It(()=>{let A=()=>{let te=window.matchMedia("(max-width: 768px)").matches;te!==ee&&Ne(te)};return A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}},[ee]);let N=["field-type",Z,n,v&&"error",ae&&`${Z}--read-only`,t?.admin?.hideGutter!==!0&&!ee?`${Z}--show-gutter`:null].filter(Boolean).join(" "),ue=`${R}.${f}`,de=Oe(),$t=Ot(A=>{de(()=>{let Me=A.toJSON();T.current=Me,F(Me)})},[F,de]),Kt=hn(()=>pn(o),[o]),zt=dn(A=>{T.current!==M&&!gn(T.current!=null?JSON.parse(JSON.stringify(T.current)):T.current,M)&&(ce.current=A,T.current=M,we(new Date))});return It(()=>{Object.is(I,ce.current)||zt(I)},[I]),le("div",{className:N,"data-field-path":R,"data-field-schemapath":c,"data-lexical-view":t?.view,style:Kt,children:[le("div",{className:`${Z}__label-row`,children:[L||D(ln,{label:s,localized:l,path:R,required:u}),!C&&D(Mt,{})]}),le("div",{className:`${Z}__wrap`,children:[D(At,{CustomComponent:k,Fallback:D(sn,{path:R,showError:v})}),le(yn,{fallbackRender:Cn,onReset:()=>{},children:[_,D("div",{className:`${Z}__editor-content`,children:D(rn,{modalSlugPrefix:`lexical-${R}`,children:D(Dt,{composerKey:ue,editorConfig:t,fieldProps:e,isSmallWidthViewport:ee,onChange:$t,readOnly:ae,rtl:g,value:M},JSON.stringify({path:R,rerenderProviderKey:Le}))})}),b]}),D(At,{CustomComponent:w,Fallback:D(nn,{description:r,path:R})})]})]},ue)};function Cn({error:e}){return le("div",{className:"errorBoundary",role:"alert",children:[D("p",{children:"Something went wrong:"}),D("pre",{style:{color:"red"},children:e instanceof Error?e.message:String(e)})]})}var Ll=xn;export{Ll as RichText};
2
- //# sourceMappingURL=Field-F22V5L4V.js.map