@payloadcms/richtext-lexical 3.0.0-canary.b8dd0db → 3.0.0-canary.bb00d64

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 (512) hide show
  1. package/dist/cell/rscEntry.d.ts +12 -0
  2. package/dist/cell/rscEntry.d.ts.map +1 -0
  3. package/dist/cell/rscEntry.js +82 -0
  4. package/dist/cell/rscEntry.js.map +1 -0
  5. package/dist/exports/client/Field-LKCJPU2R.js +2 -0
  6. package/dist/exports/client/Field-LKCJPU2R.js.map +7 -0
  7. package/dist/exports/client/RelationshipComponent-IMM4CFBE.js +2 -0
  8. package/dist/exports/client/RelationshipComponent-IMM4CFBE.js.map +7 -0
  9. package/dist/exports/client/bundled.css +1 -1
  10. package/dist/exports/client/chunk-5PBXL4HT.js +2 -0
  11. package/dist/exports/client/chunk-5PBXL4HT.js.map +7 -0
  12. package/dist/exports/client/chunk-NNE6RSU5.js +2 -0
  13. package/dist/exports/client/chunk-NNE6RSU5.js.map +7 -0
  14. package/dist/exports/client/{chunk-LGUXX2QH.js → chunk-O4IOO4EU.js} +2 -2
  15. package/dist/exports/client/{chunk-LGUXX2QH.js.map → chunk-O4IOO4EU.js.map} +2 -2
  16. package/dist/exports/client/chunk-PDAZFJVO.js +2 -0
  17. package/dist/exports/client/chunk-PDAZFJVO.js.map +7 -0
  18. package/dist/exports/client/chunk-PSABE6CO.js +2 -0
  19. package/dist/exports/client/chunk-PSABE6CO.js.map +7 -0
  20. package/dist/exports/client/{chunk-V2LKLT2F.js → chunk-XCEM47RI.js} +3 -3
  21. package/dist/exports/client/{chunk-V2LKLT2F.js.map → chunk-XCEM47RI.js.map} +3 -3
  22. package/dist/exports/client/chunk-ZFVIUTHB.js +2 -0
  23. package/dist/exports/client/chunk-ZFVIUTHB.js.map +7 -0
  24. package/dist/exports/client/{chunk-OKMIHD2R.js → chunk-ZOYGBIAN.js} +2 -2
  25. package/dist/exports/client/{chunk-OKMIHD2R.js.map → chunk-ZOYGBIAN.js.map} +2 -2
  26. package/dist/exports/client/component-4OBXHYCD.js +2 -0
  27. package/dist/exports/client/component-4OBXHYCD.js.map +7 -0
  28. package/dist/exports/client/component-ANB7VZLA.js +2 -0
  29. package/dist/exports/client/component-ANB7VZLA.js.map +7 -0
  30. package/dist/exports/client/component-P25AKAUU.js +2 -0
  31. package/dist/exports/client/component-P25AKAUU.js.map +7 -0
  32. package/dist/exports/client/componentInline-N5LJ2LY2.js +2 -0
  33. package/dist/exports/client/componentInline-N5LJ2LY2.js.map +7 -0
  34. package/dist/exports/client/index.d.ts +3 -4
  35. package/dist/exports/client/index.d.ts.map +1 -1
  36. package/dist/exports/client/index.js +7 -7
  37. package/dist/exports/client/index.js.map +4 -4
  38. package/dist/exports/server/rsc.d.ts +3 -0
  39. package/dist/exports/server/rsc.d.ts.map +1 -0
  40. package/dist/exports/server/rsc.js +3 -0
  41. package/dist/exports/server/rsc.js.map +1 -0
  42. package/dist/features/align/client/index.d.ts +1 -4
  43. package/dist/features/align/client/index.d.ts.map +1 -1
  44. package/dist/features/blockquote/client/index.d.ts +1 -4
  45. package/dist/features/blockquote/client/index.d.ts.map +1 -1
  46. package/dist/features/blockquote/markdownTransformer.js.map +1 -1
  47. package/dist/features/blockquote/server/index.d.ts +1 -1
  48. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  49. package/dist/features/blockquote/server/index.js +5 -1
  50. package/dist/features/blockquote/server/index.js.map +1 -1
  51. package/dist/features/blocks/client/component/BlockContent.d.ts +1 -0
  52. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  53. package/dist/features/blocks/client/component/BlockContent.js +28 -28
  54. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  55. package/dist/features/blocks/client/component/index.d.ts +1 -1
  56. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  57. package/dist/features/blocks/client/component/index.js +94 -55
  58. package/dist/features/blocks/client/component/index.js.map +1 -1
  59. package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
  60. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  61. package/dist/features/blocks/client/componentInline/index.js +27 -29
  62. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  63. package/dist/features/blocks/client/index.d.ts +1 -4
  64. package/dist/features/blocks/client/index.d.ts.map +1 -1
  65. package/dist/features/blocks/client/index.js +35 -23
  66. package/dist/features/blocks/client/index.js.map +1 -1
  67. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  68. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  69. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  70. package/dist/features/blocks/client/plugin/index.d.ts +2 -2
  71. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  72. package/dist/features/blocks/client/plugin/index.js +96 -93
  73. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  74. package/dist/features/blocks/server/index.d.ts.map +1 -1
  75. package/dist/features/blocks/server/index.js +41 -27
  76. package/dist/features/blocks/server/index.js.map +1 -1
  77. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +11 -5
  78. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  79. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  80. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +3 -3
  81. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  82. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  83. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  84. package/dist/features/blocks/server/validate.js +8 -5
  85. package/dist/features/blocks/server/validate.js.map +1 -1
  86. package/dist/features/converters/html/converter/converters/paragraph.d.ts.map +1 -1
  87. package/dist/features/converters/html/converter/converters/paragraph.js +4 -0
  88. package/dist/features/converters/html/converter/converters/paragraph.js.map +1 -1
  89. package/dist/features/converters/html/converter/converters/text.d.ts.map +1 -1
  90. package/dist/features/converters/html/converter/converters/text.js +2 -1
  91. package/dist/features/converters/html/converter/converters/text.js.map +1 -1
  92. package/dist/features/converters/html/converter/index.d.ts +11 -7
  93. package/dist/features/converters/html/converter/index.d.ts.map +1 -1
  94. package/dist/features/converters/html/converter/index.js +17 -1
  95. package/dist/features/converters/html/converter/index.js.map +1 -1
  96. package/dist/features/converters/html/converter/types.d.ts +3 -1
  97. package/dist/features/converters/html/converter/types.d.ts.map +1 -1
  98. package/dist/features/converters/html/converter/types.js.map +1 -1
  99. package/dist/features/converters/html/field/index.d.ts.map +1 -1
  100. package/dist/features/converters/html/field/index.js +7 -1
  101. package/dist/features/converters/html/field/index.js.map +1 -1
  102. package/dist/features/debug/testRecorder/client/index.d.ts +1 -4
  103. package/dist/features/debug/testRecorder/client/index.d.ts.map +1 -1
  104. package/dist/features/debug/testRecorder/client/plugin/index.js +180 -345
  105. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  106. package/dist/features/debug/treeView/client/index.d.ts +1 -4
  107. package/dist/features/debug/treeView/client/index.d.ts.map +1 -1
  108. package/dist/features/experimental_table/client/index.d.ts +1 -1
  109. package/dist/features/experimental_table/client/index.d.ts.map +1 -1
  110. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  111. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +250 -488
  112. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  113. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  114. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +39 -39
  115. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  116. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts +1 -1
  117. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
  118. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +60 -124
  119. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  120. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
  121. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +52 -50
  122. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  123. package/dist/features/experimental_table/client/utils/debounce.js +4 -4
  124. package/dist/features/experimental_table/client/utils/debounce.js.map +1 -1
  125. package/dist/features/experimental_table/client/utils/useDebounce.js.map +1 -1
  126. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  127. package/dist/features/experimental_table/server/index.js +20 -4
  128. package/dist/features/experimental_table/server/index.js.map +1 -1
  129. package/dist/features/format/bold/feature.client.d.ts +1 -4
  130. package/dist/features/format/bold/feature.client.d.ts.map +1 -1
  131. package/dist/features/format/inlineCode/feature.client.d.ts +1 -4
  132. package/dist/features/format/inlineCode/feature.client.d.ts.map +1 -1
  133. package/dist/features/format/italic/feature.client.d.ts +1 -4
  134. package/dist/features/format/italic/feature.client.d.ts.map +1 -1
  135. package/dist/features/format/strikethrough/feature.client.d.ts +1 -4
  136. package/dist/features/format/strikethrough/feature.client.d.ts.map +1 -1
  137. package/dist/features/format/subscript/feature.client.d.ts +1 -4
  138. package/dist/features/format/subscript/feature.client.d.ts.map +1 -1
  139. package/dist/features/format/superscript/feature.client.d.ts +1 -4
  140. package/dist/features/format/superscript/feature.client.d.ts.map +1 -1
  141. package/dist/features/format/underline/feature.client.d.ts +1 -4
  142. package/dist/features/format/underline/feature.client.d.ts.map +1 -1
  143. package/dist/features/heading/client/index.d.ts +1 -4
  144. package/dist/features/heading/client/index.d.ts.map +1 -1
  145. package/dist/features/heading/server/index.d.ts.map +1 -1
  146. package/dist/features/heading/server/index.js +4 -0
  147. package/dist/features/heading/server/index.js.map +1 -1
  148. package/dist/features/horizontalRule/client/component/index.d.ts +1 -1
  149. package/dist/features/horizontalRule/client/component/index.d.ts.map +1 -1
  150. package/dist/features/horizontalRule/client/component/index.js +12 -9
  151. package/dist/features/horizontalRule/client/component/index.js.map +1 -1
  152. package/dist/features/horizontalRule/client/index.d.ts +1 -4
  153. package/dist/features/horizontalRule/client/index.d.ts.map +1 -1
  154. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +2 -2
  155. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  156. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  157. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  158. package/dist/features/indent/client/index.d.ts +1 -4
  159. package/dist/features/indent/client/index.d.ts.map +1 -1
  160. package/dist/features/indent/client/index.js +2 -1
  161. package/dist/features/indent/client/index.js.map +1 -1
  162. package/dist/features/link/client/index.d.ts +1 -13
  163. package/dist/features/link/client/index.d.ts.map +1 -1
  164. package/dist/features/link/client/index.js +2 -2
  165. package/dist/features/link/client/index.js.map +1 -1
  166. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  167. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  168. package/dist/features/link/client/plugins/autoLink/index.js +3 -1
  169. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  170. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  171. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +21 -20
  172. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  173. package/dist/features/link/client/plugins/floatingLinkEditor/index.d.ts.map +1 -1
  174. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +1 -1
  175. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  176. package/dist/features/link/nodes/AutoLinkNode.js +2 -2
  177. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  178. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  179. package/dist/features/link/nodes/LinkNode.js +12 -7
  180. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  181. package/dist/features/link/nodes/types.d.ts +3 -3
  182. package/dist/features/link/nodes/types.d.ts.map +1 -1
  183. package/dist/features/link/nodes/types.js.map +1 -1
  184. package/dist/features/link/server/baseFields.d.ts +1 -1
  185. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  186. package/dist/features/link/server/baseFields.js +15 -3
  187. package/dist/features/link/server/baseFields.js.map +1 -1
  188. package/dist/features/link/server/index.d.ts.map +1 -1
  189. package/dist/features/link/server/index.js +17 -4
  190. package/dist/features/link/server/index.js.map +1 -1
  191. package/dist/features/link/server/transformExtraFields.d.ts +1 -1
  192. package/dist/features/link/server/transformExtraFields.d.ts.map +1 -1
  193. package/dist/features/link/server/transformExtraFields.js.map +1 -1
  194. package/dist/features/link/server/validate.d.ts.map +1 -1
  195. package/dist/features/link/server/validate.js +8 -5
  196. package/dist/features/link/server/validate.js.map +1 -1
  197. package/dist/features/lists/checklist/client/index.d.ts +1 -4
  198. package/dist/features/lists/checklist/client/index.d.ts.map +1 -1
  199. package/dist/features/lists/htmlConverter.d.ts.map +1 -1
  200. package/dist/features/lists/htmlConverter.js +8 -0
  201. package/dist/features/lists/htmlConverter.js.map +1 -1
  202. package/dist/features/lists/orderedList/client/index.d.ts +1 -4
  203. package/dist/features/lists/orderedList/client/index.d.ts.map +1 -1
  204. package/dist/features/lists/shared/markdown.js.map +1 -1
  205. package/dist/features/lists/unorderedList/client/index.d.ts +1 -4
  206. package/dist/features/lists/unorderedList/client/index.d.ts.map +1 -1
  207. package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts.map +1 -1
  208. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +1 -0
  209. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +1 -1
  210. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts +1 -4
  211. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +1 -1
  212. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
  213. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  214. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  215. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +1 -1
  216. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +1 -1
  217. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +1 -1
  218. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +1 -1
  219. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +1 -1
  220. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +1 -1
  221. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +1 -1
  222. package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
  223. package/dist/features/migrations/slateToLexical/converter/index.js +1 -0
  224. package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
  225. package/dist/features/migrations/slateToLexical/feature.client.d.ts +1 -4
  226. package/dist/features/migrations/slateToLexical/feature.client.d.ts.map +1 -1
  227. package/dist/features/migrations/slateToLexical/feature.client.js +1 -3
  228. package/dist/features/migrations/slateToLexical/feature.client.js.map +1 -1
  229. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
  230. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  231. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  232. package/dist/features/paragraph/client/index.d.ts +1 -4
  233. package/dist/features/paragraph/client/index.d.ts.map +1 -1
  234. package/dist/features/paragraph/server/index.d.ts +1 -1
  235. package/dist/features/paragraph/server/index.d.ts.map +1 -1
  236. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  237. package/dist/features/relationship/client/components/RelationshipComponent.js +42 -29
  238. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  239. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  240. package/dist/features/relationship/client/drawer/index.js +27 -26
  241. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  242. package/dist/features/relationship/client/index.d.ts +2 -17
  243. package/dist/features/relationship/client/index.d.ts.map +1 -1
  244. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  245. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  246. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  247. package/dist/features/relationship/client/plugins/index.js +1 -1
  248. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  249. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +1 -1
  250. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
  251. package/dist/features/relationship/server/index.d.ts +1 -1
  252. package/dist/features/relationship/server/index.d.ts.map +1 -1
  253. package/dist/features/relationship/server/index.js +50 -40
  254. package/dist/features/relationship/server/index.js.map +1 -1
  255. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +8 -6
  256. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  257. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  258. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  259. package/dist/features/toolbars/fixed/client/Toolbar/index.js +93 -66
  260. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  261. package/dist/features/toolbars/fixed/client/index.d.ts +1 -4
  262. package/dist/features/toolbars/fixed/client/index.d.ts.map +1 -1
  263. package/dist/features/toolbars/inline/client/Toolbar/index.js +43 -46
  264. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  265. package/dist/features/toolbars/inline/client/index.d.ts +1 -4
  266. package/dist/features/toolbars/inline/client/index.d.ts.map +1 -1
  267. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  268. package/dist/features/toolbars/shared/ToolbarButton/index.js +4 -1
  269. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  270. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +2 -2
  271. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  272. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +12 -6
  273. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  274. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +4 -5
  275. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  276. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +119 -116
  277. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  278. package/dist/features/toolbars/types.d.ts +23 -11
  279. package/dist/features/toolbars/types.d.ts.map +1 -1
  280. package/dist/features/toolbars/types.js.map +1 -1
  281. package/dist/features/typesClient.d.ts +10 -11
  282. package/dist/features/typesClient.d.ts.map +1 -1
  283. package/dist/features/typesClient.js.map +1 -1
  284. package/dist/features/typesServer.d.ts +17 -26
  285. package/dist/features/typesServer.d.ts.map +1 -1
  286. package/dist/features/typesServer.js.map +1 -1
  287. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  288. package/dist/features/upload/client/component/index.js +69 -58
  289. package/dist/features/upload/client/component/index.js.map +1 -1
  290. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  291. package/dist/features/upload/client/drawer/index.js +34 -32
  292. package/dist/features/upload/client/drawer/index.js.map +1 -1
  293. package/dist/features/upload/client/feature.client.d.ts +1 -4
  294. package/dist/features/upload/client/feature.client.d.ts.map +1 -1
  295. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  296. package/dist/features/upload/client/nodes/UploadNode.js +1 -1
  297. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  298. package/dist/features/upload/client/plugin/index.js +1 -1
  299. package/dist/features/upload/client/plugin/index.js.map +1 -1
  300. package/dist/features/upload/server/feature.server.d.ts.map +1 -1
  301. package/dist/features/upload/server/feature.server.js +17 -8
  302. package/dist/features/upload/server/feature.server.js.map +1 -1
  303. package/dist/features/upload/server/nodes/UploadNode.d.ts +9 -7
  304. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  305. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  306. package/dist/features/upload/server/validate.d.ts.map +1 -1
  307. package/dist/features/upload/server/validate.js +7 -4
  308. package/dist/features/upload/server/validate.js.map +1 -1
  309. package/dist/field/Field.d.ts.map +1 -1
  310. package/dist/field/Field.js +29 -44
  311. package/dist/field/Field.js.map +1 -1
  312. package/dist/field/bundled.css +1 -1
  313. package/dist/field/index.d.ts.map +1 -1
  314. package/dist/field/index.js +63 -73
  315. package/dist/field/index.js.map +1 -1
  316. package/dist/field/rscEntry.d.ts +9 -0
  317. package/dist/field/rscEntry.d.ts.map +1 -0
  318. package/dist/field/rscEntry.js +37 -0
  319. package/dist/field/rscEntry.js.map +1 -0
  320. package/dist/index.d.ts +4 -3
  321. package/dist/index.d.ts.map +1 -1
  322. package/dist/index.js +94 -103
  323. package/dist/index.js.map +1 -1
  324. package/dist/lexical/EditorPlugin.d.ts.map +1 -1
  325. package/dist/lexical/EditorPlugin.js +2 -1
  326. package/dist/lexical/EditorPlugin.js.map +1 -1
  327. package/dist/lexical/LexicalEditor.d.ts +1 -1
  328. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  329. package/dist/lexical/LexicalEditor.js +10 -10
  330. package/dist/lexical/LexicalEditor.js.map +1 -1
  331. package/dist/lexical/LexicalProvider.d.ts +2 -2
  332. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  333. package/dist/lexical/LexicalProvider.js +9 -7
  334. package/dist/lexical/LexicalProvider.js.map +1 -1
  335. package/dist/lexical/config/client/EditorConfigProvider.d.ts +6 -5
  336. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  337. package/dist/lexical/config/client/EditorConfigProvider.js +13 -12
  338. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  339. package/dist/lexical/config/client/loader.d.ts +1 -3
  340. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  341. package/dist/lexical/config/client/loader.js +7 -19
  342. package/dist/lexical/config/client/loader.js.map +1 -1
  343. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  344. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  345. package/dist/lexical/config/client/sanitize.js +4 -4
  346. package/dist/lexical/config/client/sanitize.js.map +1 -1
  347. package/dist/lexical/config/server/loader.d.ts +2 -1
  348. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  349. package/dist/lexical/config/server/loader.js +2 -0
  350. package/dist/lexical/config/server/loader.js.map +1 -1
  351. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  352. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  353. package/dist/lexical/config/server/sanitize.js +12 -11
  354. package/dist/lexical/config/server/sanitize.js.map +1 -1
  355. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +4 -4
  356. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  357. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +82 -113
  358. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  359. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +2 -2
  360. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  361. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +2 -2
  362. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  363. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +3 -2
  364. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  365. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  366. package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  367. package/dist/lexical/plugins/SlashMenu/index.js +24 -30
  368. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  369. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
  370. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +93 -130
  371. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  372. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts +1 -1
  373. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  374. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js +1 -1
  375. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js.map +1 -1
  376. package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js +1 -1
  377. package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js.map +1 -1
  378. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  379. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +119 -137
  380. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  381. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts.map +1 -1
  382. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +16 -32
  383. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
  384. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts.map +1 -1
  385. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js +3 -1
  386. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -1
  387. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.d.ts.map +1 -1
  388. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js +3 -4
  389. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -1
  390. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  391. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +4 -6
  392. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  393. package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
  394. package/dist/lexical/theme/EditorTheme.js +1 -2
  395. package/dist/lexical/theme/EditorTheme.js.map +1 -1
  396. package/dist/lexical/ui/icons/Caret/index.svg +2 -2
  397. package/dist/lexical/utils/nodeFormat.d.ts +2 -2
  398. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  399. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  400. package/dist/lexical/utils/rect.d.ts +4 -4
  401. package/dist/lexical/utils/rect.d.ts.map +1 -1
  402. package/dist/lexical/utils/rect.js.map +1 -1
  403. package/dist/lexical/utils/setFloatingElemPosition.d.ts +1 -1
  404. package/dist/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
  405. package/dist/lexical/utils/setFloatingElemPosition.js +1 -1
  406. package/dist/lexical/utils/setFloatingElemPosition.js.map +1 -1
  407. package/dist/lexical/utils/url.d.ts +5 -0
  408. package/dist/lexical/utils/url.d.ts.map +1 -1
  409. package/dist/lexical/utils/url.js +25 -5
  410. package/dist/lexical/utils/url.js.map +1 -1
  411. package/dist/populateGraphQL/populate.d.ts +3 -2
  412. package/dist/populateGraphQL/populate.d.ts.map +1 -1
  413. package/dist/populateGraphQL/populate.js +3 -1
  414. package/dist/populateGraphQL/populate.js.map +1 -1
  415. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
  416. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  417. package/dist/populateGraphQL/populateLexicalPopulationPromises.js +5 -4
  418. package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
  419. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js.map +1 -1
  420. package/dist/types.d.ts +20 -7
  421. package/dist/types.d.ts.map +1 -1
  422. package/dist/types.js.map +1 -1
  423. package/dist/utilities/createClientFeature.d.ts +3 -5
  424. package/dist/utilities/createClientFeature.d.ts.map +1 -1
  425. package/dist/utilities/createClientFeature.js +1 -4
  426. package/dist/utilities/createClientFeature.js.map +1 -1
  427. package/dist/utilities/createServerFeature.d.ts +1 -0
  428. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  429. package/dist/utilities/createServerFeature.js +2 -0
  430. package/dist/utilities/createServerFeature.js.map +1 -1
  431. package/dist/utilities/fieldsDrawer/Drawer.d.ts +1 -0
  432. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  433. package/dist/utilities/fieldsDrawer/Drawer.js +68 -27
  434. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  435. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  436. package/dist/utilities/fieldsDrawer/DrawerContent.js +115 -139
  437. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  438. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts +13 -0
  439. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -0
  440. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +129 -0
  441. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -0
  442. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts +10 -0
  443. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -0
  444. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js +136 -0
  445. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -0
  446. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts +16 -0
  447. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -0
  448. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +144 -0
  449. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -0
  450. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  451. package/dist/utilities/generateImportMap.js +2 -3
  452. package/dist/utilities/generateImportMap.js.map +1 -1
  453. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  454. package/dist/utilities/generateSchemaMap.js +13 -10
  455. package/dist/utilities/generateSchemaMap.js.map +1 -1
  456. package/dist/utilities/initLexicalFeatures.d.ts +18 -0
  457. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -0
  458. package/dist/utilities/initLexicalFeatures.js +95 -0
  459. package/dist/utilities/initLexicalFeatures.js.map +1 -0
  460. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +1 -1
  461. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +1 -1
  462. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +1 -1
  463. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
  464. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts +1 -1
  465. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  466. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +5 -1
  467. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  468. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  469. package/dist/utilities/useLexicalFeature.js +12 -4
  470. package/dist/utilities/useLexicalFeature.js.map +1 -1
  471. package/dist/validate/index.d.ts.map +1 -1
  472. package/dist/validate/index.js +2 -2
  473. package/dist/validate/index.js.map +1 -1
  474. package/dist/validate/validateNodes.d.ts +2 -2
  475. package/dist/validate/validateNodes.d.ts.map +1 -1
  476. package/dist/validate/validateNodes.js +4 -4
  477. package/dist/validate/validateNodes.js.map +1 -1
  478. package/package.json +51 -49
  479. package/dist/cell/index.d.ts +0 -9
  480. package/dist/cell/index.d.ts.map +0 -1
  481. package/dist/cell/index.js +0 -135
  482. package/dist/cell/index.js.map +0 -1
  483. package/dist/exports/client/Field-63NGLPJB.js +0 -2
  484. package/dist/exports/client/Field-63NGLPJB.js.map +0 -7
  485. package/dist/exports/client/RelationshipComponent-3QWBV4GT.js +0 -2
  486. package/dist/exports/client/RelationshipComponent-3QWBV4GT.js.map +0 -7
  487. package/dist/exports/client/chunk-G5DTIOPI.js +0 -2
  488. package/dist/exports/client/chunk-G5DTIOPI.js.map +0 -7
  489. package/dist/exports/client/chunk-NI6Z4GBD.js +0 -2
  490. package/dist/exports/client/chunk-NI6Z4GBD.js.map +0 -7
  491. package/dist/exports/client/chunk-TO2W7Q2G.js +0 -2
  492. package/dist/exports/client/chunk-TO2W7Q2G.js.map +0 -7
  493. package/dist/exports/client/component-3OFD6Q4Z.js +0 -2
  494. package/dist/exports/client/component-3OFD6Q4Z.js.map +0 -7
  495. package/dist/exports/client/component-LCAAX56T.js +0 -2
  496. package/dist/exports/client/component-LCAAX56T.js.map +0 -7
  497. package/dist/exports/client/component-LLWMZU6K.js +0 -2
  498. package/dist/exports/client/component-LLWMZU6K.js.map +0 -7
  499. package/dist/exports/client/componentInline-72VZAAHP.js +0 -2
  500. package/dist/exports/client/componentInline-72VZAAHP.js.map +0 -7
  501. package/dist/features/createClientComponent.d.ts +0 -7
  502. package/dist/features/createClientComponent.d.ts.map +0 -1
  503. package/dist/features/createClientComponent.js +0 -13
  504. package/dist/features/createClientComponent.js.map +0 -1
  505. package/dist/features/createFeaturePropComponent.d.ts +0 -6
  506. package/dist/features/createFeaturePropComponent.d.ts.map +0 -1
  507. package/dist/features/createFeaturePropComponent.js +0 -19
  508. package/dist/features/createFeaturePropComponent.js.map +0 -1
  509. package/dist/utilities/generateComponentMap.d.ts +0 -6
  510. package/dist/utilities/generateComponentMap.d.ts.map +0 -1
  511. package/dist/utilities/generateComponentMap.js +0 -99
  512. package/dist/utilities/generateComponentMap.js.map +0 -1
@@ -15,7 +15,7 @@ export const richTextValidateHOC = ({
15
15
  if (value?.root?.children?.length === 1) {
16
16
  if (value?.root?.children[0]?.type === 'paragraph') {
17
17
  const paragraphNode = value?.root?.children[0];
18
- if (paragraphNode?.children?.length === 0) {
18
+ if (!paragraphNode?.children || paragraphNode?.children?.length === 0) {
19
19
  hasOnlyEmptyParagraph = true;
20
20
  } else if (paragraphNode?.children?.length === 1) {
21
21
  const paragraphNodeChild = paragraphNode?.children[0];
@@ -36,8 +36,8 @@ export const richTextValidateHOC = ({
36
36
  const rootNodes = value?.root?.children;
37
37
  if (rootNodes && Array.isArray(rootNodes) && rootNodes?.length) {
38
38
  return await validateNodes({
39
- nodeValidations: editorConfig.features.validations,
40
39
  nodes: rootNodes,
40
+ nodeValidations: editorConfig.features.validations,
41
41
  validation: {
42
42
  options,
43
43
  value
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["validateNodes","richTextValidateHOC","editorConfig","richTextValidate","value","options","req","t","required","hasChildren","root","children","length","hasOnlyEmptyParagraph","type","paragraphNode","paragraphNodeChild","rootNodes","Array","isArray","nodeValidations","features","validations","nodes","validation"],"sources":["../../src/validate/index.ts"],"sourcesContent":["import type { SerializedEditorState, SerializedParagraphNode } from 'lexical'\nimport type { RichTextField, Validate } from 'payload'\n\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\n\nimport { validateNodes } from './validateNodes.js'\n\nexport const richTextValidateHOC = ({\n editorConfig,\n}: {\n editorConfig: SanitizedServerEditorConfig\n}) => {\n const richTextValidate: Validate<SerializedEditorState, unknown, unknown, RichTextField> = async (\n value,\n options,\n ) => {\n const {\n req: { t },\n required,\n } = options\n\n if (required) {\n const hasChildren = !!value?.root?.children?.length\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 if (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?.['text']?.length) {\n hasOnlyEmptyParagraph = true\n }\n }\n }\n }\n }\n\n if (!hasChildren || hasOnlyEmptyParagraph) {\n return t('validation:required')\n }\n }\n\n // Traverse through nodes and validate them. Just like a node can hook into the population process (e.g. link or relationship nodes),\n // they can also hook into the validation process. E.g. a block node probably has fields with validation rules.\n\n const rootNodes = value?.root?.children\n if (rootNodes && Array.isArray(rootNodes) && rootNodes?.length) {\n return await validateNodes({\n nodeValidations: editorConfig.features.validations,\n nodes: rootNodes,\n validation: {\n options,\n value,\n },\n })\n }\n\n return true\n }\n\n return richTextValidate\n}\n"],"mappings":"AAKA,SAASA,aAAa,QAAQ;AAE9B,OAAO,MAAMC,mBAAA,GAAsBA,CAAC;EAClCC;AAAY,CAGb;EACC,MAAMC,gBAAA,GAAqF,MAAAA,CACzFC,KAAA,EACAC,OAAA;IAEA,MAAM;MACJC,GAAA,EAAK;QAAEC;MAAC,CAAE;MACVC;IAAQ,CACT,GAAGH,OAAA;IAEJ,IAAIG,QAAA,EAAU;MACZ,MAAMC,WAAA,GAAc,CAAC,CAACL,KAAA,EAAOM,IAAA,EAAMC,QAAA,EAAUC,MAAA;MAE7C,IAAIC,qBAAA,GAAwB;MAC5B,IAAIT,KAAA,EAAOM,IAAA,EAAMC,QAAA,EAAUC,MAAA,KAAW,GAAG;QACvC,IAAIR,KAAA,EAAOM,IAAA,EAAMC,QAAQ,CAAC,EAAE,EAAEG,IAAA,KAAS,aAAa;UAClD,MAAMC,aAAA,GAAgBX,KAAA,EAAOM,IAAA,EAAMC,QAAQ,CAAC,EAAE;UAC9C,IAAII,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;YACzCC,qBAAA,GAAwB;UAC1B,OAAO,IAAIE,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;YAChD,MAAMI,kBAAA,GAAqBD,aAAA,EAAeJ,QAAQ,CAAC,EAAE;YACrD,IAAIK,kBAAA,CAAmBF,IAAI,KAAK,QAAQ;cACtC,IAAI,CAACE,kBAAA,GAAqB,OAAO,EAAEJ,MAAA,EAAQ;gBACzCC,qBAAA,GAAwB;cAC1B;YACF;UACF;QACF;MACF;MAEA,IAAI,CAACJ,WAAA,IAAeI,qBAAA,EAAuB;QACzC,OAAON,CAAA,CAAE;MACX;IACF;IAEA;IACA;IAEA,MAAMU,SAAA,GAAYb,KAAA,EAAOM,IAAA,EAAMC,QAAA;IAC/B,IAAIM,SAAA,IAAaC,KAAA,CAAMC,OAAO,CAACF,SAAA,KAAcA,SAAA,EAAWL,MAAA,EAAQ;MAC9D,OAAO,MAAMZ,aAAA,CAAc;QACzBoB,eAAA,EAAiBlB,YAAA,CAAamB,QAAQ,CAACC,WAAW;QAClDC,KAAA,EAAON,SAAA;QACPO,UAAA,EAAY;UACVnB,OAAA;UACAD;QACF;MACF;IACF;IAEA,OAAO;EACT;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["validateNodes","richTextValidateHOC","editorConfig","richTextValidate","value","options","req","t","required","hasChildren","root","children","length","hasOnlyEmptyParagraph","type","paragraphNode","paragraphNodeChild","rootNodes","Array","isArray","nodes","nodeValidations","features","validations","validation"],"sources":["../../src/validate/index.ts"],"sourcesContent":["import type { SerializedEditorState, SerializedParagraphNode } from 'lexical'\nimport type { RichTextField, Validate } from 'payload'\n\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\n\nimport { validateNodes } from './validateNodes.js'\n\nexport const richTextValidateHOC = ({\n editorConfig,\n}: {\n editorConfig: SanitizedServerEditorConfig\n}) => {\n const richTextValidate: Validate<SerializedEditorState, unknown, unknown, RichTextField> = async (\n value,\n options,\n ) => {\n const {\n req: { t },\n required,\n } = options\n\n if (required) {\n const hasChildren = !!value?.root?.children?.length\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?.['text']?.length) {\n hasOnlyEmptyParagraph = true\n }\n }\n }\n }\n }\n\n if (!hasChildren || hasOnlyEmptyParagraph) {\n return t('validation:required')\n }\n }\n\n // Traverse through nodes and validate them. Just like a node can hook into the population process (e.g. link or relationship nodes),\n // they can also hook into the validation process. E.g. a block node probably has fields with validation rules.\n\n const rootNodes = value?.root?.children\n if (rootNodes && Array.isArray(rootNodes) && rootNodes?.length) {\n return await validateNodes({\n nodes: rootNodes,\n nodeValidations: editorConfig.features.validations,\n validation: {\n options,\n value,\n },\n })\n }\n\n return true\n }\n\n return richTextValidate\n}\n"],"mappings":"AAKA,SAASA,aAAa,QAAQ;AAE9B,OAAO,MAAMC,mBAAA,GAAsBA,CAAC;EAClCC;AAAY,CAGb;EACC,MAAMC,gBAAA,GAAqF,MAAAA,CACzFC,KAAA,EACAC,OAAA;IAEA,MAAM;MACJC,GAAA,EAAK;QAAEC;MAAC,CAAE;MACVC;IAAQ,CACT,GAAGH,OAAA;IAEJ,IAAIG,QAAA,EAAU;MACZ,MAAMC,WAAA,GAAc,CAAC,CAACL,KAAA,EAAOM,IAAA,EAAMC,QAAA,EAAUC,MAAA;MAE7C,IAAIC,qBAAA,GAAwB;MAC5B,IAAIT,KAAA,EAAOM,IAAA,EAAMC,QAAA,EAAUC,MAAA,KAAW,GAAG;QACvC,IAAIR,KAAA,EAAOM,IAAA,EAAMC,QAAQ,CAAC,EAAE,EAAEG,IAAA,KAAS,aAAa;UAClD,MAAMC,aAAA,GAAgBX,KAAA,EAAOM,IAAA,EAAMC,QAAQ,CAAC,EAAE;UAE9C,IAAI,CAACI,aAAA,EAAeJ,QAAA,IAAYI,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;YACrEC,qBAAA,GAAwB;UAC1B,OAAO,IAAIE,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;YAChD,MAAMI,kBAAA,GAAqBD,aAAA,EAAeJ,QAAQ,CAAC,EAAE;YACrD,IAAIK,kBAAA,CAAmBF,IAAI,KAAK,QAAQ;cACtC,IAAI,CAACE,kBAAA,GAAqB,OAAO,EAAEJ,MAAA,EAAQ;gBACzCC,qBAAA,GAAwB;cAC1B;YACF;UACF;QACF;MACF;MAEA,IAAI,CAACJ,WAAA,IAAeI,qBAAA,EAAuB;QACzC,OAAON,CAAA,CAAE;MACX;IACF;IAEA;IACA;IAEA,MAAMU,SAAA,GAAYb,KAAA,EAAOM,IAAA,EAAMC,QAAA;IAC/B,IAAIM,SAAA,IAAaC,KAAA,CAAMC,OAAO,CAACF,SAAA,KAAcA,SAAA,EAAWL,MAAA,EAAQ;MAC9D,OAAO,MAAMZ,aAAA,CAAc;QACzBoB,KAAA,EAAOH,SAAA;QACPI,eAAA,EAAiBnB,YAAA,CAAaoB,QAAQ,CAACC,WAAW;QAClDC,UAAA,EAAY;UACVnB,OAAA;UACAD;QACF;MACF;IACF;IAEA,OAAO;EACT;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
@@ -1,9 +1,9 @@
1
1
  import type { SerializedEditorState, SerializedLexicalNode } from 'lexical';
2
2
  import type { RichTextField, ValidateOptions } from 'payload';
3
3
  import type { NodeValidation } from '../features/typesServer.js';
4
- export declare function validateNodes({ nodeValidations, nodes, validation: validationFromProps, }: {
5
- nodeValidations: Map<string, Array<NodeValidation>>;
4
+ export declare function validateNodes({ nodes, nodeValidations, validation: validationFromProps, }: {
6
5
  nodes: SerializedLexicalNode[];
6
+ nodeValidations: Map<string, Array<NodeValidation>>;
7
7
  validation: {
8
8
  options: ValidateOptions<unknown, unknown, RichTextField, SerializedEditorState>;
9
9
  value: SerializedEditorState;
@@ -1 +1 @@
1
- {"version":3,"file":"validateNodes.d.ts","sourceRoot":"","sources":["../../src/validate/validateNodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAEhE,wBAAsB,aAAa,CAAC,EAClC,eAAe,EACf,KAAK,EACL,UAAU,EAAE,mBAAmB,GAChC,EAAE;IACD,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAA;IACnD,KAAK,EAAE,qBAAqB,EAAE,CAAA;IAC9B,UAAU,EAAE;QACV,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,qBAAqB,CAAC,CAAA;QAChF,KAAK,EAAE,qBAAqB,CAAA;KAC7B,CAAA;CACF,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmCzB"}
1
+ {"version":3,"file":"validateNodes.d.ts","sourceRoot":"","sources":["../../src/validate/validateNodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAEhE,wBAAsB,aAAa,CAAC,EAClC,KAAK,EACL,eAAe,EACf,UAAU,EAAE,mBAAmB,GAChC,EAAE;IACD,KAAK,EAAE,qBAAqB,EAAE,CAAA;IAC9B,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAA;IACnD,UAAU,EAAE;QACV,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,qBAAqB,CAAC,CAAA;QAChF,KAAK,EAAE,qBAAqB,CAAA;KAC7B,CAAA;CACF,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+BzB"}
@@ -1,12 +1,12 @@
1
1
  export async function validateNodes({
2
- nodeValidations,
3
2
  nodes,
3
+ nodeValidations,
4
4
  validation: validationFromProps
5
5
  }) {
6
6
  for (const node of nodes) {
7
7
  // Validate node
8
- if (nodeValidations && typeof nodeValidations?.has === 'function' && nodeValidations?.has(node.type)) {
9
- const validations = nodeValidations.get(node.type);
8
+ const validations = nodeValidations.get(node.type);
9
+ if (validations) {
10
10
  for (const validation of validations) {
11
11
  const validationResult = await validation({
12
12
  node,
@@ -21,8 +21,8 @@ export async function validateNodes({
21
21
  // Validate node's children
22
22
  if ('children' in node && node?.children) {
23
23
  const childrenValidationResult = await validateNodes({
24
- nodeValidations,
25
24
  nodes: node.children,
25
+ nodeValidations,
26
26
  validation: validationFromProps
27
27
  });
28
28
  if (childrenValidationResult !== true) {
@@ -1 +1 @@
1
- {"version":3,"file":"validateNodes.js","names":["validateNodes","nodeValidations","nodes","validation","validationFromProps","node","has","type","validations","get","validationResult","children","childrenValidationResult"],"sources":["../../src/validate/validateNodes.ts"],"sourcesContent":["import type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\nimport type { RichTextField, ValidateOptions } from 'payload'\n\nimport type { NodeValidation } from '../features/typesServer.js'\n\nexport async function validateNodes({\n nodeValidations,\n nodes,\n validation: validationFromProps,\n}: {\n nodeValidations: Map<string, Array<NodeValidation>>\n nodes: SerializedLexicalNode[]\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField, SerializedEditorState>\n value: SerializedEditorState\n }\n}): Promise<string | true> {\n for (const node of nodes) {\n // Validate node\n if (\n nodeValidations &&\n typeof nodeValidations?.has === 'function' &&\n nodeValidations?.has(node.type)\n ) {\n const validations = nodeValidations.get(node.type)\n for (const validation of validations) {\n const validationResult = await validation({\n node,\n nodeValidations,\n validation: validationFromProps,\n })\n if (validationResult !== true) {\n return `${node.type} node failed to validate: ${validationResult}`\n }\n }\n }\n\n // Validate node's children\n if ('children' in node && node?.children) {\n const childrenValidationResult = await validateNodes({\n nodeValidations,\n nodes: node.children as SerializedLexicalNode[],\n validation: validationFromProps,\n })\n if (childrenValidationResult !== true) {\n return childrenValidationResult\n }\n }\n }\n\n return true\n}\n"],"mappings":"AAKA,OAAO,eAAeA,cAAc;EAClCC,eAAe;EACfC,KAAK;EACLC,UAAA,EAAYC;AAAmB,CAQhC;EACC,KAAK,MAAMC,IAAA,IAAQH,KAAA,EAAO;IACxB;IACA,IACED,eAAA,IACA,OAAOA,eAAA,EAAiBK,GAAA,KAAQ,cAChCL,eAAA,EAAiBK,GAAA,CAAID,IAAA,CAAKE,IAAI,GAC9B;MACA,MAAMC,WAAA,GAAcP,eAAA,CAAgBQ,GAAG,CAACJ,IAAA,CAAKE,IAAI;MACjD,KAAK,MAAMJ,UAAA,IAAcK,WAAA,EAAa;QACpC,MAAME,gBAAA,GAAmB,MAAMP,UAAA,CAAW;UACxCE,IAAA;UACAJ,eAAA;UACAE,UAAA,EAAYC;QACd;QACA,IAAIM,gBAAA,KAAqB,MAAM;UAC7B,OAAO,GAAGL,IAAA,CAAKE,IAAI,6BAA6BG,gBAAA,EAAkB;QACpE;MACF;IACF;IAEA;IACA,IAAI,cAAcL,IAAA,IAAQA,IAAA,EAAMM,QAAA,EAAU;MACxC,MAAMC,wBAAA,GAA2B,MAAMZ,aAAA,CAAc;QACnDC,eAAA;QACAC,KAAA,EAAOG,IAAA,CAAKM,QAAQ;QACpBR,UAAA,EAAYC;MACd;MACA,IAAIQ,wBAAA,KAA6B,MAAM;QACrC,OAAOA,wBAAA;MACT;IACF;EACF;EAEA,OAAO;AACT","ignoreList":[]}
1
+ {"version":3,"file":"validateNodes.js","names":["validateNodes","nodes","nodeValidations","validation","validationFromProps","node","validations","get","type","validationResult","children","childrenValidationResult"],"sources":["../../src/validate/validateNodes.ts"],"sourcesContent":["import type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\nimport type { RichTextField, ValidateOptions } from 'payload'\n\nimport type { NodeValidation } from '../features/typesServer.js'\n\nexport async function validateNodes({\n nodes,\n nodeValidations,\n validation: validationFromProps,\n}: {\n nodes: SerializedLexicalNode[]\n nodeValidations: Map<string, Array<NodeValidation>>\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField, SerializedEditorState>\n value: SerializedEditorState\n }\n}): Promise<string | true> {\n for (const node of nodes) {\n // Validate node\n const validations = nodeValidations.get(node.type)\n if (validations) {\n for (const validation of validations) {\n const validationResult = await validation({\n node,\n nodeValidations,\n validation: validationFromProps,\n })\n if (validationResult !== true) {\n return `${node.type} node failed to validate: ${validationResult}`\n }\n }\n }\n\n // Validate node's children\n if ('children' in node && node?.children) {\n const childrenValidationResult = await validateNodes({\n nodes: node.children as SerializedLexicalNode[],\n nodeValidations,\n validation: validationFromProps,\n })\n if (childrenValidationResult !== true) {\n return childrenValidationResult\n }\n }\n }\n\n return true\n}\n"],"mappings":"AAKA,OAAO,eAAeA,cAAc;EAClCC,KAAK;EACLC,eAAe;EACfC,UAAA,EAAYC;AAAmB,CAQhC;EACC,KAAK,MAAMC,IAAA,IAAQJ,KAAA,EAAO;IACxB;IACA,MAAMK,WAAA,GAAcJ,eAAA,CAAgBK,GAAG,CAACF,IAAA,CAAKG,IAAI;IACjD,IAAIF,WAAA,EAAa;MACf,KAAK,MAAMH,UAAA,IAAcG,WAAA,EAAa;QACpC,MAAMG,gBAAA,GAAmB,MAAMN,UAAA,CAAW;UACxCE,IAAA;UACAH,eAAA;UACAC,UAAA,EAAYC;QACd;QACA,IAAIK,gBAAA,KAAqB,MAAM;UAC7B,OAAO,GAAGJ,IAAA,CAAKG,IAAI,6BAA6BC,gBAAA,EAAkB;QACpE;MACF;IACF;IAEA;IACA,IAAI,cAAcJ,IAAA,IAAQA,IAAA,EAAMK,QAAA,EAAU;MACxC,MAAMC,wBAAA,GAA2B,MAAMX,aAAA,CAAc;QACnDC,KAAA,EAAOI,IAAA,CAAKK,QAAQ;QACpBR,eAAA;QACAC,UAAA,EAAYC;MACd;MACA,IAAIO,wBAAA,KAA6B,MAAM;QACrC,OAAOA,wBAAA;MACT;IACF;EACF;EAEA,OAAO;AACT","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.0.0-canary.b8dd0db",
3
+ "version": "3.0.0-canary.bb00d64",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -23,15 +23,15 @@
23
23
  "types": "./dist/exports/client/index.d.ts",
24
24
  "default": "./dist/exports/client/index.js"
25
25
  },
26
+ "./rsc": {
27
+ "import": "./dist/exports/server/rsc.js",
28
+ "types": "./dist/exports/server/rsc.d.ts",
29
+ "default": "./dist/exports/server/rsc.js"
30
+ },
26
31
  "./migrate": {
27
32
  "import": "./dist/exports/server/migrate.js",
28
33
  "types": "./dist/exports/server/migrate.d.ts",
29
34
  "default": "./dist/exports/server/migrate.js"
30
- },
31
- "./generateComponentMap": {
32
- "import": "./dist/utilities/generateComponentMap.js",
33
- "types": "./dist/utilities/generateComponentMap.d.ts",
34
- "default": "./dist/utilities/generateComponentMap.js"
35
35
  }
36
36
  },
37
37
  "main": "./dist/index.js",
@@ -40,21 +40,25 @@
40
40
  "dist"
41
41
  ],
42
42
  "dependencies": {
43
- "@lexical/headless": "0.17.0",
44
- "@lexical/link": "0.17.0",
45
- "@lexical/list": "0.17.0",
46
- "@lexical/mark": "0.17.0",
47
- "@lexical/markdown": "0.17.0",
48
- "@lexical/react": "0.17.0",
49
- "@lexical/rich-text": "0.17.0",
50
- "@lexical/selection": "0.17.0",
51
- "@lexical/utils": "0.17.0",
43
+ "@lexical/headless": "0.18.0",
44
+ "@lexical/link": "0.18.0",
45
+ "@lexical/list": "0.18.0",
46
+ "@lexical/mark": "0.18.0",
47
+ "@lexical/markdown": "0.18.0",
48
+ "@lexical/react": "0.18.0",
49
+ "@lexical/rich-text": "0.18.0",
50
+ "@lexical/selection": "0.18.0",
51
+ "@lexical/utils": "0.18.0",
52
52
  "@types/uuid": "10.0.0",
53
53
  "bson-objectid": "2.0.4",
54
54
  "dequal": "2.0.3",
55
- "lexical": "0.17.0",
55
+ "escape-html": "1.0.3",
56
+ "lexical": "0.18.0",
56
57
  "react-error-boundary": "4.0.13",
57
- "uuid": "10.0.0"
58
+ "ts-essentials": "10.0.3",
59
+ "uuid": "10.0.0",
60
+ "@payloadcms/translations": "3.0.0-canary.bb00d64",
61
+ "@payloadcms/ui": "3.0.0-canary.bb00d64"
58
62
  },
59
63
  "devDependencies": {
60
64
  "@babel/cli": "^7.24.5",
@@ -62,43 +66,39 @@
62
66
  "@babel/preset-env": "^7.24.5",
63
67
  "@babel/preset-react": "^7.24.1",
64
68
  "@babel/preset-typescript": "^7.24.1",
65
- "@lexical/eslint-plugin": "0.17.0",
69
+ "@lexical/eslint-plugin": "0.18.0",
70
+ "@types/escape-html": "1.0.4",
66
71
  "@types/json-schema": "7.0.15",
67
- "@types/node": "20.12.5",
68
- "@types/react": "npm:types-react@19.0.0-rc.0",
69
- "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
70
- "babel-plugin-react-compiler": "0.0.0-experimental-1cd8995-20240814",
72
+ "@types/node": "22.5.4",
73
+ "@types/react": "npm:types-react@19.0.0-rc.1",
74
+ "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
75
+ "babel-plugin-react-compiler": "0.0.0-experimental-24ec0eb-20240918",
71
76
  "babel-plugin-transform-remove-imports": "^1.8.0",
72
- "esbuild": "0.23.0",
77
+ "esbuild": "0.23.1",
73
78
  "esbuild-sass-plugin": "3.3.1",
74
- "eslint-plugin-react-compiler": "0.0.0-experimental-d0e920e-20240815",
79
+ "eslint-plugin-react-compiler": "0.0.0-experimental-7670337-20240918",
75
80
  "swc-plugin-transform-remove-imports": "1.15.0",
76
- "@payloadcms/eslint-config": "3.0.0-beta.59",
77
- "@payloadcms/next": "3.0.0-canary.b8dd0db",
78
- "@payloadcms/translations": "3.0.0-canary.b8dd0db",
79
- "@payloadcms/ui": "3.0.0-canary.b8dd0db",
80
- "payload": "3.0.0-canary.b8dd0db"
81
+ "@payloadcms/eslint-config": "3.0.0-beta.112",
82
+ "payload": "3.0.0-canary.bb00d64"
81
83
  },
82
84
  "peerDependencies": {
83
85
  "@faceless-ui/modal": "3.0.0-beta.2",
84
86
  "@faceless-ui/scroll-info": "2.0.0-beta.0",
85
- "@lexical/headless": "0.17.0",
86
- "@lexical/link": "0.17.0",
87
- "@lexical/list": "0.17.0",
88
- "@lexical/mark": "0.17.0",
89
- "@lexical/markdown": "0.17.0",
90
- "@lexical/react": "0.17.0",
91
- "@lexical/rich-text": "0.17.0",
92
- "@lexical/selection": "0.17.0",
93
- "@lexical/table": "0.17.0",
94
- "@lexical/utils": "0.17.0",
95
- "lexical": "0.17.0",
96
- "react": "^19.0.0 || ^19.0.0-rc-06d0b89e-20240801",
97
- "react-dom": "^19.0.0 || ^19.0.0-rc-06d0b89e-20240801",
98
- "@payloadcms/next": "3.0.0-canary.b8dd0db",
99
- "@payloadcms/translations": "3.0.0-canary.b8dd0db",
100
- "@payloadcms/ui": "3.0.0-canary.b8dd0db",
101
- "payload": "3.0.0-canary.b8dd0db"
87
+ "@lexical/headless": "0.18.0",
88
+ "@lexical/link": "0.18.0",
89
+ "@lexical/list": "0.18.0",
90
+ "@lexical/mark": "0.18.0",
91
+ "@lexical/markdown": "0.18.0",
92
+ "@lexical/react": "0.18.0",
93
+ "@lexical/rich-text": "0.18.0",
94
+ "@lexical/selection": "0.18.0",
95
+ "@lexical/table": "0.18.0",
96
+ "@lexical/utils": "0.18.0",
97
+ "lexical": "0.18.0",
98
+ "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
99
+ "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
100
+ "@payloadcms/next": "3.0.0-canary.bb00d64",
101
+ "payload": "3.0.0-canary.bb00d64"
102
102
  },
103
103
  "engines": {
104
104
  "node": "^18.20.2 || >=20.9.0"
@@ -107,8 +107,8 @@
107
107
  "registry": "https://registry.npmjs.org/"
108
108
  },
109
109
  "overrides": {
110
- "@types/react": "npm:types-react@19.0.0-rc.0",
111
- "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0"
110
+ "@types/react": "npm:types-react@19.0.0-rc.1",
111
+ "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1"
112
112
  },
113
113
  "scripts": {
114
114
  "build": "pnpm build:reactcompiler",
@@ -118,9 +118,11 @@
118
118
  "build:reactcompiler": "rm -rf dist && rm -rf tsconfig.tsbuildinfo && pnpm build:swc && pnpm build:babel && pnpm copyfiles && pnpm build:esbuild && pnpm build:types",
119
119
  "build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
120
120
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
121
- "build_without_reactcompiler": "rm -rf dist && rm -rf tsconfig.tsbuildinfo && pnpm copyfiles && pnpm build:types && pnpm build:swc && pnpm build:esbuild && rm -rf dist/exports/client && mv dist/exports/client_unoptimized dist/exports/client",
121
+ "build:without_reactcompiler": "rm -rf dist && rm -rf tsconfig.tsbuildinfo && pnpm copyfiles && pnpm build:types && pnpm build:swc && pnpm build:esbuild && rm -rf dist/exports/client && mv dist/exports/client_unoptimized dist/exports/client",
122
122
  "clean": "rimraf {dist,*.tsbuildinfo}",
123
123
  "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
124
+ "lint": "eslint .",
125
+ "lint:fix": "eslint . --fix",
124
126
  "translateNewKeys": "node --no-deprecation --import @swc-node/register/esm-register scripts/translateNewKeys.ts"
125
127
  }
126
128
  }
@@ -1,9 +0,0 @@
1
- import type { EditorConfig as LexicalEditorConfig } from 'lexical';
2
- import type { CellComponentProps, RichTextFieldClient } from 'payload';
3
- import React from 'react';
4
- import type { LexicalFieldAdminProps } from '../types.js';
5
- export declare const RichTextCell: React.FC<{
6
- readonly admin?: LexicalFieldAdminProps;
7
- readonly lexicalEditorConfig: LexicalEditorConfig;
8
- } & CellComponentProps<RichTextFieldClient>>;
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cell/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAKtE,OAAO,KAA8B,MAAM,OAAO,CAAA;AAIlD,OAAO,KAAK,EAAqC,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAO5F,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CACjC;IACE,QAAQ,CAAC,KAAK,CAAC,EAAE,sBAAsB,CAAA;IACvC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAA;CAClD,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CA6K5C,CAAA"}
@@ -1,135 +0,0 @@
1
- 'use client';
2
-
3
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- import { createHeadlessEditor } from '@lexical/headless';
5
- import { useClientFunctions, useTableCell } from '@payloadcms/ui';
6
- import { $getRoot } from 'lexical';
7
- import React, { useEffect, useState } from 'react';
8
- import { defaultEditorLexicalConfig } from '../lexical/config/client/default.js';
9
- import { loadClientFeatures } from '../lexical/config/client/loader.js';
10
- import { sanitizeClientEditorConfig } from '../lexical/config/client/sanitize.js';
11
- import { getEnabledNodes } from '../lexical/nodes/index.js';
12
- export const RichTextCell = props => {
13
- const {
14
- admin,
15
- field: {
16
- _schemaPath,
17
- richTextComponentMap
18
- },
19
- lexicalEditorConfig
20
- } = props;
21
- const [preview, setPreview] = React.useState('Loading...');
22
- const {
23
- cellData
24
- } = useTableCell();
25
- const clientFunctions = useClientFunctions();
26
- const [hasLoadedFeatures, setHasLoadedFeatures] = useState(false);
27
- const [featureProviders, setFeatureProviders] = useState([]);
28
- const [finalSanitizedEditorConfig, setFinalSanitizedEditorConfig] = useState(null);
29
- const featureProviderComponents = richTextComponentMap.get('features').sort((a, b) => a.order - b.order) // order by order
30
- ;
31
- let featureProvidersAndComponentsToLoad = 0 // feature providers and components
32
- ;
33
- for (const featureProvider of featureProviderComponents) {
34
- const featureComponentKeys = Array.from(richTextComponentMap.keys()).filter(key => key.startsWith(`feature.${featureProvider.key}.components.`));
35
- featureProvidersAndComponentsToLoad += 1;
36
- featureProvidersAndComponentsToLoad += featureComponentKeys.length;
37
- }
38
- useEffect(() => {
39
- if (!hasLoadedFeatures) {
40
- const featureProvidersLocal = [];
41
- let featureProvidersAndComponentsLoaded = 0 // feature providers and components only
42
- ;
43
- Object.entries(clientFunctions).forEach(([key_0, plugin]) => {
44
- if (key_0.startsWith(`lexicalFeature.${_schemaPath}.`)) {
45
- if (!key_0.includes('.lexical_internal_components.')) {
46
- featureProvidersLocal.push(plugin);
47
- }
48
- featureProvidersAndComponentsLoaded++;
49
- }
50
- });
51
- if (featureProvidersAndComponentsLoaded === featureProvidersAndComponentsToLoad) {
52
- setFeatureProviders(featureProvidersLocal);
53
- setHasLoadedFeatures(true);
54
- /**
55
- * Loaded feature provided => create the final sanitized editor config
56
- */
57
- const resolvedClientFeatures = loadClientFeatures({
58
- clientFunctions,
59
- schemaPath: _schemaPath,
60
- unSanitizedEditorConfig: {
61
- features: featureProvidersLocal,
62
- lexical: lexicalEditorConfig
63
- }
64
- });
65
- setFinalSanitizedEditorConfig(sanitizeClientEditorConfig(lexicalEditorConfig ? lexicalEditorConfig : defaultEditorLexicalConfig, resolvedClientFeatures, admin));
66
- }
67
- }
68
- }, [admin, featureProviderComponents, hasLoadedFeatures, clientFunctions, _schemaPath, featureProviderComponents.length, featureProviders, finalSanitizedEditorConfig, lexicalEditorConfig, richTextComponentMap, featureProvidersAndComponentsToLoad]);
69
- useEffect(() => {
70
- if (!hasLoadedFeatures) {
71
- return;
72
- }
73
- let dataToUse = cellData;
74
- if (dataToUse == null || !hasLoadedFeatures || !finalSanitizedEditorConfig) {
75
- setPreview('');
76
- return;
77
- }
78
- // Transform data through load hooks
79
- if (finalSanitizedEditorConfig?.features?.hooks?.load?.length) {
80
- finalSanitizedEditorConfig.features.hooks.load.forEach(hook => {
81
- dataToUse = hook({
82
- incomingEditorState: dataToUse
83
- });
84
- });
85
- }
86
- if (!dataToUse || typeof dataToUse !== 'object') {
87
- setPreview('');
88
- return;
89
- }
90
- // If data is from Slate and not Lexical
91
- if (Array.isArray(dataToUse) && !('root' in dataToUse)) {
92
- setPreview('');
93
- return;
94
- }
95
- // If data is from payload-plugin-lexical
96
- if ('jsonContent' in dataToUse) {
97
- setPreview('');
98
- return;
99
- }
100
- // initialize headless editor
101
- const headlessEditor = createHeadlessEditor({
102
- namespace: finalSanitizedEditorConfig.lexical.namespace,
103
- nodes: getEnabledNodes({
104
- editorConfig: finalSanitizedEditorConfig
105
- }),
106
- theme: finalSanitizedEditorConfig.lexical.theme
107
- });
108
- headlessEditor.setEditorState(headlessEditor.parseEditorState(dataToUse));
109
- const textContent = headlessEditor.getEditorState().read(() => {
110
- return $getRoot().getTextContent();
111
- }) || '';
112
- // Limiting the number of characters shown is done in a CSS rule
113
- setPreview(textContent);
114
- }, [cellData, lexicalEditorConfig, hasLoadedFeatures, finalSanitizedEditorConfig]);
115
- if (!hasLoadedFeatures) {
116
- return /*#__PURE__*/_jsx(React.Fragment, {
117
- children: Array.isArray(featureProviderComponents) && featureProviderComponents.map(featureProvider_0 => {
118
- // get all components starting with key feature.${FeatureProvider.key}.components.{featureComponentKey}
119
- const featureComponentKeys_0 = Array.from(richTextComponentMap.keys()).filter(key_1 => key_1.startsWith(`lexical_internal_feature.${featureProvider_0.key}.lexical_internal_components.`));
120
- const featureComponents = featureComponentKeys_0.map(key_2 => {
121
- return richTextComponentMap.get(key_2);
122
- });
123
- return /*#__PURE__*/_jsxs(React.Fragment, {
124
- children: [featureComponents?.length ? featureComponents.map(FeatureComponent => {
125
- return FeatureComponent;
126
- }) : null, featureProvider_0.ClientFeature]
127
- }, featureProvider_0.key);
128
- })
129
- });
130
- }
131
- return /*#__PURE__*/_jsx("span", {
132
- children: preview
133
- });
134
- };
135
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["createHeadlessEditor","useClientFunctions","useTableCell","$getRoot","React","useEffect","useState","defaultEditorLexicalConfig","loadClientFeatures","sanitizeClientEditorConfig","getEnabledNodes","RichTextCell","props","admin","field","_schemaPath","richTextComponentMap","lexicalEditorConfig","preview","setPreview","cellData","clientFunctions","hasLoadedFeatures","setHasLoadedFeatures","featureProviders","setFeatureProviders","finalSanitizedEditorConfig","setFinalSanitizedEditorConfig","featureProviderComponents","get","sort","a","b","order","featureProvidersAndComponentsToLoad","featureProvider","featureComponentKeys","Array","from","keys","filter","key","startsWith","length","featureProvidersLocal","featureProvidersAndComponentsLoaded","Object","entries","forEach","plugin","includes","push","resolvedClientFeatures","schemaPath","unSanitizedEditorConfig","features","lexical","dataToUse","hooks","load","hook","incomingEditorState","isArray","headlessEditor","namespace","nodes","editorConfig","theme","setEditorState","parseEditorState","textContent","getEditorState","read","getTextContent","_jsx","Fragment","map","featureComponents","_jsxs","FeatureComponent","ClientFeature"],"sources":["../../src/cell/index.tsx"],"sourcesContent":["'use client'\nimport type { EditorConfig as LexicalEditorConfig } from 'lexical'\nimport type { CellComponentProps, RichTextFieldClient } from 'payload'\n\nimport { createHeadlessEditor } from '@lexical/headless'\nimport { useClientFunctions, useTableCell } from '@payloadcms/ui'\nimport { $getRoot } from 'lexical'\nimport React, { useEffect, useState } from 'react'\n\nimport type { FeatureProviderClient } from '../features/typesClient.js'\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\nimport type { GeneratedFeatureProviderComponent, LexicalFieldAdminProps } from '../types.js'\n\nimport { defaultEditorLexicalConfig } from '../lexical/config/client/default.js'\nimport { loadClientFeatures } from '../lexical/config/client/loader.js'\nimport { sanitizeClientEditorConfig } from '../lexical/config/client/sanitize.js'\nimport { getEnabledNodes } from '../lexical/nodes/index.js'\n\nexport const RichTextCell: React.FC<\n {\n readonly admin?: LexicalFieldAdminProps\n readonly lexicalEditorConfig: LexicalEditorConfig\n } & CellComponentProps<RichTextFieldClient>\n> = (props) => {\n const {\n admin,\n field: { _schemaPath, richTextComponentMap },\n lexicalEditorConfig,\n } = props\n\n const [preview, setPreview] = React.useState('Loading...')\n\n const { cellData } = useTableCell()\n\n const clientFunctions = useClientFunctions()\n const [hasLoadedFeatures, setHasLoadedFeatures] = useState(false)\n\n const [featureProviders, setFeatureProviders] = useState<\n FeatureProviderClient<unknown, unknown>[]\n >([])\n\n const [finalSanitizedEditorConfig, setFinalSanitizedEditorConfig] =\n useState<SanitizedClientEditorConfig>(null)\n\n const featureProviderComponents: GeneratedFeatureProviderComponent[] = (\n richTextComponentMap.get('features') as GeneratedFeatureProviderComponent[]\n ).sort((a, b) => a.order - b.order) // order by order\n\n let featureProvidersAndComponentsToLoad = 0 // feature providers and components\n for (const featureProvider of featureProviderComponents) {\n const featureComponentKeys = Array.from(richTextComponentMap.keys()).filter((key) =>\n key.startsWith(`feature.${featureProvider.key}.components.`),\n )\n\n featureProvidersAndComponentsToLoad += 1\n featureProvidersAndComponentsToLoad += featureComponentKeys.length\n }\n\n useEffect(() => {\n if (!hasLoadedFeatures) {\n const featureProvidersLocal: FeatureProviderClient<unknown, unknown>[] = []\n let featureProvidersAndComponentsLoaded = 0 // feature providers and components only\n\n Object.entries(clientFunctions).forEach(([key, plugin]) => {\n if (key.startsWith(`lexicalFeature.${_schemaPath}.`)) {\n if (!key.includes('.lexical_internal_components.')) {\n featureProvidersLocal.push(plugin)\n }\n featureProvidersAndComponentsLoaded++\n }\n })\n\n if (featureProvidersAndComponentsLoaded === featureProvidersAndComponentsToLoad) {\n setFeatureProviders(featureProvidersLocal)\n setHasLoadedFeatures(true)\n\n /**\n * Loaded feature provided => create the final sanitized editor config\n */\n\n const resolvedClientFeatures = loadClientFeatures({\n clientFunctions,\n schemaPath: _schemaPath,\n unSanitizedEditorConfig: {\n features: featureProvidersLocal,\n lexical: lexicalEditorConfig,\n },\n })\n\n setFinalSanitizedEditorConfig(\n sanitizeClientEditorConfig(\n lexicalEditorConfig ? lexicalEditorConfig : defaultEditorLexicalConfig,\n resolvedClientFeatures,\n admin,\n ),\n )\n }\n }\n }, [\n admin,\n featureProviderComponents,\n hasLoadedFeatures,\n clientFunctions,\n _schemaPath,\n featureProviderComponents.length,\n featureProviders,\n finalSanitizedEditorConfig,\n lexicalEditorConfig,\n richTextComponentMap,\n featureProvidersAndComponentsToLoad,\n ])\n\n useEffect(() => {\n if (!hasLoadedFeatures) {\n return\n }\n let dataToUse = cellData\n if (dataToUse == null || !hasLoadedFeatures || !finalSanitizedEditorConfig) {\n setPreview('')\n return\n }\n\n // Transform data through load hooks\n if (finalSanitizedEditorConfig?.features?.hooks?.load?.length) {\n finalSanitizedEditorConfig.features.hooks.load.forEach((hook) => {\n dataToUse = hook({ incomingEditorState: dataToUse })\n })\n }\n\n if (!dataToUse || typeof dataToUse !== 'object') {\n setPreview('')\n return\n }\n\n // If data is from Slate and not Lexical\n if (Array.isArray(dataToUse) && !('root' in dataToUse)) {\n setPreview('')\n return\n }\n\n // If data is from payload-plugin-lexical\n if ('jsonContent' in dataToUse) {\n setPreview('')\n return\n }\n\n // initialize headless editor\n const headlessEditor = createHeadlessEditor({\n namespace: finalSanitizedEditorConfig.lexical.namespace,\n nodes: getEnabledNodes({ editorConfig: finalSanitizedEditorConfig }),\n theme: finalSanitizedEditorConfig.lexical.theme,\n })\n headlessEditor.setEditorState(headlessEditor.parseEditorState(dataToUse))\n\n const textContent =\n headlessEditor.getEditorState().read(() => {\n return $getRoot().getTextContent()\n }) || ''\n\n // Limiting the number of characters shown is done in a CSS rule\n setPreview(textContent)\n }, [cellData, lexicalEditorConfig, hasLoadedFeatures, finalSanitizedEditorConfig])\n\n if (!hasLoadedFeatures) {\n return (\n <React.Fragment>\n {Array.isArray(featureProviderComponents) &&\n featureProviderComponents.map((featureProvider) => {\n // get all components starting with key feature.${FeatureProvider.key}.components.{featureComponentKey}\n const featureComponentKeys = Array.from(richTextComponentMap.keys()).filter((key) =>\n key.startsWith(\n `lexical_internal_feature.${featureProvider.key}.lexical_internal_components.`,\n ),\n )\n\n const featureComponents: React.ReactNode[] = featureComponentKeys.map((key) => {\n return richTextComponentMap.get(key)\n }) as React.ReactNode[]\n\n return (\n <React.Fragment key={featureProvider.key}>\n {featureComponents?.length\n ? featureComponents.map((FeatureComponent) => {\n return FeatureComponent\n })\n : null}\n {featureProvider.ClientFeature}\n </React.Fragment>\n )\n })}\n </React.Fragment>\n )\n }\n\n return <span>{preview}</span>\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,kBAAkB,EAAEC,YAAY,QAAQ;AACjD,SAASC,QAAQ,QAAQ;AACzB,OAAOC,KAAA,IAASC,SAAS,EAAEC,QAAQ,QAAQ;AAM3C,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,YAAA,GAKRC,KAAA;EACH,MAAM;IACJC,KAAK;IACLC,KAAA,EAAO;MAAEC,WAAW;MAAEC;IAAoB,CAAE;IAC5CC;EAAmB,CACpB,GAAGL,KAAA;EAEJ,MAAM,CAACM,OAAA,EAASC,UAAA,CAAW,GAAGf,KAAA,CAAME,QAAQ,CAAC;EAE7C,MAAM;IAAEc;EAAQ,CAAE,GAAGlB,YAAA;EAErB,MAAMmB,eAAA,GAAkBpB,kBAAA;EACxB,MAAM,CAACqB,iBAAA,EAAmBC,oBAAA,CAAqB,GAAGjB,QAAA,CAAS;EAE3D,MAAM,CAACkB,gBAAA,EAAkBC,mBAAA,CAAoB,GAAGnB,QAAA,CAE9C,EAAE;EAEJ,MAAM,CAACoB,0BAAA,EAA4BC,6BAAA,CAA8B,GAC/DrB,QAAA,CAAsC;EAExC,MAAMsB,yBAAA,GAAiEZ,oBACrE,CAAqBa,GAAG,CAAC,YACzBC,IAAI,CAAC,CAACC,CAAA,EAAGC,CAAA,KAAMD,CAAA,CAAEE,KAAK,GAAGD,CAAA,CAAEC,KAAK,EAAE;EAAA;EAEpC,IAAIC,mCAAA,GAAsC,EAAE;EAAA;EAC5C,KAAK,MAAMC,eAAA,IAAmBP,yBAAA,EAA2B;IACvD,MAAMQ,oBAAA,GAAuBC,KAAA,CAAMC,IAAI,CAACtB,oBAAA,CAAqBuB,IAAI,IAAIC,MAAM,CAAEC,GAAA,IAC3EA,GAAA,CAAIC,UAAU,CAAC,WAAWP,eAAA,CAAgBM,GAAG,cAAc;IAG7DP,mCAAA,IAAuC;IACvCA,mCAAA,IAAuCE,oBAAA,CAAqBO,MAAM;EACpE;EAEAtC,SAAA,CAAU;IACR,IAAI,CAACiB,iBAAA,EAAmB;MACtB,MAAMsB,qBAAA,GAAmE,EAAE;MAC3E,IAAIC,mCAAA,GAAsC,EAAE;MAAA;MAE5CC,MAAA,CAAOC,OAAO,CAAC1B,eAAA,EAAiB2B,OAAO,CAAC,CAAC,CAACP,KAAA,EAAKQ,MAAA,CAAO;QACpD,IAAIR,KAAA,CAAIC,UAAU,CAAC,kBAAkB3B,WAAA,GAAc,GAAG;UACpD,IAAI,CAAC0B,KAAA,CAAIS,QAAQ,CAAC,kCAAkC;YAClDN,qBAAA,CAAsBO,IAAI,CAACF,MAAA;UAC7B;UACAJ,mCAAA;QACF;MACF;MAEA,IAAIA,mCAAA,KAAwCX,mCAAA,EAAqC;QAC/ET,mBAAA,CAAoBmB,qBAAA;QACpBrB,oBAAA,CAAqB;QAErB;;;QAIA,MAAM6B,sBAAA,GAAyB5C,kBAAA,CAAmB;UAChDa,eAAA;UACAgC,UAAA,EAAYtC,WAAA;UACZuC,uBAAA,EAAyB;YACvBC,QAAA,EAAUX,qBAAA;YACVY,OAAA,EAASvC;UACX;QACF;QAEAU,6BAAA,CACElB,0BAAA,CACEQ,mBAAA,GAAsBA,mBAAA,GAAsBV,0BAAA,EAC5C6C,sBAAA,EACAvC,KAAA;MAGN;IACF;EACF,GAAG,CACDA,KAAA,EACAe,yBAAA,EACAN,iBAAA,EACAD,eAAA,EACAN,WAAA,EACAa,yBAAA,CAA0Be,MAAM,EAChCnB,gBAAA,EACAE,0BAAA,EACAT,mBAAA,EACAD,oBAAA,EACAkB,mCAAA,CACD;EAED7B,SAAA,CAAU;IACR,IAAI,CAACiB,iBAAA,EAAmB;MACtB;IACF;IACA,IAAImC,SAAA,GAAYrC,QAAA;IAChB,IAAIqC,SAAA,IAAa,QAAQ,CAACnC,iBAAA,IAAqB,CAACI,0BAAA,EAA4B;MAC1EP,UAAA,CAAW;MACX;IACF;IAEA;IACA,IAAIO,0BAAA,EAA4B6B,QAAA,EAAUG,KAAA,EAAOC,IAAA,EAAMhB,MAAA,EAAQ;MAC7DjB,0BAAA,CAA2B6B,QAAQ,CAACG,KAAK,CAACC,IAAI,CAACX,OAAO,CAAEY,IAAA;QACtDH,SAAA,GAAYG,IAAA,CAAK;UAAEC,mBAAA,EAAqBJ;QAAU;MACpD;IACF;IAEA,IAAI,CAACA,SAAA,IAAa,OAAOA,SAAA,KAAc,UAAU;MAC/CtC,UAAA,CAAW;MACX;IACF;IAEA;IACA,IAAIkB,KAAA,CAAMyB,OAAO,CAACL,SAAA,KAAc,EAAE,UAAUA,SAAQ,GAAI;MACtDtC,UAAA,CAAW;MACX;IACF;IAEA;IACA,IAAI,iBAAiBsC,SAAA,EAAW;MAC9BtC,UAAA,CAAW;MACX;IACF;IAEA;IACA,MAAM4C,cAAA,GAAiB/D,oBAAA,CAAqB;MAC1CgE,SAAA,EAAWtC,0BAAA,CAA2B8B,OAAO,CAACQ,SAAS;MACvDC,KAAA,EAAOvD,eAAA,CAAgB;QAAEwD,YAAA,EAAcxC;MAA2B;MAClEyC,KAAA,EAAOzC,0BAAA,CAA2B8B,OAAO,CAACW;IAC5C;IACAJ,cAAA,CAAeK,cAAc,CAACL,cAAA,CAAeM,gBAAgB,CAACZ,SAAA;IAE9D,MAAMa,WAAA,GACJP,cAAA,CAAeQ,cAAc,GAAGC,IAAI,CAAC;MACnC,OAAOrE,QAAA,GAAWsE,cAAc;IAClC,MAAM;IAER;IACAtD,UAAA,CAAWmD,WAAA;EACb,GAAG,CAAClD,QAAA,EAAUH,mBAAA,EAAqBK,iBAAA,EAAmBI,0BAAA,CAA2B;EAEjF,IAAI,CAACJ,iBAAA,EAAmB;IACtB,oBACEoD,IAAA,CAACtE,KAAA,CAAMuE,QAAQ;gBACZtC,KAAA,CAAMyB,OAAO,CAAClC,yBAAA,KACbA,yBAAA,CAA0BgD,GAAG,CAAEzC,iBAAA;QAC7B;QACA,MAAMC,sBAAA,GAAuBC,KAAA,CAAMC,IAAI,CAACtB,oBAAA,CAAqBuB,IAAI,IAAIC,MAAM,CAAEC,KAAA,IAC3EA,KAAA,CAAIC,UAAU,CACZ,4BAA4BP,iBAAA,CAAgBM,GAAG,+BAA+B;QAIlF,MAAMoC,iBAAA,GAAuCzC,sBAAA,CAAqBwC,GAAG,CAAEnC,KAAA;UACrE,OAAOzB,oBAAA,CAAqBa,GAAG,CAACY,KAAA;QAClC;QAEA,oBACEqC,KAAA,CAAC1E,KAAA,CAAMuE,QAAQ;qBACZE,iBAAA,EAAmBlC,MAAA,GAChBkC,iBAAA,CAAkBD,GAAG,CAAEG,gBAAA;YACrB,OAAOA,gBAAA;UACT,KACA,MACH5C,iBAAA,CAAgB6C,aAAa;WANX7C,iBAAA,CAAgBM,GAAG;MAS5C;;EAGR;EAEA,oBAAOiC,IAAA,CAAC;cAAMxD;;AAChB","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- "use client";import{a as he,b as xe,c as be,d as Ce,e as J,f as $,h as Ee}from"./chunk-TO2W7Q2G.js";import{a as ye,b as M}from"./chunk-NI6Z4GBD.js";import{jsx as V,jsxs as ge}from"react/jsx-runtime";import{FieldDescription as to,FieldError as oo,FieldLabel as no,useField as ro,useFieldProps as io,withCondition as so}from"@payloadcms/ui";import{useCallback as lo}from"react";import{ErrorBoundary as ao}from"react-error-boundary";import{jsx as z}from"react/jsx-runtime";import{LexicalComposer as eo}from"@lexical/react/LexicalComposer.js";import*as Ze from"react";import{useMemo as Xe}from"react";import{c as jt}from"react/compiler-runtime";import{jsx as w,jsxs as ne}from"react/jsx-runtime";import{useLexicalComposerContext as zt}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as Ht}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as Kt}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Gt}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as Wt}from"@lexical/react/LexicalRichTextPlugin.js";import{TabIndentationPlugin as Yt}from"@lexical/react/LexicalTabIndentationPlugin.js";import{BLUR_COMMAND as Ut,COMMAND_PRIORITY_LOW as Ve,FOCUS_COMMAND as Vt}from"lexical";import*as te from"react";import{useEffect as qe,useState as Je}from"react";import{jsx as Ne}from"react/jsx-runtime";import"react";var W=({anchorElem:t,clientProps:e,plugin:n})=>n.position==="floatingAnchorElem"?n.Component&&Ne(n.Component,{anchorElem:t,clientProps:e}):n.Component&&Ne(n.Component,{clientProps:e});import{c as it}from"react/compiler-runtime";import{jsx as st}from"react/jsx-runtime";import{MarkdownShortcutPlugin as lt}from"@lexical/react/LexicalMarkdownShortcutPlugin.js";import"react";var we=()=>{let t=it(2),{editorConfig:e}=M(),n;return t[0]!==e.features.markdownTransformers?(n=st(lt,{transformers:e.features.markdownTransformers}),t[0]=e.features.markdownTransformers,t[1]=n):n=t[1],n};import{jsx as Q,jsxs as ke}from"react/jsx-runtime";import{useLexicalComposerContext as ct}from"@lexical/react/LexicalComposerContext.js";import{useFieldProps as Re,useTranslation as Se}from"@payloadcms/ui";import{useCallback as Te,useMemo as ut,useState as dt}from"react";import"react";import*as ve from"react-dom";import{c as at}from"react/compiler-runtime";import"react";function Pe(t,e){let n=at(4),{maxLength:o,minLength:r}=e,a=o===void 0?75:o,m=r===void 0?1:r,p;return n[0]!==t||n[1]!==a||n[2]!==m?(p=c=>{let{query:s}=c,b="[^"+t+xe+"\\s]",l=new RegExp("(^|\\s|\\()(["+t+"]((?:"+b+"){0,"+a+"}))$").exec(s);if(l!==null){let i=l[1],g=l[3];if(g.length>=m)return{leadOffset:l.index+i.length,matchingString:g,replaceableString:l[2]}}return null},n[0]=t,n[1]=a,n[2]=m,n[3]=p):p=n[3],p}var A="slash-menu-popup";function mt({isSelected:t,item:e,onClick:n,onMouseEnter:o}){let{field:{richTextComponentMap:r}}=M(),{schemaPath:a}=Re(),{i18n:m}=Se(),p=`${A}__item ${A}__item-${e.key}`;t&&(p+=` ${A}__item--selected`);let c=e.key;return e.label&&(c=typeof e.label=="function"?e.label({i18n:m,richTextComponentMap:r,schemaPath:a}):e.label),c.length>25&&(c=c.substring(0,25)+"..."),ke("button",{"aria-selected":t,className:p,id:A+"__item-"+e.key,onClick:n,onMouseEnter:o,ref:s=>{e.ref={current:s}},role:"option",tabIndex:-1,type:"button",children:[e?.Icon&&Q(e.Icon,{}),Q("span",{className:`${A}__item-text`,children:c})]},e.key)}function Me({anchorElem:t=document.body}){let[e]=ct(),[n,o]=dt(null),{editorConfig:r}=M(),{i18n:a}=Se(),{field:{richTextComponentMap:m}}=M(),{schemaPath:p}=Re(),c=Pe("/",{minLength:0}),s=Te(()=>{let l=[];for(let i of r.features.slashMenu.dynamicGroups){let g=i({editor:e,queryString:n});l=l.concat(g)}return l},[e,n,r?.features]),b=ut(()=>{let l=[];for(let i of r?.features.slashMenu.groups??[])l.push(i);if(n){l=l.map(g=>{let h=g.items.filter(d=>{let f=d.key;return d.label&&(f=typeof d.label=="function"?d.label({i18n:a,richTextComponentMap:m,schemaPath:p}):d.label),new RegExp(n,"gi").exec(f)?!0:d.keywords!=null?d.keywords.some(u=>new RegExp(n,"gi").exec(u)):!1});return h.length?{...g,items:h}:null}),l=l.filter(g=>g!=null);let i=s();for(let g of i){let h=l.find(d=>d.key===g.key);h?l=l.filter(d=>d.key!==g.key):h={...g,items:[]},h?.items?.length&&(h.items=h.items.concat(h.items)),l.push(h)}}return l},[s,n,r?.features,a]),y=Te((l,i,g,h)=>{i&&e.update(()=>{i.remove()}),l.onSelect({editor:e,queryString:h}),g()},[e]);return Q(Ce,{anchorElem:t,groups:b,menuRenderFn:(l,{selectItemAndCleanUp:i,selectedItemKey:g,setSelectedItemKey:h})=>l.current&&b.length?ve.createPortal(Q("div",{className:A,children:b.map(d=>{let f=d.key;return d.label&&(f=typeof d.label=="function"?d.label({i18n:a,richTextComponentMap:m,schemaPath:p}):d.label),ke("div",{className:`${A}__group ${A}__group-${d.key}`,children:[Q("div",{className:`${A}__group-title`,children:f}),d.items.map((u,x)=>Q(mt,{index:x,isSelected:g===u.key,item:u,onClick:()=>{h(u.key),i(u)},onMouseEnter:()=>{h(u.key)}},u.key))]},d.key)})}),l.current):null,onQueryChange:o,onSelectItem:y,triggerFn:c})}import{c as xt}from"react/compiler-runtime";import{jsx as fe}from"react/jsx-runtime";import{useLexicalComposerContext as bt}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Ct}from"lexical";import*as Ae from"react";import{useEffect as Be,useRef as Et,useState as Nt}from"react";import{createPortal as wt}from"react-dom";var X=(t,e,n,o,r=50,a=25)=>{let m=0;if(t&&!t.contains(o)){let{bottom:p,left:c,right:s,top:b}=t.getBoundingClientRect(),y=b+window.scrollY,l=p+window.scrollY;if(n<y-a||n>l+a||e<c-r||e>s+r)return-1;(e<c||e>s)&&(m=e<c?e-c:e-s)}return m};import{$getNodeByKey as ie}from"lexical";function j(t){let e=t.getBoundingClientRect(),n=getComputedStyle(t).getPropertyValue("transform");if(!n||n==="none")return e;let o=n.split(",").pop();return e.y=e.y-Number(o.replace(")","")),e}function re(t){let e=(c,s)=>c?parseFloat(window.getComputedStyle(c)[s]):0,{marginBottom:n,marginTop:o}=window.getComputedStyle(t),r=e(t.previousElementSibling,"marginBottom"),a=e(t.nextElementSibling,"marginTop"),m=Math.max(parseFloat(o),r);return{marginBottom:Math.max(parseFloat(n),a),marginTop:m}}import{$getRoot as ft}from"lexical";function Y(t){return t.getEditorState().read(()=>ft().getChildrenKeys())}var pt=1,gt=-1,Ie=0,D={props:null,result:null};function ht(t,e,n=20){let o=t.x-e.x,r=t.y-e.y;return o*o+r*r<=n*n}function Z(t){let{anchorElem:e,cache_threshold:n=20,editor:o,fuzzy:r=!1,horizontalOffset:a=0,point:{x:m,y:p},startIndex:c=0,useEdgeAsDefault:s=!1,verbose:b=!1}=t;if(n>0&&D.props&&D.result&&D.props.fuzzy===t.fuzzy&&D.props.horizontalOffset===t.horizontalOffset&&D.props.useEdgeAsDefault===t.useEdgeAsDefault&&ht(D.props.point,t.point,n))return D.result;let y=e.getBoundingClientRect(),l=Y(o),i={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return o.getEditorState().read(()=>{if(s){let[d,f]=[o.getElementByKey(l[0]),o.getElementByKey(l[l.length-1])],[u,x]=[j(d),j(f)];if(u&&x&&(p<u.top?(i.blockElem=d,i.distance=u.top-p,i.blockNode=ie(l[0]),i.foundAtIndex=0):p>x.bottom&&(i.distance=p-x.bottom,i.blockNode=ie(l[l.length-1]),i.blockElem=f,i.foundAtIndex=l.length-1),i?.blockElem))return{blockElem:null,isFoundNodeEmptyParagraph:!1}}let g=c,h=Ie;for(;g>=0&&g<l.length;){let d=l[g],f=o.getElementByKey(d);if(f===null)break;let u=new $(m+a,p),x=Ee.fromDOMRect(j(f)),{marginBottom:C,marginTop:S}=re(f),k=x.generateNewRect({bottom:x.bottom+C,left:y.left,right:y.right,top:x.top-S}),{distance:N,isOnBottomSide:I,isOnTopSide:R}=k.distanceFromPoint(u);if(N===0){i.blockElem=f,i.blockNode=ie(d),i.foundAtIndex=g,i.distance=N,i.blockNode&&i.blockNode.getType()==="paragraph"&&i.blockNode.getTextContent()===""&&(!r&&!t.returnEmptyParagraphs&&(i.blockElem=null,i.blockNode=null),i.isFoundNodeEmptyParagraph=!0);break}else r&&N<i.distance&&(i.blockElem=f,i.blockNode=ie(d),i.distance=N,i.foundAtIndex=g);h===Ie&&(R?h=gt:I?h=pt:h=1/0),g+=h}}),D.props=t,D.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 se(t,e){return!!t.closest(`.${e}`)}var yt=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Le(t){if(!t||yt.includes(t.tagName)||t.offsetHeight===0||t.offsetWidth===0)return!1;let e=window.getComputedStyle(t);return!(e.display==="table-cell"||e.position==="absolute"||e.visibility==="hidden"||e.opacity==="0")}function le(t,e,n,o=0){if(!t){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let r=t.getBoundingClientRect(),a=window.getComputedStyle(t),m=e.getBoundingClientRect(),p=n.getBoundingClientRect(),c;if(r.height<60)c=r.top-m.height/2-p.top+r.height/2-1;else{let y=Le(t)?parseInt(a.lineHeight,10):0;c=r.top+(y-m.height)/2-p.top-1}let b=o;e.style.opacity="1",e.style.transform=`translate(${b}px, ${c}px)`}var Pt="add-block-menu",ae=1/0;function Tt(t){return t===0?1/0:ae>=0&&ae<t?ae:Math.floor(t/2)}function kt(t,e,n){let o=xt(15),r=e.parentElement,{editorConfig:a}=M(),m=a?.admin?.hideGutter?-24:12,p=Et(null),[c,s]=Nt(null),b,y;o[0]!==r||o[1]!==t||o[2]!==e||o[3]!==c?(b=()=>{let d=function(u){let x=u.target;if(!J(x))return;let C=X(r,u.pageX,u.pageY,x);if(C===-1){s(null);return}if(se(x,Pt))return;let S=Y(t),{blockElem:k,blockNode:N,foundAtIndex:I}=Z({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-C,point:new $(u.x,u.y),returnEmptyParagraphs:!0,startIndex:Tt(S.length),useEdgeAsDefault:!1});ae=I,k&&(c?.node!==N||c?.elem!==k)&&s({elem:k,node:N})};return document?.addEventListener("mousemove",d),()=>{document?.removeEventListener("mousemove",d)}},y=[r,e,t,c],o[0]=r,o[1]=t,o[2]=e,o[3]=c,o[4]=b,o[5]=y):(b=o[4],y=o[5]),Be(b,y);let l;o[6]!==e||o[7]!==c||o[8]!==m?(l=[e,c,m],o[6]=e,o[7]=c,o[8]=m,o[9]=l):l=o[9],Be(()=>{p.current&&c?.node&&le(c?.elem,p.current,e,m)},l);let i;o[10]!==c||o[11]!==t?(i=d=>{let f;f=c,f?.node&&(t.update(()=>{let u=!0;if((f.node.getType()!=="paragraph"||f.node.getTextContent()!=="")&&(u=!1),!u){let x=Ct();f.node.insertAfter(x),setTimeout(()=>{f={elem:t.getElementByKey(x.getKey()),node:x},s(f)},0)}}),setTimeout(()=>{t.update(()=>{t.focus(),f.node&&"select"in f.node&&typeof f.node.select=="function"&&f.node.select()})},1),setTimeout(()=>{t.dispatchCommand(be,{node:f.node})},2),d.stopPropagation(),d.preventDefault())},o[10]=c,o[11]=t,o[12]=i):i=o[12];let g=i,h;return o[13]!==g?(h=d=>{g(d)},o[13]=g,o[14]=h):h=o[14],wt(fe(Ae.Fragment,{children:fe("button",{className:"icon add-block-menu",onClick:h,ref:p,type:"button",children:fe("div",{className:n?"icon":""})})}),e)}function De(t){let{anchorElem:e}=t,n=e===void 0?document.body:e,[o]=bt();return kt(o,n,o._editable)}import{c as vt}from"react/compiler-runtime";import{jsx as ce,jsxs as Mt}from"react/jsx-runtime";import{useLexicalComposerContext as It}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as _e}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as $e,$getNodeByKey as Lt}from"lexical";import*as Ge from"react";import{useEffect as pe,useRef as ue,useState as je}from"react";import{createPortal as Bt}from"react-dom";function Fe(t,e,n){if(!t.current)return;let{left:o,top:r}=n.getBoundingClientRect(),a=j(e),m=a.width,p=a.height,c=a.top-r,s=a.left-o;t.current.style.border="2px solid green",t.current.style.boxSizing="border-box",t.current.style.height=p+"px",t.current.style.pointerEvents="none",t.current.style.position="absolute",t.current.style.top=c+"px",t.current.style.left=s+"px",t.current.style.width=m+"px",t.current.style.zIndex="1000",t.current.style.opacity="0.5"}var ee=25,Rt=-24,St=!1,U=0;function Oe(t,e,n,o,r,a,m,p,c,s=!1){let{height:b,top:y}=o.getBoundingClientRect(),{top:l,width:i}=m.getBoundingClientRect(),{marginBottom:g,marginTop:h}=re(o),d=y,f=a>=y+b/2+window.scrollY,u=!1;if(r?.elem)if(o!==r?.elem)(f&&r?.elem&&r?.elem===o.nextElementSibling||!f&&r?.elem&&r?.elem===o.previousElementSibling)&&(U++,U<200&&(u=!0));else{U++;let N=r?.boundingBox?.y,I=o.getBoundingClientRect().y;(f===r?.isBelow&&N===I||U<200)&&(u=!1)}if(u)return{isBelow:f,willStayInSamePosition:u};s?d+=b/2:f?d+=b+g/2:d-=h/2;let x=0;s||(f?x=-ee:x=ee);let C=d-l+x,S=Rt-e;n.style.width=`calc(${i}px - ${t})`,n.style.opacity=".4";let k=12;return s?n.style.transform=`translate(${S}px, ${C-ee}px)`:f?(o.style.marginBottom=ee*2+k+"px",n.style.transform=`translate(${S}px, calc(${C}px - 0px))`):(o.style.marginTop=ee*2+k+"px",n.style.transform=`translate(${S}px, calc(${C-ee*2}px - 0px))`),St&&Fe(c,o,m),r.elem.style.opacity="",r?.elem===o?f?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop=""),U=0,{isBelow:f,willStayInSamePosition:u}}var At="draggable-block-menu",ze="application/x-lexical-drag-block",oe=1/0;function He(t){return t===0?1/0:oe>=0&&oe<t?oe:Math.floor(t/2)}function Dt(t,e){let{transform:n}=e.style;t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=n})}function Ke(t,e){t&&(t.style.opacity="0"),e&&(e.style.opacity="",e.style.marginBottom="",e.style.marginTop="")}function Ft(t,e,n){let o=vt(19),r=e.parentElement,a=ue(null),m=ue(null),p=ue(null),c=ue(!1),[s,b]=je(null),[y,l]=je(null),{editorConfig:i}=M(),g=i?.admin?.hideGutter?-44:-8,h,d;o[0]!==r||o[1]!==t||o[2]!==e||o[3]!==s?(h=()=>{let N=function(R){let E=R.target;if(!J(E))return;let v=X(r,R.pageX,R.pageY,E);if(v===-1){b(null);return}if(se(E,At))return;let H=Y(t),{blockElem:B,foundAtIndex:F,isFoundNodeEmptyParagraph:O}=Z({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-v,point:new $(R.x,R.y),startIndex:He(H.length),useEdgeAsDefault:!1,verbose:!1});oe=F,!(!B&&!O)&&s!==B&&b(B)};return document?.addEventListener("mousemove",N),()=>{document?.removeEventListener("mousemove",N)}},d=[r,e,t,s],o[0]=r,o[1]=t,o[2]=e,o[3]=s,o[4]=h,o[5]=d):(h=o[4],d=o[5]),pe(h,d);let f,u;o[6]!==s||o[7]!==e||o[8]!==g?(f=()=>{a.current&&le(s,a.current,e,g)},u=[e,s,g],o[6]=s,o[7]=e,o[8]=g,o[9]=f,o[10]=u):(f=o[9],u=o[10]),pe(f,u);let x=i?.admin?.hideGutter,C;return o[11]!==r||o[12]!==g||o[13]!==e||o[14]!==t||o[15]!==y||o[16]!==s||o[17]!==x?(C=[r,g,e,t,y,s,x],o[11]=r,o[12]=g,o[13]=e,o[14]=t,o[15]=y,o[16]=s,o[17]=x,o[18]=C):C=o[18],pe(()=>{let N=function(E){if(!c.current)return!1;let[v]=_e(E);if(v)return!1;let{pageY:H,target:B}=E;if(!J(B))return!1;let F=X(r,E.pageX,E.pageY,B,100,50),O=Y(t),{blockElem:T,foundAtIndex:K,isFoundNodeEmptyParagraph:L}=Z({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-F,point:new $(E.x,E.y),startIndex:He(O.length),useEdgeAsDefault:!0,verbose:!0});oe=K;let G=m.current;if(T===null||G===null)return!1;if(s!==T){let{isBelow:_,willStayInSamePosition:me}=Oe(i?.admin?.hideGutter?"0px":"3rem",g+(i?.admin?.hideGutter?a?.current?.getBoundingClientRect()?.width??0:-(a?.current?.getBoundingClientRect()?.width??0)),G,T,y,H,e,E,p,L);E.preventDefault(),me||l({boundingBox:T.getBoundingClientRect(),elem:T,isBelow:_})}else Ke(G,y?.elem),l({boundingBox:T.getBoundingClientRect(),elem:T,isBelow:!1});return!0},I=function(E){if(!c.current)return!1;let[v]=_e(E);if(v)return!1;let{dataTransfer:H,pageY:B,target:F}=E,O=H?.getData(ze)||"";return t.update(()=>{let T=Lt(O);if(!T||!J(F))return!1;let K=X(r,E.pageX,E.pageY,F,100,50),{blockElem:L,isFoundNodeEmptyParagraph:G}=Z({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-K,point:new $(E.x,E.y),useEdgeAsDefault:!0});if(!L)return!1;let _=$e(L);if(!_)return!1;if(_===T)return!0;let{height:me,top:ot}=j(L),nt=B>=ot+me/2+window.scrollY;G?(_.insertBefore(T),_.remove()):nt?_.insertAfter(T):_.insertBefore(T),s!==null&&b(null),document.querySelectorAll(".lexical-block-highlighter").forEach(q=>{q.remove()});let rt=t.getElementByKey(T.getKey());setTimeout(()=>{let q=rt.getBoundingClientRect(),P=document.createElement("div");P.className="lexical-block-highlighter",document.documentElement.getAttribute("data-theme")==="dark"?P.style.backgroundColor="white":P.style.backgroundColor="black",P.style.transition="opacity 0.1s ease-in-out",P.style.zIndex="1",P.style.pointerEvents="none",P.style.boxSizing="border-box",P.style.borderRadius="4px",P.style.position="absolute",document.body.appendChild(P),P.style.opacity="0.1",P.style.height=`${q.height+8}px`,P.style.width=`${q.width+8}px`,P.style.top=`${q.top+window.scrollY-4}px`,P.style.left=`${q.left-4}px`,setTimeout(()=>{P.style.opacity="0",setTimeout(()=>{P.remove()},1e3)},3e3)},120)}),!0};return document.addEventListener("dragover",N),document.addEventListener("drop",I),()=>{document.removeEventListener("dragover",N),document.removeEventListener("drop",I)}},C),Bt(Mt(Ge.Fragment,{children:[ce("div",{className:"icon draggable-block-menu",draggable:!0,onDragEnd:function(){c.current=!1,Ke(m.current,y?.elem)},onDragStart:function(I){let R=I.dataTransfer;if(!R||!s)return;Dt(R,s);let E;E="",t.update(()=>{let v=$e(s);v&&(E=v.getKey())}),c.current=!0,R.setData(ze,E)},ref:a,children:ce("div",{className:n?"icon":""})}),ce("div",{className:"draggable-block-target-line",ref:m}),ce("div",{className:"debug-highlight",ref:p})]}),e)}function We(t){let{anchorElem:e}=t,n=e===void 0?document.body:e,[o]=It();return Ft(o,n,o._editable)}import{c as Ot}from"react/compiler-runtime";import{jsx as Ye}from"react/jsx-runtime";import{ContentEditable as _t}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as $t}from"@payloadcms/ui";import"react";function Ue(t){let e=Ot(3),{className:n}=t,{t:o}=$t(),r;return e[0]!==o||e[1]!==n?(r=Ye(_t,{"aria-placeholder":o("lexical:general:placeholder"),className:n??"ContentEditable__root",placeholder:Ye("p",{className:"editor-placeholder",children:o("lexical:general:placeholder")})}),e[0]=o,e[1]=n,e[2]=r):r=e[2],r}var Qe=t=>{let e=jt(22),{editorConfig:n,editorContainerRef:o,onChange:r}=t,a=M(),[m]=zt(),[p,c]=Je(null),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=u=>{u!==null&&c(u)},e[0]=s):s=e[0];let b=s,y,l;e[1]!==a||e[2]!==m?(y=()=>{if(!a?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}a?.parentEditor?.uuid&&a.parentEditor?.registerChild(a.uuid,a);let u=()=>{a.focusEditor(a)},x=()=>{a.blurEditor(a)},C=m.registerCommand(Vt,()=>(u(),!0),Ve),S=m.registerCommand(Ut,()=>(x(),!0),Ve);return()=>{C(),S(),a.parentEditor?.unregisterChild?.(a.uuid)}},l=[m,a],e[1]=a,e[2]=m,e[3]=y,e[4]=l):(y=e[3],l=e[4]),qe(y,l);let[i,g]=Je(!1),h,d;e[5]!==i?(h=()=>{let u=()=>{let x=window.matchMedia("(max-width: 768px)").matches;x!==i&&g(x)};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},d=[i],e[5]=i,e[6]=h,e[7]=d):(h=e[6],d=e[7]),qe(h,d);let f;if(e[8]!==n.features||e[9]!==r||e[10]!==p||e[11]!==i||e[12]!==m||e[13]!==o){let u;e[15]!==r?(u=(C,S,k)=>{(!k.has("focus")||k.size>1)&&r?.(C,S,k)},e[15]=r,e[16]=u):u=e[16];let x;e[17]!==p||e[18]!==i||e[19]!==m||e[20]!==n?(x=p&&ne(te.Fragment,{children:[!i&&m.isEditable()&&ne(te.Fragment,{children:[w(We,{anchorElem:p}),w(De,{anchorElem:p})]}),n.features.plugins.map(C=>{if(C.position==="floatingAnchorElem"&&!(C.desktopOnly===!0&&i))return w(W,{anchorElem:p,clientProps:C.clientProps,plugin:C},C.key)}),m.isEditable()&&w(te.Fragment,{children:w(Me,{anchorElem:p})})]}),e[17]=p,e[18]=i,e[19]=m,e[20]=n,e[21]=x):x=e[21],f=ne(te.Fragment,{children:[n.features.plugins.map(qt),ne("div",{className:"editor-container",ref:o,children:[n.features.plugins.map(Jt),w(Wt,{ErrorBoundary:Ht,contentEditable:w("div",{className:"editor-scroller",children:w("div",{className:"editor",ref:b,children:w(Ue,{})})})}),w(Gt,{ignoreSelectionChange:!0,onChange:u}),x,m.isEditable()&&ne(te.Fragment,{children:[w(Kt,{}),n?.features?.markdownTransformers?.length>0&&w(we,{})]}),w(Yt,{}),n.features.plugins.map(Qt),n.features.plugins.map(Xt)]}),n.features.plugins.map(Zt)]}),e[8]=n.features,e[9]=r,e[10]=p,e[11]=i,e[12]=m,e[13]=o,e[14]=f}else f=e[14];return f};function qt(t){if(t.position==="aboveContainer")return w(W,{clientProps:t.clientProps,plugin:t},t.key)}function Jt(t){if(t.position==="top")return w(W,{clientProps:t.clientProps,plugin:t},t.key)}function Qt(t){if(t.position==="normal")return w(W,{clientProps:t.clientProps,plugin:t},t.key)}function Xt(t){if(t.position==="bottom")return w(W,{clientProps:t.clientProps,plugin:t},t.key)}function Zt(t){if(t.position==="belowContainer")return w(W,{clientProps:t.clientProps,plugin:t},t.key)}var et=({children:t,providers:e})=>{if(!e?.length)return t;let n=e[0];return e.length>1?z(n,{children:z(et,{providers:e.slice(1),children:t})}):z(n,{children:t})},tt=t=>{let{editorConfig:e,field:n,onChange:o,path:r,readOnly:a,value:m}=t,p=M(),c=Ze.useRef(null),s=Xe(()=>{let y=m;return e?.features?.hooks?.load?.length&&e.features.hooks.load.forEach(l=>{y=l({incomingEditorState:y})}),y},[e,m]),b=Xe(()=>{if(s&&typeof s!="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(s));if(s&&Array.isArray(s)&&!("root"in s))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/beta/lexical/migration#migration-via-migration-script-recommended");if(s&&"jsonContent"in s)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/beta/lexical/migration#migrating-from-payload-plugin-lexical");return{editable:a!==!0,editorState:s!=null?JSON.stringify(s):void 0,namespace:e.lexical.namespace,nodes:[...he({editorConfig:e})],onError:y=>{throw y},theme:e.lexical.theme}},[e,s,a]);return b?z(eo,{initialConfig:b,children:z(ye,{editorConfig:e,editorContainerRef:c,field:n,parentContext:p,children:z(et,{providers:e.features.providers,children:z(Qe,{editorConfig:e,editorContainerRef:c,onChange:o})})})},r):z("p",{children:"Loading..."})};import"./bundled.css";var de="rich-text-lexical",co=t=>{let{descriptionProps:e,editorConfig:n,errorProps:o,field:{name:r,_path:a,admin:{className:m,components:{Description:p,Error:c,Label:s},readOnly:b,style:y,width:l}={},label:i,required:g},field:h,labelProps:d,readOnly:f,validate:u}=t,x=f||b,C=lo((K,L)=>{if(typeof u=="function")return u(K,{...L,props:t,required:g})},[u,g]),{path:S,readOnly:k}=io(),N=ro({path:S??a??r,validate:C}),{formInitializing:I,formProcessing:R,initialValue:E,path:v,setValue:H,showError:B,value:F}=N,O=x||k||R||I,T=[de,"field-type",m,B&&"error",O&&`${de}--read-only`,n?.admin?.hideGutter!==!0?`${de}--show-gutter`:null].filter(Boolean).join(" ");return ge("div",{className:T,style:{...y,width:l},children:[V(oo,{CustomError:c,field:h,path:v,...o||{},alignCaret:"left"}),V(no,{Label:s,field:h,label:i,required:g,...d||{}}),ge("div",{className:`${de}__wrap`,children:[V(ao,{fallbackRender:uo,onReset:()=>{},children:V(tt,{editorConfig:n,field:h,onChange:K=>{let L=K.toJSON();n?.features?.hooks?.save?.length&&n.features.hooks.save.forEach(G=>{L=G({incomingEditorState:L})}),H(L)},path:v,readOnly:O,value:F},JSON.stringify({initialValue:E,path:v}))}),V(to,{Description:p,field:h,...e||{}})]})]},v)};function uo({error:t}){return ge("div",{className:"errorBoundary",role:"alert",children:[V("p",{children:"Something went wrong:"}),V("pre",{style:{color:"red"},children:t.message})]})}var Tr=so(co);export{Tr as RichText};
2
- //# sourceMappingURL=Field-63NGLPJB.js.map