@payloadcms/richtext-lexical 4.0.0-internal.c7d5de4 → 4.0.0-internal.cb69780

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 (432) hide show
  1. package/dist/exports/client/Field-TS5CRYHE.js +2 -0
  2. package/dist/exports/client/Field-TS5CRYHE.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
  5. package/dist/exports/client/{chunk-X3D4LZS7.js.map → chunk-3LRZDIIG.js.map} +4 -4
  6. package/dist/exports/client/chunk-43E5QYAA.js +2 -0
  7. package/dist/exports/client/chunk-43E5QYAA.js.map +7 -0
  8. package/dist/exports/client/{chunk-ESITTE3C.js → chunk-ZFGDYZDE.js} +2 -2
  9. package/dist/exports/client/{chunk-ESITTE3C.js.map → chunk-ZFGDYZDE.js.map} +2 -2
  10. package/dist/exports/client/component-D5QLYS7W.js +2 -0
  11. package/dist/exports/client/component-D5QLYS7W.js.map +7 -0
  12. package/dist/exports/client/componentInline-55HZXGUS.js +2 -0
  13. package/dist/exports/client/index.d.ts +1 -1
  14. package/dist/exports/client/index.d.ts.map +1 -1
  15. package/dist/exports/client/index.js +26 -26
  16. package/dist/exports/client/index.js.map +4 -4
  17. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  18. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  19. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  20. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  21. package/dist/features/blocks/client/component/index.d.ts +0 -6
  22. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  23. package/dist/features/blocks/client/component/index.js +133 -76
  24. package/dist/features/blocks/client/component/index.js.map +1 -1
  25. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  26. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  27. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  28. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  29. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  30. package/dist/features/blocks/client/componentInline/index.js +2 -2
  31. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  32. package/dist/features/blocks/server/index.js +2 -2
  33. package/dist/features/blocks/server/index.js.map +1 -1
  34. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  35. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  36. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  37. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  38. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  39. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  40. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  41. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  42. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  43. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  44. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  45. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  46. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  47. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  48. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  49. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  50. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  51. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  52. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  53. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  54. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  55. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  56. package/dist/features/debug/testRecorder/client/plugin/index.css +0 -1
  57. package/dist/features/heading/constants.d.ts +2 -0
  58. package/dist/features/heading/constants.d.ts.map +1 -0
  59. package/dist/features/heading/constants.js +2 -0
  60. package/dist/features/heading/constants.js.map +1 -0
  61. package/dist/features/heading/server/index.d.ts.map +1 -1
  62. package/dist/features/heading/server/index.js +5 -1
  63. package/dist/features/heading/server/index.js.map +1 -1
  64. package/dist/features/heading/server/validate.d.ts +6 -0
  65. package/dist/features/heading/server/validate.d.ts.map +1 -0
  66. package/dist/features/heading/server/validate.js +15 -0
  67. package/dist/features/heading/server/validate.js.map +1 -0
  68. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  69. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  70. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +1 -1
  71. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  72. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -1
  73. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  74. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  75. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  76. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  77. package/dist/features/indent/client/IndentPlugin.js +122 -1
  78. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  79. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  80. package/dist/features/indent/server/i18n.js +74 -37
  81. package/dist/features/indent/server/i18n.js.map +1 -1
  82. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  83. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +6 -3
  84. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  85. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
  86. package/dist/features/link/nodes/AutoLinkNode.d.ts +1 -1
  87. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  88. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  89. package/dist/features/link/nodes/LinkNode.d.ts +1 -1
  90. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  91. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  92. package/dist/features/link/server/index.js +2 -2
  93. package/dist/features/link/server/index.js.map +1 -1
  94. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  95. package/dist/features/lists/checklist/server/index.js +5 -2
  96. package/dist/features/lists/checklist/server/index.js.map +1 -1
  97. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  98. package/dist/features/lists/orderedList/server/index.js +5 -2
  99. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  100. package/dist/features/lists/shared/constants.d.ts +2 -0
  101. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  102. package/dist/features/lists/shared/constants.js +2 -0
  103. package/dist/features/lists/shared/constants.js.map +1 -0
  104. package/dist/features/lists/shared/validate.d.ts +5 -0
  105. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  106. package/dist/features/lists/shared/validate.js +15 -0
  107. package/dist/features/lists/shared/validate.js.map +1 -0
  108. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  109. package/dist/features/lists/unorderedList/server/index.js +5 -2
  110. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  111. package/dist/features/relationship/client/index.d.ts +2 -2
  112. package/dist/features/relationship/client/index.d.ts.map +1 -1
  113. package/dist/features/relationship/client/index.js.map +1 -1
  114. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  115. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  116. package/dist/features/relationship/client/plugins/index.js +27 -31
  117. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  118. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  119. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  120. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  121. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  122. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  123. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  124. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  125. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  126. package/dist/features/relationship/server/index.d.ts +8 -1
  127. package/dist/features/relationship/server/index.d.ts.map +1 -1
  128. package/dist/features/relationship/server/index.js +28 -11
  129. package/dist/features/relationship/server/index.js.map +1 -1
  130. package/dist/features/relationship/server/schema.d.ts +2 -2
  131. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  132. package/dist/features/relationship/server/schema.js +5 -10
  133. package/dist/features/relationship/server/schema.js.map +1 -1
  134. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  135. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  136. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  137. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  138. package/dist/features/table/client/index.d.ts.map +1 -0
  139. package/dist/features/table/client/index.js.map +1 -0
  140. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  141. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  142. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  143. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  144. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  145. package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +17 -44
  146. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  147. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  148. package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +41 -18
  149. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  150. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  151. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  152. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  153. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  154. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  155. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  156. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  157. package/dist/features/table/client/utils/debounce.js.map +1 -0
  158. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  159. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  160. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  161. package/dist/features/table/markdownTransformer.js.map +1 -0
  162. package/dist/features/table/server/index.d.ts +3 -0
  163. package/dist/features/table/server/index.d.ts.map +1 -0
  164. package/dist/features/{experimental_table → table}/server/index.js +4 -4
  165. package/dist/features/table/server/index.js.map +1 -0
  166. package/dist/features/table/server/schema.d.ts.map +1 -0
  167. package/dist/features/table/server/schema.js.map +1 -0
  168. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  169. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  170. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  171. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  172. package/dist/features/toolbars/fixed/client/Toolbar/index.css +78 -6
  173. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  174. package/dist/features/toolbars/fixed/client/Toolbar/index.js +4 -1
  175. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  176. package/dist/features/toolbars/inline/client/Toolbar/index.css +0 -1
  177. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  178. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  179. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  180. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  181. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  182. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  183. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -13
  184. package/dist/features/typesServer.d.ts +1 -1
  185. package/dist/features/typesServer.d.ts.map +1 -1
  186. package/dist/features/typesServer.js.map +1 -1
  187. package/dist/features/upload/client/component/index.js +2 -1
  188. package/dist/features/upload/client/component/index.js.map +1 -1
  189. package/dist/features/upload/client/index.d.ts +3 -2
  190. package/dist/features/upload/client/index.d.ts.map +1 -1
  191. package/dist/features/upload/client/index.js.map +1 -1
  192. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  193. package/dist/features/upload/client/plugin/index.js +47 -52
  194. package/dist/features/upload/client/plugin/index.js.map +1 -1
  195. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  196. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  197. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  198. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  199. package/dist/features/upload/server/index.d.ts +6 -2
  200. package/dist/features/upload/server/index.d.ts.map +1 -1
  201. package/dist/features/upload/server/index.js +20 -16
  202. package/dist/features/upload/server/index.js.map +1 -1
  203. package/dist/features/upload/server/schema.d.ts +2 -2
  204. package/dist/features/upload/server/schema.d.ts.map +1 -1
  205. package/dist/features/upload/server/schema.js +4 -8
  206. package/dist/features/upload/server/schema.js.map +1 -1
  207. package/dist/features/upload/server/validate.d.ts +2 -2
  208. package/dist/features/upload/server/validate.d.ts.map +1 -1
  209. package/dist/features/upload/server/validate.js +3 -0
  210. package/dist/features/upload/server/validate.js.map +1 -1
  211. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  212. package/dist/field/Diff/converters/listitem/index.js +2 -1
  213. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  214. package/dist/field/Diff/index.d.ts +3 -2
  215. package/dist/field/Diff/index.d.ts.map +1 -1
  216. package/dist/field/Diff/index.js +1 -0
  217. package/dist/field/Diff/index.js.map +1 -1
  218. package/dist/field/RenderLexical/index.d.ts +3 -1
  219. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  220. package/dist/field/RenderLexical/index.js +23 -23
  221. package/dist/field/RenderLexical/index.js.map +1 -1
  222. package/dist/field/ViewSelector.d.ts.map +1 -1
  223. package/dist/field/ViewSelector.js +1 -0
  224. package/dist/field/ViewSelector.js.map +1 -1
  225. package/dist/field/bundled.css +1 -1
  226. package/dist/field/index.css +10 -10
  227. package/dist/i18n.d.ts.map +1 -1
  228. package/dist/i18n.js +68 -0
  229. package/dist/i18n.js.map +1 -1
  230. package/dist/index.d.ts +2 -2
  231. package/dist/index.d.ts.map +1 -1
  232. package/dist/index.js +5 -5
  233. package/dist/index.js.map +1 -1
  234. package/dist/lexical/LexicalEditor.css +29 -20
  235. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  236. package/dist/lexical/LexicalEditor.js +61 -64
  237. package/dist/lexical/LexicalEditor.js.map +1 -1
  238. package/dist/lexical/config/server/loader.d.ts +1 -1
  239. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  240. package/dist/lexical/config/server/loader.js +2 -2
  241. package/dist/lexical/config/server/loader.js.map +1 -1
  242. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  243. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  244. package/dist/lexical/config/server/sanitize.js +2 -2
  245. package/dist/lexical/config/server/sanitize.js.map +1 -1
  246. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +18 -25
  247. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  248. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  249. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  250. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +0 -1
  251. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  252. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -21
  253. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  254. package/dist/lexical/plugins/SlashMenu/index.css +0 -1
  255. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
  256. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  257. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  258. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +1 -0
  259. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  260. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -2
  261. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  262. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  263. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  264. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  265. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  266. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  267. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  268. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  269. package/dist/lexical/ui/ContentEditable.css +16 -15
  270. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  271. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  272. package/dist/lexical/ui/ContentEditable.js +9 -6
  273. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  274. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  275. package/dist/lexical/ui/icons/H3/index.js +13 -6
  276. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  277. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  278. package/dist/lexical/ui/icons/H4/index.js +13 -6
  279. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  280. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  281. package/dist/lexical/ui/icons/H5/index.js +13 -6
  282. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  283. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  284. package/dist/lexical/ui/icons/H6/index.js +13 -6
  285. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  286. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
  287. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
  288. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
  289. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
  290. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
  291. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
  292. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
  293. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
  294. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
  295. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
  296. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
  297. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
  298. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
  299. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
  300. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
  301. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
  302. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
  303. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
  304. package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
  305. package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
  306. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
  307. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
  308. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
  309. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
  310. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
  311. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
  312. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
  313. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
  314. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
  315. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
  316. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
  317. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
  318. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
  319. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
  320. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
  321. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
  322. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
  323. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
  324. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
  325. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
  326. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
  327. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
  328. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
  329. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
  330. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
  331. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
  332. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
  333. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
  334. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
  335. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
  336. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
  337. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
  338. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
  339. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
  340. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
  341. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
  342. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
  343. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
  344. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
  345. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
  346. package/dist/types/index.d.ts +1 -1
  347. package/dist/types/index.d.ts.map +1 -1
  348. package/dist/types/index.js.map +1 -1
  349. package/dist/types/nodeTypes.d.ts +1 -1
  350. package/dist/types/nodeTypes.d.ts.map +1 -1
  351. package/dist/types/nodeTypes.js.map +1 -1
  352. package/dist/utilities/createServerFeature.d.ts +1 -1
  353. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  354. package/dist/utilities/createServerFeature.js +2 -2
  355. package/dist/utilities/createServerFeature.js.map +1 -1
  356. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  357. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  358. package/dist/utilities/editorConfigFactory.js +9 -9
  359. package/dist/utilities/editorConfigFactory.js.map +1 -1
  360. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  361. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  362. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  363. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  364. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  365. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  366. package/package.json +97 -23
  367. package/dist/dependencyChecker.spec.js +0 -16
  368. package/dist/dependencyChecker.spec.js.map +0 -1
  369. package/dist/exports/client/Field-QGSHF22S.js +0 -2
  370. package/dist/exports/client/Field-QGSHF22S.js.map +0 -7
  371. package/dist/exports/client/chunk-UD4DQ4AK.js +0 -2
  372. package/dist/exports/client/chunk-UD4DQ4AK.js.map +0 -7
  373. package/dist/exports/client/chunk-X3D4LZS7.js +0 -2
  374. package/dist/exports/client/component-PHZQBOJE.js +0 -2
  375. package/dist/exports/client/component-PHZQBOJE.js.map +0 -7
  376. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  377. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  378. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  379. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  380. package/dist/features/experimental_table/client/index.js.map +0 -1
  381. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  382. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  383. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  384. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  385. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  386. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  387. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  388. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  389. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  390. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  391. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  392. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  393. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  394. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  395. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  396. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  397. package/dist/features/experimental_table/server/index.d.ts +0 -3
  398. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  399. package/dist/features/experimental_table/server/index.js.map +0 -1
  400. package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
  401. package/dist/features/experimental_table/server/schema.js.map +0 -1
  402. package/dist/features/link/markdownTransformer.spec.js +0 -195
  403. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  404. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  405. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  406. package/dist/lexical/utils/url.spec.js +0 -114
  407. package/dist/lexical/utils/url.spec.js.map +0 -1
  408. package/dist/utilities/jsx/jsx.spec.js +0 -178
  409. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  410. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-55HZXGUS.js.map} +0 -0
  411. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  412. /package/dist/features/{experimental_table → table}/client/index.js +0 -0
  413. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +0 -0
  414. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  415. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  416. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  417. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  418. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  419. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -0
  420. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  421. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  422. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  423. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  424. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
  425. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  426. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  427. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  428. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
  429. /package/dist/features/{experimental_table → table}/markdownTransformer.d.ts +0 -0
  430. /package/dist/features/{experimental_table → table}/markdownTransformer.js +0 -0
  431. /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
  432. /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
@@ -1,6 +1,7 @@
1
1
  import { sanitizeFields } from 'payload';
2
2
  import { populate } from '../../../populateGraphQL/populate.js';
3
3
  import { createServerFeature } from '../../../utilities/createServerFeature.js';
4
+ import { filterEnabledRelationshipCollections } from '../../relationship/shared/filterEnabledRelationshipCollections.js';
4
5
  import { createNode } from '../../typeUtilities.js';
5
6
  import { uploadPopulationPromiseHOC } from './graphQLPopulationPromise.js';
6
7
  import { i18n } from './i18n.js';
@@ -9,26 +10,26 @@ import { UploadServerNode } from './nodes/UploadNode.js';
9
10
  import { createUploadNodeJSONSchema } from './schema.js';
10
11
  import { uploadValidation } from './validate.js';
11
12
  export const UploadFeature = createServerFeature({
12
- feature: async ({
13
+ feature: ({
13
14
  config: _config,
14
15
  isRoot,
15
16
  parentIsLocalized,
16
- props
17
+ props: unsanitizedProps
17
18
  }) => {
18
- if (!props) {
19
- props = {
20
- collections: {}
21
- };
22
- }
19
+ const props = {
20
+ ...unsanitizedProps,
21
+ collections: unsanitizedProps?.collections ?? {},
22
+ enabledCollectionSlugs: filterEnabledRelationshipCollections(_config.collections, {
23
+ ...unsanitizedProps,
24
+ uploads: true
25
+ }).map(({
26
+ slug
27
+ }) => slug)
28
+ };
23
29
  const clientProps = {
24
- collections: {}
30
+ collections: {},
31
+ enabledCollectionSlugs: props.enabledCollectionSlugs
25
32
  };
26
- if (props.disabledCollections) {
27
- clientProps.disabledCollections = props.disabledCollections;
28
- }
29
- if (props.enabledCollections) {
30
- clientProps.enabledCollections = props.enabledCollections;
31
- }
32
33
  if (props.collections) {
33
34
  for (const collection in props.collections) {
34
35
  clientProps.collections[collection] = {
@@ -40,7 +41,7 @@ export const UploadFeature = createServerFeature({
40
41
  for (const collectionKey in props.collections) {
41
42
  const collection = props.collections[collectionKey];
42
43
  if (collection.fields?.length) {
43
- collection.fields = await sanitizeFields({
44
+ collection.fields = sanitizeFields({
44
45
  config: _config,
45
46
  fields: collection.fields,
46
47
  parentIsLocalized,
@@ -84,6 +85,9 @@ export const UploadFeature = createServerFeature({
84
85
  }
85
86
  return allSubFields;
86
87
  }
88
+ if (!props.enabledCollectionSlugs.includes(node.relationTo)) {
89
+ return null;
90
+ }
87
91
  const collection = req ? req.payload.collections[node?.relationTo] : null;
88
92
  if (collection) {
89
93
  const collectionFieldSchema = props?.collections?.[node?.relationTo]?.fields;
@@ -114,7 +118,7 @@ export const UploadFeature = createServerFeature({
114
118
  req,
115
119
  showHiddenFields
116
120
  }) => {
117
- if (!node?.value) {
121
+ if (!node?.value || !props.enabledCollectionSlugs.includes(node.relationTo)) {
118
122
  return node;
119
123
  }
120
124
  const collection = req.payload.collections[node?.relationTo];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["sanitizeFields","populate","createServerFeature","createNode","uploadPopulationPromiseHOC","i18n","PAYLOAD_UPLOAD","UploadServerNode","createUploadNodeJSONSchema","uploadValidation","UploadFeature","feature","config","_config","isRoot","parentIsLocalized","props","collections","clientProps","disabledCollections","enabledCollections","collection","hasExtraFields","fields","length","validRelationships","map","c","slug","collectionKey","requireFieldLevelRichTextEditor","ClientFeature","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","markdownTransformers","nodes","getSubFields","node","req","allSubFields","collectionFields","concat","payload","relationTo","collectionFieldSchema","Array","isArray","getSubFieldsData","graphQLPopulationPromises","hooks","afterRead","currentDepth","depth","draft","overrideAccess","populateArg","populationPromises","showHiddenFields","value","id","populateDepth","maxDepth","undefined","push","collectionSlug","data","key","select","defaultPopulate","jsonSchema","validations","sanitizedServerFeatureProps"],"sources":["../../../../src/features/upload/server/index.ts"],"sourcesContent":["import type { Config, Field, FieldSchemaMap, UploadCollectionSlug } from 'payload'\n\nimport { sanitizeFields } from 'payload'\n\nimport type { UploadFeaturePropsClient } from '../client/index.js'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { uploadPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { PAYLOAD_UPLOAD } from './markdownTransformer.js'\nimport { UploadServerNode } from './nodes/UploadNode.js'\nimport { createUploadNodeJSONSchema } from './schema.js'\nimport { uploadValidation } from './validate.js'\n\nexport type {\n Internal_UploadData,\n SerializedUploadNode,\n UploadData,\n UploadDataImproved,\n} from './schema.js'\n\nexport type ExclusiveUploadFeatureProps =\n | {\n /**\n * The collections that should be disabled. Overrides the `enableRichTextRelationship` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: UploadCollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled. Overrides the `enableRichTextRelationship` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: UploadCollectionSlug[]\n }\n\nexport type UploadFeatureProps = {\n collections?: {\n [collection: UploadCollectionSlug]: {\n fields: Field[]\n }\n }\n /**\n * Sets a maximum population depth for this upload (not the fields for this upload), regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveUploadFeatureProps\n\nexport const UploadFeature = createServerFeature<\n UploadFeatureProps,\n UploadFeatureProps,\n UploadFeaturePropsClient\n>({\n feature: async ({ config: _config, isRoot, parentIsLocalized, props }) => {\n if (!props) {\n props = { collections: {} }\n }\n\n const clientProps: UploadFeaturePropsClient = {\n collections: {},\n }\n if (props.disabledCollections) {\n clientProps.disabledCollections = props.disabledCollections\n }\n if (props.enabledCollections) {\n clientProps.enabledCollections = props.enabledCollections\n }\n\n if (props.collections) {\n for (const collection in props.collections) {\n clientProps.collections[collection] = {\n hasExtraFields: props.collections[collection]!.fields.length >= 1,\n }\n }\n }\n\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const collectionKey in props.collections) {\n const collection = props.collections[collectionKey]!\n if (collection.fields?.length) {\n collection.fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: collection.fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#UploadFeatureClient',\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ props }) => {\n if (!props?.collections) {\n return null\n }\n\n const schemaMap: FieldSchemaMap = new Map()\n\n for (const collectionKey in props.collections) {\n const collection = props.collections[collectionKey]!\n if (collection.fields?.length) {\n schemaMap.set(collectionKey, {\n fields: collection.fields,\n })\n }\n }\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [PAYLOAD_UPLOAD],\n nodes: [\n createNode({\n getSubFields: ({ node, req }) => {\n if (!node) {\n let allSubFields: Field[] = []\n for (const collection in props?.collections) {\n const collectionFields = props.collections[collection]!.fields\n allSubFields = allSubFields.concat(collectionFields)\n }\n return allSubFields\n }\n const collection = req ? req.payload.collections[node?.relationTo] : null\n\n if (collection) {\n const collectionFieldSchema = props?.collections?.[node?.relationTo]?.fields\n\n if (Array.isArray(collectionFieldSchema)) {\n if (!collectionFieldSchema?.length) {\n return null\n }\n return collectionFieldSchema\n }\n }\n return null\n },\n getSubFieldsData: ({ node }) => {\n return node?.fields\n },\n graphQLPopulationPromises: [uploadPopulationPromiseHOC(props)],\n hooks: {\n afterRead: [\n ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populateArg,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (!node?.value) {\n return node\n }\n const collection = req.payload.collections[node?.relationTo]\n\n if (!collection) {\n return node\n }\n const id =\n typeof node?.value === 'object' && node.value !== null && 'id' in node.value\n ? node.value.id\n : node?.value // for backwards-compatibility\n\n const populateDepth =\n props?.maxDepth !== undefined && props?.maxDepth < depth ? props?.maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collectionSlug: collection.config.slug,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n key: 'value',\n overrideAccess,\n req,\n select:\n populateArg?.[collection.config.slug] ?? collection.config.defaultPopulate,\n showHiddenFields,\n }),\n )\n\n return node\n },\n ],\n },\n jsonSchema: createUploadNodeJSONSchema(props),\n node: UploadServerNode,\n validations: [uploadValidation(props)],\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'upload',\n})\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAI/B,SAASC,QAAQ,QAAQ;AACzB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,IAAI,QAAQ;AACrB,SAASC,cAAc,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,gBAAgB,QAAQ;AA8CjC,OAAO,MAAMC,aAAA,GAAgBR,mBAAA,CAI3B;EACAS,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAA,EAAQC,OAAO;IAAEC,MAAM;IAAEC,iBAAiB;IAAEC;EAAK,CAAE;IACnE,IAAI,CAACA,KAAA,EAAO;MACVA,KAAA,GAAQ;QAAEC,WAAA,EAAa,CAAC;MAAE;IAC5B;IAEA,MAAMC,WA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,gBAAA;QACNkE,WAAA,EAAa,CAAChE,gBAAA,CAAiBO,KAAA;MACjC,GACD;MACD0D,2BAAA,EAA6B1D;IAC/B;EACF;EACAqD,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["sanitizeFields","populate","createServerFeature","filterEnabledRelationshipCollections","createNode","uploadPopulationPromiseHOC","i18n","PAYLOAD_UPLOAD","UploadServerNode","createUploadNodeJSONSchema","uploadValidation","UploadFeature","feature","config","_config","isRoot","parentIsLocalized","props","unsanitizedProps","collections","enabledCollectionSlugs","uploads","map","slug","clientProps","collection","hasExtraFields","fields","length","validRelationships","c","collectionKey","requireFieldLevelRichTextEditor","ClientFeature","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","markdownTransformers","nodes","getSubFields","node","req","allSubFields","collectionFields","concat","includes","relationTo","payload","collectionFieldSchema","Array","isArray","getSubFieldsData","graphQLPopulationPromises","hooks","afterRead","currentDepth","depth","draft","overrideAccess","populateArg","populationPromises","showHiddenFields","value","id","populateDepth","maxDepth","undefined","push","collectionSlug","data","key","select","defaultPopulate","jsonSchema","validations","sanitizedServerFeatureProps"],"sources":["../../../../src/features/upload/server/index.ts"],"sourcesContent":["import type { CollectionSlug, Config, Field, FieldSchemaMap, UploadCollectionSlug } from 'payload'\n\nimport { sanitizeFields } from 'payload'\n\nimport type { UploadFeaturePropsClient } from '../client/index.js'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { filterEnabledRelationshipCollections } from '../../relationship/shared/filterEnabledRelationshipCollections.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { uploadPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { PAYLOAD_UPLOAD } from './markdownTransformer.js'\nimport { UploadServerNode } from './nodes/UploadNode.js'\nimport { createUploadNodeJSONSchema } from './schema.js'\nimport { uploadValidation } from './validate.js'\n\nexport type {\n Internal_UploadData,\n SerializedUploadNode,\n UploadData,\n UploadDataImproved,\n} from './schema.js'\n\nexport type ExclusiveUploadFeatureProps =\n | {\n /**\n * The collections that should be disabled. Overrides the `enableRichTextRelationship` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: UploadCollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled. Overrides the `enableRichTextRelationship` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: UploadCollectionSlug[]\n }\n\nexport type UploadFeatureProps = {\n collections?: {\n [collection: UploadCollectionSlug]: {\n fields: Field[]\n }\n }\n /**\n * Sets a maximum population depth for this upload (not the fields for this upload), regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveUploadFeatureProps\n\nexport type UploadFeatureServerProps = {\n /** Collection policy resolved during feature initialization. */\n enabledCollectionSlugs: CollectionSlug[]\n} & UploadFeatureProps\n\nexport const UploadFeature = createServerFeature<\n UploadFeatureProps,\n UploadFeatureServerProps,\n UploadFeaturePropsClient\n>({\n feature: ({ config: _config, isRoot, parentIsLocalized, props: unsanitizedProps }) => {\n const props: UploadFeatureServerProps = {\n ...unsanitizedProps,\n collections: unsanitizedProps?.collections ?? {},\n enabledCollectionSlugs: filterEnabledRelationshipCollections(_config.collections, {\n ...unsanitizedProps,\n uploads: true,\n }).map(({ slug }) => slug),\n }\n\n const clientProps: UploadFeaturePropsClient = {\n collections: {},\n enabledCollectionSlugs: props.enabledCollectionSlugs,\n }\n\n if (props.collections) {\n for (const collection in props.collections) {\n clientProps.collections[collection] = {\n hasExtraFields: props.collections[collection]!.fields.length >= 1,\n }\n }\n }\n\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const collectionKey in props.collections) {\n const collection = props.collections[collectionKey]!\n if (collection.fields?.length) {\n collection.fields = sanitizeFields({\n config: _config as unknown as Config,\n fields: collection.fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#UploadFeatureClient',\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ props }) => {\n if (!props?.collections) {\n return null\n }\n\n const schemaMap: FieldSchemaMap = new Map()\n\n for (const collectionKey in props.collections) {\n const collection = props.collections[collectionKey]!\n if (collection.fields?.length) {\n schemaMap.set(collectionKey, {\n fields: collection.fields,\n })\n }\n }\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [PAYLOAD_UPLOAD],\n nodes: [\n createNode({\n getSubFields: ({ node, req }) => {\n if (!node) {\n let allSubFields: Field[] = []\n for (const collection in props?.collections) {\n const collectionFields = props.collections[collection]!.fields\n allSubFields = allSubFields.concat(collectionFields)\n }\n return allSubFields\n }\n if (!props.enabledCollectionSlugs.includes(node.relationTo)) {\n return null\n }\n const collection = req ? req.payload.collections[node?.relationTo] : null\n\n if (collection) {\n const collectionFieldSchema = props?.collections?.[node?.relationTo]?.fields\n\n if (Array.isArray(collectionFieldSchema)) {\n if (!collectionFieldSchema?.length) {\n return null\n }\n return collectionFieldSchema\n }\n }\n return null\n },\n getSubFieldsData: ({ node }) => {\n return node?.fields\n },\n graphQLPopulationPromises: [uploadPopulationPromiseHOC(props)],\n hooks: {\n afterRead: [\n ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populateArg,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (!node?.value || !props.enabledCollectionSlugs.includes(node.relationTo)) {\n return node\n }\n const collection = req.payload.collections[node?.relationTo]\n\n if (!collection) {\n return node\n }\n const id =\n typeof node?.value === 'object' && node.value !== null && 'id' in node.value\n ? node.value.id\n : node?.value // for backwards-compatibility\n\n const populateDepth =\n props?.maxDepth !== undefined && props?.maxDepth < depth ? props?.maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collectionSlug: collection.config.slug,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n key: 'value',\n overrideAccess,\n req,\n select:\n populateArg?.[collection.config.slug] ?? collection.config.defaultPopulate,\n showHiddenFields,\n }),\n )\n\n return node\n },\n ],\n },\n jsonSchema: createUploadNodeJSONSchema(props),\n node: UploadServerNode,\n validations: [uploadValidation(props)],\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'upload',\n})\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAI/B,SAASC,QAAQ,QAAQ;AACzB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,oCAAoC,QAAQ;AACrD,SAASC,UAAU,QAAQ;AAC3B,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,IAAI,QAAQ;AACrB,SAASC,cAAc,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,gBAAgB,QAAQ;AAmDjC,OAAO,MAAMC,aAAA,GAAgBT,mBAAA,CAI3B;EACAU,OAAA,EAASA,CAAC;IAAEC,MAAA,EAAQC,OAAO;IAAEC,MAAM;IAAEC,iBAAiB;IAAEC,KAAA,EAAOC;EAAgB,CAAE;IAC/E,MAAMD,KAAA,GAAkC;MACtC,GAAGC,gBAAgB;MACnBC,WAAA,EAAaD,gBAAA,EAAkBC,WAAA,IAAe,CAAC;MAC/CC,sBAAA,EAAwBjB,oCAAA,CAAqCW,OAAA,CAAQK,WAAW,EAAE;QAChF,GAAGD,gBAAgB;QACnBG,OAAA,EAAS;MACX,GAAGC,GAAG,CAAC,CAAC;QAAEC;MAAI,CAAE,KAAKA,IAAA;IACvB;IAEA,MAAMC,WAAA,GAAwC;MAC5CL,WAAA,EAAa,CAAC;MACdC,sBAAA,EAAwBH,KAAA,CAAMG;IAChC;IAEA,IAAIH,KAAA,CAAME,WAAW,EAAE;MACrB,KA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List":[]}
@@ -1,7 +1,7 @@
1
1
  import type { DataFromCollectionSlug, IDTypeForCollectionSlug, JsonObject, TypedUploadCollection, UploadCollectionSlug } from 'payload';
2
2
  import type { LexicalElementFormat } from '../../../types/nodeTypes.js';
3
3
  import type { JSONSchemaFn } from '../../typesServer.js';
4
- import type { UploadFeatureProps } from './index.js';
4
+ import type { UploadFeatureServerProps } from './index.js';
5
5
  export type UploadData<TFields extends JsonObject = JsonObject> = {
6
6
  [TCollectionSlug in UploadCollectionSlug]: {
7
7
  fields: TFields;
@@ -48,5 +48,5 @@ export type SerializedUploadNode<TSlugs extends UploadCollectionSlug = UploadCol
48
48
  type: 'upload';
49
49
  version: number;
50
50
  };
51
- export declare const createUploadNodeJSONSchema: (props: undefined | UploadFeatureProps) => JSONSchemaFn;
51
+ export declare const createUploadNodeJSONSchema: (props: UploadFeatureServerProps) => JSONSchemaFn;
52
52
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAKhB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAKpD,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,UAAU,GAAG,UAAU,IAAI;KAC/D,eAAe,IAAI,oBAAoB,GAAG;QACzC,MAAM,EAAE,OAAO,CAAA;QACf,6DAA6D;QAC7D,EAAE,EAAE,MAAM,CAAA;QACV,UAAU,EAAE,eAAe,CAAA;QAC3B,6DAA6D;QAC7D,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,uB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AAC,oBAAoB,CAAC,CAAA;AAEvB,MAAM,MAAM,oBAAoB,CAC9B,MAAM,SAAS,oBAAoB,GAAG,oBAAoB,EAC1D,OAAO,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,IAChC;KACD,KAAK,IAAI,MAAM,GAAG;QACjB,UAAU,EAAE,KAAK,CAAA;QACjB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAA;KACtE;CACF,CAAC,MAAM,CAAC,GAAG;IACV,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,oBAAoB,CAAA;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAiCD,eAAO,MAAM,0BAA0B,UAC7B,wBAAwB,KAAG,YAmGlC,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import { createHash } from 'crypto';
2
2
  import { fieldsToJSONSchema, flattenAllFields } from 'payload';
3
3
  import { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js';
4
- import { filterEnabledRelationshipCollections } from '../../relationship/shared/filterEnabledRelationshipCollections.js';
5
4
  /** MUST stay byte-for-byte in sync with the runtime `SerializedUploadNode` declared above. */
6
5
  const SERIALIZED_UPLOAD_NODE_TS = `export type SerializedUploadNode<TSlugs extends keyof Config['collections'], TFields = { [k: string]: unknown }> = {
7
6
  type: 'upload';
@@ -39,11 +38,9 @@ export const createUploadNodeJSONSchema = props => ({
39
38
  }) => {
40
39
  const isInput = variant === 'input';
41
40
  typeStringDefinitions.add(isInput ? SERIALIZED_UPLOAD_NODE_INPUT_TS : SERIALIZED_UPLOAD_NODE_TS);
42
- const enabledCollections = config?.collections ? filterEnabledRelationshipCollections(config.collections, {
43
- disabledCollections: props?.disabledCollections,
44
- enabledCollections: props?.enabledCollections,
45
- uploads: true
46
- }) : [];
41
+ const {
42
+ enabledCollectionSlugs
43
+ } = props;
47
44
  // Configured extra fields are registered as their own interface and referenced here, so the
48
45
  // generated TypeScript keeps them - the node-level `tsType` would otherwise erase `fields` to
49
46
  // `{ [k: string]: unknown }`. Mirrors how LinkFeature handles custom link fields.
@@ -52,8 +49,7 @@ export const createUploadNodeJSONSchema = props => ({
52
49
  // generated union correctly pairs each `relationTo` with its own fields type. A single
53
50
  // `SerializedUploadNode<'a' | 'b', AFields | BFields>` would lose that pairing.
54
51
  const perCollectionTsTypes = [];
55
- const collectionVariants = enabledCollections.map(collection => {
56
- const slug = collection.slug;
52
+ const collectionVariants = enabledCollectionSlugs.map(slug => {
57
53
  const idType = collectionIDFieldTypes[slug] ?? 'string';
58
54
  const extraFields = props?.collections?.[slug]?.fields ?? [];
59
55
  const flattenedExtra = flattenAllFields({
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":["createHash","fieldsToJSONSchema","flattenAllFields","formatSchema","versionSchema","filterEnabledRelationshipCollections","SERIALIZED_UPLOAD_NODE_TS","SERIALIZED_UPLOAD_NODE_INPUT_TS","hashUploadFields","schema","update","JSON","stringify","digest","slice","toUpperCase","createUploadNodeJSONSchema","props","collectionIDFieldTypes","config","i18n","interfaceNameDefinitions","typeStringDefinitions","variant","isInput","add","enabledCollections","collections","disabledCollections","uploads","perCollectionTsTypes","collectionVariants","map","collection","slug","idType","extraFields","fields","flattenedExtra","extraFieldsSchema","length","properties","required","fieldsSchema","type","additionalProperties","fieldsTypeName","set","$ref","uploadTsName","push","id","const","format","relationTo","value","description","oneOf","version","baseSchema","tsType","join"],"sources":["../../../../src/features/upload/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type {\n DataFromCollectionSlug,\n IDTypeForCollectionSlug,\n JsonObject,\n TypedUploadCollection,\n UploadCollectionSlug,\n} from 'payload'\n\nimport { createHash } from 'crypto'\nimport { fieldsToJSONSchema, flattenAllFields } from 'payload'\n\nimport type { LexicalElementFormat } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\nimport type { UploadFeatureProps } from './index.js'\n\nimport { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js'\nimport { filterEnabledRelationshipCollections } from '../../relationship/shared/filterEnabledRelationshipCollections.js'\n\nexport type UploadData<TFields extends JsonObject = JsonObject> = {\n [TCollectionSlug in UploadCollectionSlug]: {\n fields: TFields\n /** ID of this upload node — NOT the linked document's ID. */\n id: string\n relationTo: TCollectionSlug\n /** Either the document ID or the full populated document. */\n value: DataFromCollectionSlug<TCollectionSlug> | IDTypeForCollectionSlug<TCollectionSlug>\n }\n}[UploadCollectionSlug]\n\n/** @internal Adds a pending state to `UploadData`. */\nexport type Internal_UploadData<TFields extends JsonObject = JsonObject> = {\n pending?: {\n /** Bulk upload form ID. */\n formID: string\n /** `src` of the image DOM element. */\n src: string\n }\n} & UploadData<TFields>\n\n/**\n * More precise variant of {@link UploadData}. Replaces `UploadData` in v4.\n * @internal\n * @todo Replace UploadData with UploadDataImproved in 4.0\n */\nexport type UploadDataImproved<TFields extends JsonObject = JsonObject> = {\n [TCollectionSlug in UploadCollectionSlug]: {\n fields: TFields\n id: string\n relationTo: TCollectionSlug\n value: IDTypeForCollectionSlug<TCollectionSlug> | TypedUploadCollection[TCollectionSlug]\n }\n}[UploadCollectionSlug]\n\nexport type SerializedUploadNode<\n TSlugs extends UploadCollectionSlug = UploadCollectionSlug,\n TFields = { [k: string]: unknown },\n> = {\n [TSlug in TSlugs]: {\n relationTo: TSlug\n value: DataFromCollectionSlug<TSlug> | IDTypeForCollectionSlug<TSlug>\n }\n}[TSlugs] & {\n fields: TFields\n format: LexicalElementFormat\n id: string\n type: 'upload'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedUploadNode` declared above. */\nconst SERIALIZED_UPLOAD_NODE_TS = `export type SerializedUploadNode<TSlugs extends keyof Config['collections'], TFields = { [k: string]: unknown }> = {\n type: 'upload';\n format: LexicalElementFormat;\n id: string;\n version: number;\n fields: TFields;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: Config['collections'][TSlug]['id'] | Config['collections'][TSlug];\n };\n}[TSlugs];`\n\n/** Input variant of `SerializedUploadNode`: `value` is ID-only (you only ever write an ID). */\nconst SERIALIZED_UPLOAD_NODE_INPUT_TS = `export type SerializedUploadNodeInput<TSlugs extends keyof Config['collections'], TFields = { [k: string]: unknown }> = {\n type: 'upload';\n format: LexicalElementFormat;\n id: string;\n version: number;\n fields: TFields;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: Config['collections'][TSlug]['id'];\n };\n}[TSlugs];`\n\nconst hashUploadFields = (schema: JSONSchema4): string =>\n createHash('sha256').update(JSON.stringify(schema)).digest('hex').slice(0, 8).toUpperCase()\n\nexport const createUploadNodeJSONSchema =\n (props: undefined | UploadFeatureProps): JSONSchemaFn =>\n ({\n collectionIDFieldTypes,\n config,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n variant,\n }) => {\n const isInput = variant === 'input'\n typeStringDefinitions.add(isInput ? SERIALIZED_UPLOAD_NODE_INPUT_TS : SERIALIZED_UPLOAD_NODE_TS)\n const enabledCollections = config?.collections\n ? filterEnabledRelationshipCollections(config.collections, {\n disabledCollections: props?.disabledCollections,\n enabledCollections: props?.enabledCollections,\n uploads: true,\n })\n : []\n\n // Configured extra fields are registered as their own interface and referenced here, so the\n // generated TypeScript keeps them - the node-level `tsType` would otherwise erase `fields` to\n // `{ [k: string]: unknown }`. Mirrors how LinkFeature handles custom link fields.\n //\n // Each collection gets its own `SerializedUploadNode<'slug', Fields>` instantiation so the\n // generated union correctly pairs each `relationTo` with its own fields type. A single\n // `SerializedUploadNode<'a' | 'b', AFields | BFields>` would lose that pairing.\n const perCollectionTsTypes: string[] = []\n const collectionVariants: JSONSchema4[] = enabledCollections.map((collection) => {\n const slug = collection.slug\n const idType: 'number' | 'string' = collectionIDFieldTypes[slug] ?? 'string'\n const extraFields = props?.collections?.[slug]?.fields ?? []\n const flattenedExtra = flattenAllFields({ fields: extraFields })\n const extraFieldsSchema =\n flattenedExtra.length > 0 && config\n ? fieldsToJSONSchema({\n collectionIDFieldTypes,\n config,\n fields: flattenedExtra,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n variant,\n })\n : { properties: {}, required: [] }\n\n let fieldsSchema: JSONSchema4 = {\n type: 'object',\n additionalProperties: false,\n properties: extraFieldsSchema.properties,\n required: extraFieldsSchema.required,\n }\n let fieldsTypeName: string | undefined\n if (flattenedExtra.length > 0) {\n fieldsTypeName = `LexicalUploadFields_${hashUploadFields(fieldsSchema)}`\n interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema)\n fieldsSchema = { $ref: `#/$defs/${fieldsTypeName}` }\n }\n\n const uploadTsName = isInput ? 'SerializedUploadNodeInput' : 'SerializedUploadNode'\n perCollectionTsTypes.push(\n fieldsTypeName\n ? `${uploadTsName}<'${slug}', ${fieldsTypeName}>`\n : `${uploadTsName}<'${slug}'>`,\n )\n\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: { type: 'string' },\n type: { type: 'string', const: 'upload' },\n fields: fieldsSchema,\n format: formatSchema,\n relationTo: { type: 'string', const: slug },\n value: isInput\n ? { type: idType, description: 'The uploaded file ID.' }\n : {\n description:\n 'The uploaded file by ID (string or number). Populated to the full upload document when read at depth > 0.',\n oneOf: [{ type: idType }, { $ref: `#/$defs/${slug}` }],\n },\n version: versionSchema,\n },\n required: ['fields', 'format', 'id', 'relationTo', 'type', 'value', 'version'],\n }\n })\n\n let schema: JSONSchema4\n if (collectionVariants.length === 0) {\n // Fallback when no enabled upload collections.\n schema = {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: { type: 'string', const: 'upload' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n }\n } else {\n const baseSchema: JSONSchema4 =\n collectionVariants.length === 1 ? collectionVariants[0]! : { oneOf: collectionVariants }\n schema = { ...baseSchema, tsType: perCollectionTsTypes.join(' | ') }\n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EAAO/B,OAAA,GACH;UAAEoB,IAAA,EAAMT,MAAA;UAAQqB,WAAA,EAAa;QAAwB,IACrD;UACEA,WAAA,EACE;UACFC,KAAA,EAAO,CAAC;YAAEb,IAAA,EAAMT;UAAO,GAAG;YAAEa,IAAA,EAAM,WAAWd,IAAA;UAAO;QACtD;QACJwB,OAAA,EAAStD;MACX;MACAsC,QAAA,EAAU,CAAC,UAAU,UAAU,MAAM,cAAc,QAAQ,SAAS;IACtE;EACF;EAEA,IAAIjC,MAAA;EACJ,IAAIsB,kBAAA,CAAmBS,MAAM,KAAK,GAAG;IACnC;IACA/B,MAAA,GAAS;MACPmC,IAAA,EAAM;MACNC,oBAAA,EAAsB;MACtBJ,UAAA,EAAY;QACVG,IAAA,EAAM;UAAEA,IAAA,EAAM;UAAUQ,KAAA,EAAO;QAAS;QACxCM,OAAA,EAAStD;MACX;MACAsC,QAAA,EAAU,CAAC,QAAQ;IACrB;EACF,OAAO;IACL,MAAMiB,UAAA,GACJ5B,kBAAA,CAAmBS,MAAM,KAAK,IAAIT,kBAAkB,CAAC,EAAE,GAAI;MAAE0B,KAAA,EAAO1B;IAAmB;IACzFtB,MAAA,GAAS;MAAE,GAAGkD,UAAU;MAAEC,MAAA,EAAQ9B,oBAAA,CAAqB+B,IAAI,CAAC;IAAO;EACrE;EAEA,OAAOpD,MAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"schema.js","names":["createHash","fieldsToJSONSchema","flattenAllFields","formatSchema","versionSchema","SERIALIZED_UPLOAD_NODE_TS","SERIALIZED_UPLOAD_NODE_INPUT_TS","hashUploadFields","schema","update","JSON","stringify","digest","slice","toUpperCase","createUploadNodeJSONSchema","props","collectionIDFieldTypes","config","i18n","interfaceNameDefinitions","typeStringDefinitions","variant","isInput","add","enabledCollectionSlugs","perCollectionTsTypes","collectionVariants","map","slug","idType","extraFields","collections","fields","flattenedExtra","extraFieldsSchema","length","properties","required","fieldsSchema","type","additionalProperties","fieldsTypeName","set","$ref","uploadTsName","push","id","const","format","relationTo","value","description","oneOf","version","baseSchema","tsType","join"],"sources":["../../../../src/features/upload/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type {\n DataFromCollectionSlug,\n IDTypeForCollectionSlug,\n JsonObject,\n TypedUploadCollection,\n UploadCollectionSlug,\n} from 'payload'\n\nimport { createHash } from 'crypto'\nimport { fieldsToJSONSchema, flattenAllFields } from 'payload'\n\nimport type { LexicalElementFormat } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\nimport type { UploadFeatureServerProps } from './index.js'\n\nimport { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js'\n\nexport type UploadData<TFields extends JsonObject = JsonObject> = {\n [TCollectionSlug in UploadCollectionSlug]: {\n fields: TFields\n /** ID of this upload node — NOT the linked document's ID. */\n id: string\n relationTo: TCollectionSlug\n /** Either the document ID or the full populated document. */\n value: DataFromCollectionSlug<TCollectionSlug> | IDTypeForCollectionSlug<TCollectionSlug>\n }\n}[UploadCollectionSlug]\n\n/** @internal Adds a pending state to `UploadData`. */\nexport type Internal_UploadData<TFields extends JsonObject = JsonObject> = {\n pending?: {\n /** Bulk upload form ID. */\n formID: string\n /** `src` of the image DOM element. */\n src: string\n }\n} & UploadData<TFields>\n\n/**\n * More precise variant of {@link UploadData}. Replaces `UploadData` in v4.\n * @internal\n * @todo Replace UploadData with UploadDataImproved in 4.0\n */\nexport type UploadDataImproved<TFields extends JsonObject = JsonObject> = {\n [TCollectionSlug in UploadCollectionSlug]: {\n fields: TFields\n id: string\n relationTo: TCollectionSlug\n value: IDTypeForCollectionSlug<TCollectionSlug> | TypedUploadCollection[TCollectionSlug]\n }\n}[UploadCollectionSlug]\n\nexport type SerializedUploadNode<\n TSlugs extends UploadCollectionSlug = UploadCollectionSlug,\n TFields = { [k: string]: unknown },\n> = {\n [TSlug in TSlugs]: {\n relationTo: TSlug\n value: DataFromCollectionSlug<TSlug> | IDTypeForCollectionSlug<TSlug>\n }\n}[TSlugs] & {\n fields: TFields\n format: LexicalElementFormat\n id: string\n type: 'upload'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedUploadNode` declared above. */\nconst SERIALIZED_UPLOAD_NODE_TS = `export type SerializedUploadNode<TSlugs extends keyof Config['collections'], TFields = { [k: string]: unknown }> = {\n type: 'upload';\n format: LexicalElementFormat;\n id: string;\n version: number;\n fields: TFields;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: Config['collections'][TSlug]['id'] | Config['collections'][TSlug];\n };\n}[TSlugs];`\n\n/** Input variant of `SerializedUploadNode`: `value` is ID-only (you only ever write an ID). */\nconst SERIALIZED_UPLOAD_NODE_INPUT_TS = `export type SerializedUploadNodeInput<TSlugs extends keyof Config['collections'], TFields = { [k: string]: unknown }> = {\n type: 'upload';\n format: LexicalElementFormat;\n id: string;\n version: number;\n fields: TFields;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: Config['collections'][TSlug]['id'];\n };\n}[TSlugs];`\n\nconst hashUploadFields = (schema: JSONSchema4): string =>\n createHash('sha256').update(JSON.stringify(schema)).digest('hex').slice(0, 8).toUpperCase()\n\nexport const createUploadNodeJSONSchema =\n (props: UploadFeatureServerProps): JSONSchemaFn =>\n ({\n collectionIDFieldTypes,\n config,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n variant,\n }) => {\n const isInput = variant === 'input'\n typeStringDefinitions.add(isInput ? SERIALIZED_UPLOAD_NODE_INPUT_TS : SERIALIZED_UPLOAD_NODE_TS)\n const { enabledCollectionSlugs } = props\n\n // Configured extra fields are registered as their own interface and referenced here, so the\n // generated TypeScript keeps them - the node-level `tsType` would otherwise erase `fields` to\n // `{ [k: string]: unknown }`. Mirrors how LinkFeature handles custom link fields.\n //\n // Each collection gets its own `SerializedUploadNode<'slug', Fields>` instantiation so the\n // generated union correctly pairs each `relationTo` with its own fields type. A single\n // `SerializedUploadNode<'a' | 'b', AFields | BFields>` would lose that pairing.\n const perCollectionTsTypes: string[] = []\n const collectionVariants: JSONSchema4[] = enabledCollectionSlugs.map((slug) => {\n const idType: 'number' | 'string' = collectionIDFieldTypes[slug] ?? 'string'\n const extraFields = props?.collections?.[slug]?.fields ?? []\n const flattenedExtra = flattenAllFields({ fields: extraFields })\n const extraFieldsSchema =\n flattenedExtra.length > 0 && config\n ? fieldsToJSONSchema({\n collectionIDFieldTypes,\n config,\n fields: flattenedExtra,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n variant,\n })\n : { properties: {}, required: [] }\n\n let fieldsSchema: JSONSchema4 = {\n type: 'object',\n additionalProperties: false,\n properties: extraFieldsSchema.properties,\n required: extraFieldsSchema.required,\n }\n let fieldsTypeName: string | undefined\n if (flattenedExtra.length > 0) {\n fieldsTypeName = `LexicalUploadFields_${hashUploadFields(fieldsSchema)}`\n interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema)\n fieldsSchema = { $ref: `#/$defs/${fieldsTypeName}` }\n }\n\n const uploadTsName = isInput ? 'SerializedUploadNodeInput' : 'SerializedUploadNode'\n perCollectionTsTypes.push(\n fieldsTypeName\n ? `${uploadTsName}<'${slug}', ${fieldsTypeName}>`\n : `${uploadTsName}<'${slug}'>`,\n )\n\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: { type: 'string' },\n type: { type: 'string', const: 'upload' },\n fields: fieldsSchema,\n format: formatSchema,\n relationTo: { type: 'string', const: slug },\n value: isInput\n ? { type: idType, description: 'The uploaded file ID.' }\n : {\n description:\n 'The uploaded file by ID (string or number). Populated to the full upload document when read at depth > 0.',\n oneOf: [{ type: idType }, { $ref: `#/$defs/${slug}` }],\n },\n version: versionSchema,\n },\n required: ['fields', 'format', 'id', 'relationTo', 'type', 'value', 'version'],\n }\n })\n\n let schema: JSONSchema4\n if (collectionVariants.length === 0) {\n // Fallback when no enabled upload collections.\n schema = {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: { type: 'string', const: 'upload' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n }\n } else {\n const baseSchema: JSONSchema4 =\n collectionVariants.length === 1 ? collectionVariants[0]! : { oneOf: collectionVariants }\n schema = { ...baseSchema, tsType: perCollectionTsTypes.join(' | ') }\n }\n\n return schema\n }\n"],"mappings":"AASA,SAASA,UAAU,QAAQ;AAC3B,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ;AAMrD,SAASC,YAAY,EAAEC,aAAa,QAAQ;AAqD5C;AACA,MAAMC,yBAAA,GAA4B;;;;;;;;;;;WAWvB;AAEX;AACA,MAAMC,+BAAA,GAAkC;;;;;;;;;;;WAW7B;AAEX,MAAMC,gBAAA,GAAoBC,MAAA,IACxBR,UAAA,CAAW,UAAUS,MAAM,CAACC,IAAA,CAAKC,SAAS,CAACH,MAAA,GAASI,MAAM,CAAC,OAAOC,KAAK,CAAC,GAAG,GAAGC,WAAW;AAE3F,OAAO,MAAMC,0BAAA,GACVC,KAAA,IACD,CAAC;EACCC,sBAAsB;EACtBC,MAAM;EACNC,IAAI;EACJC,wBAAwB;EACxBC,qBAAqB;EACrBC;AAAO,CACR;EACC,MAAMC,OAAA,GAAUD,OAAA,KAAY;EAC5BD,qBAAA,CAAsBG,GAAG,CAACD,OAAA,GAAUjB,+BAAA,GAAkCD,yBAAA;EACtE,MAAM;IAAEoB;EAAsB,CAAE,GAAGT,KAAA;EAEnC;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMU,oBAAA,GAAiC,EAAE;EACzC,MAAMC,kBAAA,GAAoCF,sBAAA,CAAuBG,GAAG,CAAEC,IAAA;IACpE,MAAMC,MAAA,GAA8Bb,sBAAsB,CAACY,IAAA,CAAK,IAAI;IACpE,MAAME,WAAA,GAAcf,KAAA,EAAOgB,WAAA,GAAcH,IAAA,CAAK,EAAEI,MAAA,IAAU,EAAE;IAC5D,MAAMC,cAAA,GAAiBhC,gBAAA,CAAiB;MAAE+B,MAAA,EAAQF;IAAY;IAC9D,MAAMI,iBAAA,GACJD,cAAA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,EAAO,CAAC;YAAEb,IAAA,EAAMV;UAAO,GAAG;YAAEc,IAAA,EAAM,WAAWf,IAAA;UAAO;QACtD;QACJyB,OAAA,EAASlD;MACX;MACAkC,QAAA,EAAU,CAAC,UAAU,UAAU,MAAM,cAAc,QAAQ,SAAS;IACtE;EACF;EAEA,IAAI9B,MAAA;EACJ,IAAImB,kBAAA,CAAmBS,MAAM,KAAK,GAAG;IACnC;IACA5B,MAAA,GAAS;MACPgC,IAAA,EAAM;MACNC,oBAAA,EAAsB;MACtBJ,UAAA,EAAY;QACVG,IAAA,EAAM;UAAEA,IAAA,EAAM;UAAUQ,KAAA,EAAO;QAAS;QACxCM,OAAA,EAASlD;MACX;MACAkC,QAAA,EAAU,CAAC,QAAQ;IACrB;EACF,OAAO;IACL,MAAMiB,UAAA,GACJ5B,kBAAA,CAAmBS,MAAM,KAAK,IAAIT,kBAAkB,CAAC,EAAE,GAAI;MAAE0B,KAAA,EAAO1B;IAAmB;IACzFnB,MAAA,GAAS;MAAE,GAAG+C,UAAU;MAAEC,MAAA,EAAQ9B,oBAAA,CAAqB+B,IAAI,CAAC;IAAO;EACrE;EAEA,OAAOjD,MAAA;AACT","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { NodeValidation } from '../../typesServer.js';
2
- import type { UploadFeatureProps } from './index.js';
2
+ import type { UploadFeatureServerProps } from './index.js';
3
3
  import type { SerializedUploadNode } from './schema.js';
4
- export declare const uploadValidation: (props: UploadFeatureProps) => NodeValidation<SerializedUploadNode>;
4
+ export declare const uploadValidation: (props: UploadFeatureServerProps) => NodeValidation<SerializedUploadNode>;
5
5
  //# sourceMappingURL=validate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,eAAO,MAAM,gBAAgB,UACpB,kBAAkB,KACxB,cAAc,CAAC,oBAAoB,CAqErC,CAAA"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,eAAO,MAAM,gBAAgB,UACpB,wBAAwB,KAC9B,cAAc,CAAC,oBAAoB,CAyErC,CAAA"}
@@ -17,6 +17,9 @@ export const uploadValidation = props => {
17
17
  }
18
18
  }
19
19
  }) => {
20
+ if (!props.enabledCollectionSlugs.includes(node.relationTo)) {
21
+ return t('validation:invalidSelection');
22
+ }
20
23
  const idType = payload.collections[node.relationTo]?.customIDType || payload.db.defaultIDType;
21
24
  // @ts-expect-error - Fix in Payload v4
22
25
  const nodeID = node?.value?.id || node?.value // for backwards-compatibility
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","names":["fieldSchemasToFormState","isValidID","uploadValidation","props","node","validation","options","id","data","operation","preferences","req","payload","t","idType","collections","relationTo","customIDType","db","defaultIDType","nodeID","value","Object","keys","length","collection","fields","result","collectionSlug","documentData","fieldSchemaMap","undefined","initialBlockData","permissions","renderAllFields","schemaPath","errorPathsSet","Set","fieldKey","fieldState","errorPaths","errorPath","add","Array","from","join"],"sources":["../../../../src/features/upload/server/validate.ts"],"sourcesContent":["import { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\nimport { isValidID } from 'payload'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { UploadFeatureProps } from './index.js'\nimport type { SerializedUploadNode } from './schema.js'\n\nexport const uploadValidation = (\n props: UploadFeatureProps,\n): NodeValidation<SerializedUploadNode> => {\n return async ({\n node,\n validation: {\n options: {\n id,\n data,\n operation,\n preferences,\n req,\n req: { payload, t },\n },\n },\n }) => {\n const idType = payload.collections[node.relationTo]?.customIDType || payload.db.defaultIDType\n // @ts-expect-error - Fix in Payload v4\n const nodeID = node?.value?.id || node?.value // for backwards-compatibility\n\n if (!isValidID(nodeID, idType)) {\n return t('validation:validUploadID')\n }\n\n if (!props?.collections) {\n return true\n }\n\n if (Object.keys(props?.collections).length === 0) {\n return true\n }\n\n const collection = props?.collections[node.relationTo]\n\n if (!collection?.fields?.length) {\n return true\n }\n\n const result = await fieldSchemasToFormState({\n id,\n collectionSlug: node.relationTo,\n data: node?.fields ?? {},\n documentData: data,\n fields: collection.fields,\n fieldSchemaMap: undefined,\n initialBlockData: node?.fields ?? {},\n operation: operation === 'create' || operation === 'update' ? operation : 'update',\n permissions: {},\n preferences,\n renderAllFields: false,\n req,\n schemaPath: '',\n })\n\n const errorPathsSet = new Set<string>()\n for (const fieldKey in result) {\n const fieldState = result[fieldKey]\n if (fieldState?.errorPaths?.length) {\n for (const errorPath of fieldState.errorPaths) {\n errorPathsSet.add(errorPath)\n }\n }\n }\n const errorPaths = Array.from(errorPathsSet)\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ;AACxC,SAASC,SAAS,QAAQ;AAM1B,OAAO,MAAMC,gBAAA,GACXC,KAAA;EAEA,OAAO,OAAO;IACZC,IAAI;IACJC,UAAA,EAAY;MACVC,OAAA,EAAS;QACPC,EAAE;QACFC,IAAI;QACJC,SAAS;QACTC,WAAW;QACXC,GAAG;QACHA,GAAA,EAAK;UAAEC,OAAO;UAAEC;QAAC;MAAE;IACpB;EACF,CACF;IACC,MAAMC,MAAA,GAASF,OAAA,CAAQG,WAAW,CAACX,IAAA,CAAKY,UAAU,CAAC,EAAEC,YAAA,IAAgBL,OA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AAMiB,SAAA,IAAaF,UAAA,CAAWC,UAAU,EAAE;UAC7CJ,aAAA,CAAcM,GAAG,CAACD,SAAA;QACpB;MACF;IACF;IACA,MAAMD,UAAA,GAAaG,KAAA,CAAMC,IAAI,CAACR,aAAA;IAE9B,IAAII,UAAA,CAAWhB,MAAM,EAAE;MACrB,OAAO,uCAAuCgB,UAAA,CAAWK,IAAI,CAAC;IAChE;IAEA,OAAO;EACT;AACF","ignoreList":[]}
1
+ {"version":3,"file":"validate.js","names":["fieldSchemasToFormState","isValidID","uploadValidation","props","node","validation","options","id","data","operation","preferences","req","payload","t","enabledCollectionSlugs","includes","relationTo","idType","collections","customIDType","db","defaultIDType","nodeID","value","Object","keys","length","collection","fields","result","collectionSlug","documentData","fieldSchemaMap","undefined","initialBlockData","permissions","renderAllFields","schemaPath","errorPathsSet","Set","fieldKey","fieldState","errorPaths","errorPath","add","Array","from","join"],"sources":["../../../../src/features/upload/server/validate.ts"],"sourcesContent":["import { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\nimport { isValidID } from 'payload'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { UploadFeatureServerProps } from './index.js'\nimport type { SerializedUploadNode } from './schema.js'\n\nexport const uploadValidation = (\n props: UploadFeatureServerProps,\n): NodeValidation<SerializedUploadNode> => {\n return async ({\n node,\n validation: {\n options: {\n id,\n data,\n operation,\n preferences,\n req,\n req: { payload, t },\n },\n },\n }) => {\n if (!props.enabledCollectionSlugs.includes(node.relationTo)) {\n return t('validation:invalidSelection')\n }\n\n const idType = payload.collections[node.relationTo]?.customIDType || payload.db.defaultIDType\n // @ts-expect-error - Fix in Payload v4\n const nodeID = node?.value?.id || node?.value // for backwards-compatibility\n\n if (!isValidID(nodeID, idType)) {\n return t('validation:validUploadID')\n }\n\n if (!props?.collections) {\n return true\n }\n\n if (Object.keys(props?.collections).length === 0) {\n return true\n }\n\n const collection = props?.collections[node.relationTo]\n\n if (!collection?.fields?.length) {\n return true\n }\n\n const result = await fieldSchemasToFormState({\n id,\n collectionSlug: node.relationTo,\n data: node?.fields ?? {},\n documentData: data,\n fields: collection.fields,\n fieldSchemaMap: undefined,\n initialBlockData: node?.fields ?? {},\n operation: operation === 'create' || operation === 'update' ? operation : 'update',\n permissions: {},\n preferences,\n renderAllFields: false,\n req,\n schemaPath: '',\n })\n\n const errorPathsSet = new Set<string>()\n for (const fieldKey in result) {\n const fieldState = result[fieldKey]\n if (fieldState?.errorPaths?.length) {\n for (const errorPath of fieldState.errorPaths) {\n errorPathsSet.add(errorPath)\n }\n }\n }\n const errorPaths = Array.from(errorPathsSet)\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ;AACxC,SAASC,SAAS,QAAQ;AAM1B,OAAO,MAAMC,gBAAA,GACXC,KAAA;EAEA,OAAO,OAAO;IACZC,IAAI;IACJC,UAAA,EAAY;MACVC,OAAA,EAAS;QACPC,EAAE;QACFC,IAAI;QACJC,SAAS;QACTC,WAAW;QACXC,GAAG;QACHA,GAAA,EAAK;UAAEC,OAAO;UAAEC;QAAC;MAAE;IACpB;EACF,CACF;IACC,IAAI,CAACV,KAAA,CAAMW,sBAAsB,CAACC,QAAQ,CAACX,IAAA,CAAKY,UAAU,GAAG;MAC3D,OAAOH,CAAA,CAAE;IACX;IAEA,MAAMI,MAAA,GAASL,OAAA,CAAQM,WAAW,CAACd,IAAA,CAAKY,UAAU,CAAC,EAAEG,YAAA,IAAgBP,OAAA,CAAQQ,EAAE,CAACC,aAAa;IAC7F;IACA,MAAMC,MAAA,GAASlB,IAAA,EAAMmB,KAAA,EAAOhB,EAAA,IAAMH,IAAA,EAAMmB,KAAA,CAAM;AAAA;IAE9C,IAAI,CAACtB,SAAA,CAAUqB,MAAA,EAAQL,MAAA,GAAS;MAC9B,OAAOJ,CAAA,CAAE;IACX;IAEA,IAAI,CAACV,KAAA,EAAOe,WAAA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AAO;EACT;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/Diff/converters/listitem/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAA;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAE5E,OAAO,aAAa,CAAA;AAEpB,eAAO,MAAM,8BAA8B,EAAE,mBAAmB,CAAC,sBAAsB,CA+DtF,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/Diff/converters/listitem/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAA;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAE5E,OAAO,aAAa,CAAA;AAEpB,eAAO,MAAM,8BAA8B,EAAE,mBAAmB,CAAC,sBAAsB,CA+DtF,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CheckIcon } from '@payloadcms/ui/rsc';
3
+ import escapeHTML from 'escape-html';
3
4
  import './index.css';
4
5
  export const ListItemDiffHTMLConverterAsync = {
5
6
  listitem: async ({
@@ -57,7 +58,7 @@ export const ListItemDiffHTMLConverterAsync = {
57
58
  return `<li
58
59
  class="${hasSubLists ? 'nestedListItem' : ''}"
59
60
  style="${hasSubLists ? `list-style-type: none;${providedCSSString}` : providedCSSString}"
60
- value="${node.value}"
61
+ value="${escapeHTML(String(node.value))}"
61
62
  data-enable-match="true"
62
63
  >${children}</li>`;
63
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["CheckIcon","ListItemDiffHTMLConverterAsync","listitem","node","nodesToHTML","parent","providedCSSString","hasSubLists","children","some","child","type","nodes","join","listType","ReactDOMServer","default","JSX","_jsx","checked","className","role","tabIndex","value","dangerouslySetInnerHTML","__html","_jsxs","html","renderToStaticMarkup","styleIndex","indexOf","classIndex","classEndIndex","substring","classNameWithStyle","htmlWithStyle","replace"],"sources":["../../../../../src/field/Diff/converters/listitem/index.tsx"],"sourcesContent":["import { CheckIcon } from '@payloadcms/ui/rsc'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedListItemNode } from '../../../../types/nodeTypes.js'\n\nimport './index.css'\n\nexport const ListItemDiffHTMLConverterAsync: HTMLConvertersAsync<SerializedListItemNode> = {\n listitem: async ({ node, nodesToHTML, parent, providedCSSString }) => {\n const hasSubLists = node.children.some((child) => child.type === 'list')\n\n const children = (\n await nodesToHTML({\n nodes: node.children,\n })\n ).join('')\n\n if ('listType' in parent && parent?.listType === 'check') {\n const ReactDOMServer = (await import('react-dom/server')).default\n\n const JSX = (\n <li\n aria-checked={node.checked ? true : false}\n className={`checkboxItem ${node.checked ? 'checkboxItem--checked' : 'checkboxItem--unchecked'}${\n hasSubLists ? ' checkboxItem--nested' : ''\n }`}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"checkbox\"\n tabIndex={-1}\n value={node.value}\n >\n {hasSubLists ? (\n // When sublists exist, just render them safely as HTML\n <div dangerouslySetInnerHTML={{ __html: children }} />\n ) : (\n // Otherwise, show our custom styled checkbox\n <div className=\"checkboxItem__wrapper\">\n <div\n className=\"checkboxItem__icon\"\n data-checked={node.checked}\n data-enable-match=\"true\"\n >\n {node.checked && <CheckIcon />}\n </div>\n <span className=\"checkboxItem__label\">{children}</span>\n </div>\n )}\n </li>\n )\n\n const html = ReactDOMServer.renderToStaticMarkup(JSX)\n\n // Add style=\"list-style-type: none;${providedCSSString}\" to html\n const styleIndex = html.indexOf('class=\"list-item-checkbox')\n const classIndex = html.indexOf('class=\"list-item-checkbox', styleIndex)\n const classEndIndex = html.indexOf('\"', classIndex + 6)\n const className = html.substring(classIndex, classEndIndex)\n const classNameWithStyle = `${className} style=\"list-style-type: none;${providedCSSString}\"`\n const htmlWithStyle = html.replace(className, classNameWithStyle)\n\n return htmlWithStyle\n } else {\n return `<li\n class=\"${hasSubLists ? 'nestedListItem' : ''}\"\n style=\"${hasSubLists ? `list-style-type: none;${providedCSSString}` : providedCSSString}\"\n value=\"${node.value}\"\n data-enable-match=\"true\"\n >${children}</li>`\n }\n },\n}\n"],"mappings":";AAAA,SAASA,SAAS,QAAQ;AAK1B,OAAO;AAEP,OAAO,MAAMC,8BAAA,GAA8E;EACzFC,QAAA,EAAU,MAAAA,CAAO;IAAEC,IAAI;IAAEC,WAAW;IAAEC,MAAM;IAAEC;EAAiB,CAAE;IAC/D,MAAMC,WAAA,GAAcJ,IAAA,CAAKK,QAAQ,CAACC,IAAI,CAAEC,KAAA,IAAUA,KAAA,CAAMC,IAAI,KAAK;IAEjE,MAAMH,QAAA,GAAW,CACf,MAAMJ,WAAA,CAAY;MAChBQ,KAAA,EAAOT,IAAA,CAAKK;IACd,EAAC,EACDK,IAAI,CAAC;IAEP,IAAI,cAAcR,MAAA,IAAUA,MAAA,EAAQS,QAAA,KAAa,SAAS;MACxD,MAAMC,cAAA,GAAiB,CAAC,MAAM,MAAM,CAAC,mBAAkB,EAAGC,OAAO;MAEjE,MAAMC,GAAA,gBACJC,IAAA,CAAC;QACC,gBAAcf,IAAA,CAAKgB,OAAO,GAAG,OAAO;QACpCC,SAAA,EAAW,gBAAgBjB,IAAA,CAAKgB,OAAO,GAAG,0BAA0B,4BAClEZ,WAAA,GAAc,0BAA0B,IACxC;QACF;QACAc,IAAA,EAAK;QACLC,QAAA,EAAU,CAAC;QACXC,KAAA,EAAOpB,IAAA,CAAKoB,KAAK;kBAEhBhB,WAAA;QACC;;QACAW,IAAA,CAAC;UAAIM,uBAAA,EAAyB;YAAEC,MAAA,EAAQjB;UAAS;;QAEjD;;QACAkB,KAAA,CAAC;UAAIN,SAAA,EAAU;kCACbF,IAAA,CAAC;YACCE,SAAA,EAAU;YACV,gBAAcjB,IAAA,CAAKgB,OAAO;YAC1B,qBAAkB;sBAEjBhB,IAAA,CAAKgB,OAAO,iBAAID,IAAA,CAAClB,SAAA;2BAEpBkB,IAAA,CAAC;YAAKE,SAAA,EAAU;sBAAuBZ;;;;MAM/C,MAAMmB,IAAA,GAAOZ,cAAA,CAAea,oBAAoB,CAACX,GAAA;MAEjD;MACA,MAAMY,UAAA,GAAaF,IAAA,CAAKG,OAAO,CAAC;MAChC,MAAMC,UAAA,GAAaJ,IAAA,CAAKG,OAAO,CAAC,6BAA6BD,UAAA;MAC7D,MAAMG,aAAA,GAAgBL,IAAA,CAAKG,OAAO,CAAC,KAAKC,UAAA,GAAa;MACrD,MAAMX,SAAA,GAAYO,IAAA,CAAKM,SAAS,CAACF,UAAA,EAAYC,aAAA;MAC7C,MAAME,kBAAA,GAAqB,GAAGd,SAAA,iCAA0Cd,iBAAA,GAAoB;MAC5F,MAAM6B,aAAA,GAAgBR,IAAA,CAAKS,OAAO,CAAChB,SAAA,EAAWc,kBAAA;MAE9C,OAAOC,aAAA;IACT,OAAO;MACL,OAAO;mBACM5B,WAAA,GAAc,mBAAmB;mBACjCA,WAAA,GAAc,yBAAyBD,iBAAA,EAAmB,GAAGA,iBAAA;mBAC7DH,IAAA,CAAKoB,KAAK;;WAElBf,QAAA,OAAe;IACtB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["CheckIcon","escapeHTML","ListItemDiffHTMLConverterAsync","listitem","node","nodesToHTML","parent","providedCSSString","hasSubLists","children","some","child","type","nodes","join","listType","ReactDOMServer","default","JSX","_jsx","checked","className","role","tabIndex","value","dangerouslySetInnerHTML","__html","_jsxs","html","renderToStaticMarkup","styleIndex","indexOf","classIndex","classEndIndex","substring","classNameWithStyle","htmlWithStyle","replace","String"],"sources":["../../../../../src/field/Diff/converters/listitem/index.tsx"],"sourcesContent":["import { CheckIcon } from '@payloadcms/ui/rsc'\nimport escapeHTML from 'escape-html'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedListItemNode } from '../../../../types/nodeTypes.js'\n\nimport './index.css'\n\nexport const ListItemDiffHTMLConverterAsync: HTMLConvertersAsync<SerializedListItemNode> = {\n listitem: async ({ node, nodesToHTML, parent, providedCSSString }) => {\n const hasSubLists = node.children.some((child) => child.type === 'list')\n\n const children = (\n await nodesToHTML({\n nodes: node.children,\n })\n ).join('')\n\n if ('listType' in parent && parent?.listType === 'check') {\n const ReactDOMServer = (await import('react-dom/server')).default\n\n const JSX = (\n <li\n aria-checked={node.checked ? true : false}\n className={`checkboxItem ${node.checked ? 'checkboxItem--checked' : 'checkboxItem--unchecked'}${\n hasSubLists ? ' checkboxItem--nested' : ''\n }`}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"checkbox\"\n tabIndex={-1}\n value={node.value}\n >\n {hasSubLists ? (\n // When sublists exist, just render them safely as HTML\n <div dangerouslySetInnerHTML={{ __html: children }} />\n ) : (\n // Otherwise, show our custom styled checkbox\n <div className=\"checkboxItem__wrapper\">\n <div\n className=\"checkboxItem__icon\"\n data-checked={node.checked}\n data-enable-match=\"true\"\n >\n {node.checked && <CheckIcon />}\n </div>\n <span className=\"checkboxItem__label\">{children}</span>\n </div>\n )}\n </li>\n )\n\n const html = ReactDOMServer.renderToStaticMarkup(JSX)\n\n // Add style=\"list-style-type: none;${providedCSSString}\" to html\n const styleIndex = html.indexOf('class=\"list-item-checkbox')\n const classIndex = html.indexOf('class=\"list-item-checkbox', styleIndex)\n const classEndIndex = html.indexOf('\"', classIndex + 6)\n const className = html.substring(classIndex, classEndIndex)\n const classNameWithStyle = `${className} style=\"list-style-type: none;${providedCSSString}\"`\n const htmlWithStyle = html.replace(className, classNameWithStyle)\n\n return htmlWithStyle\n } else {\n return `<li\n class=\"${hasSubLists ? 'nestedListItem' : ''}\"\n style=\"${hasSubLists ? `list-style-type: none;${providedCSSString}` : providedCSSString}\"\n value=\"${esc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;;;MAM/C,MAAMmB,IAAA,GAAOZ,cAAA,CAAea,oBAAoB,CAACX,GAAA;MAEjD;MACA,MAAMY,UAAA,GAAaF,IAAA,CAAKG,OAAO,CAAC;MAChC,MAAMC,UAAA,GAAaJ,IAAA,CAAKG,OAAO,CAAC,6BAA6BD,UAAA;MAC7D,MAAMG,aAAA,GAAgBL,IAAA,CAAKG,OAAO,CAAC,KAAKC,UAAA,GAAa;MACrD,MAAMX,SAAA,GAAYO,IAAA,CAAKM,SAAS,CAACF,UAAA,EAAYC,aAAA;MAC7C,MAAME,kBAAA,GAAqB,GAAGd,SAAA,iCAA0Cd,iBAAA,GAAoB;MAC5F,MAAM6B,aAAA,GAAgBR,IAAA,CAAKS,OAAO,CAAChB,SAAA,EAAWc,kBAAA;MAE9C,OAAOC,aAAA;IACT,OAAO;MACL,OAAO;mBACM5B,WAAA,GAAc,mBAAmB;mBACjCA,WAAA,GAAc,yBAAyBD,iBAAA,EAAmB,GAAGA,iBAAA;mBAC7DN,UAAA,CAAWqC,MAAA,CAAOlC,IAAA,CAAKoB,KAAK;;WAEpCf,QAAA,OAAe;IACtB;EACF;AACF","ignoreList":[]}
@@ -1,5 +1,6 @@
1
- import type { RichTextFieldDiffServerComponent } from 'payload';
1
+ import type { RichTextFieldDiffServerProps } from 'payload';
2
2
  import './index.css';
3
3
  import '../bundled.css';
4
- export declare const LexicalDiffComponent: RichTextFieldDiffServerComponent;
4
+ import React from 'react';
5
+ export declare const LexicalDiffComponent: React.FC<RichTextFieldDiffServerProps>;
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/field/Diff/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAA;AAI/D,OAAO,aAAa,CAAA;AACpB,OAAO,gBAAgB,CAAA;AAqBvB,eAAO,MAAM,oBAAoB,EAAE,gCAiGlC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/field/Diff/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAA;AAI3D,OAAO,aAAa,CAAA;AACpB,OAAO,gBAAgB,CAAA;AAGvB,OAAO,KAAK,MAAM,OAAO,CAAA;AAkBzB,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CAkGvE,CAAA"}
@@ -78,6 +78,7 @@ export const LexicalDiffComponent = async args => {
78
78
  const payloadPopulateFn = await getPayloadPopulateFn({
79
79
  currentDepth: 0,
80
80
  depth: 1,
81
+ overrideAccess: false,
81
82
  req
82
83
  });
83
84
  const fromHTML = await convertLexicalToHTMLAsync({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["FieldDiffContainer","getHTMLDiffComponents","formatAdminURL","React","convertLexicalToHTMLAsync","getPayloadPopulateFn","LinkDiffHTMLConverterAsync","ListItemDiffHTMLConverterAsync","RelationshipDiffHTMLConverterAsync","UnknownDiffHTMLConverterAsync","UploadDiffHTMLConverterAsync","baseClass","LexicalDiffComponent","args","comparisonValue","valueFrom","field","i18n","locale","nestingLevel","req","versionValue","valueTo","internalDocToHref","linkNode","populate","fields","doc","relationTo","value","docId","id","collectionSlug","adminRoute","payload","config","routes","admin","path","serverURL","converters","defaultConverters","payloadPopulateFn","currentDepth","depth","fromHTML","data","disableContainer","toHTML","From","To","length","_jsx","className","label"],"sources":["../../../src/field/Diff/index.tsx"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextFieldDiffServerComponent } from 'payload'\n\nimport { FieldDiffContainer, getHTMLDiffComponents } from '@payloadcms/ui/rsc'\n\nimport './index.css'\nimport '../bundled.css'\n\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type {\n HTMLConvertersFunctionAsync,\n HTMLPopulateFn,\n} from '../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedLinkNode } from '../../types/nodeTypes.js'\n\nimport { convertLexicalToHTMLAsync } from '../../features/converters/lexicalToHtml/async/index.js'\nimport { getPayloadPopulateFn } from '../../features/converters/utilities/payloadPopulateFn.js'\nimport { LinkDiffHTMLConverterAsync } from './converters/link.js'\nimport { ListItemDiffHTMLConverterAsync } from './converters/listitem/index.js'\nimport { RelationshipDiffHTMLConverterAsync } from './converters/relationship/index.js'\nimport { UnknownDiffHTMLConverterAsync } from './converters/unknown/index.js'\nimport { UploadDiffHTMLConverterAsync } from './converters/upload/index.js'\n\nconst baseClass = 'lexical-diff'\n\nexport const LexicalDiffComponent: RichTextFieldDiffServerComponent = async (args) => {\n const {\n comparisonValue: valueFrom,\n field,\n i18n,\n locale,\n nestingLevel,\n req,\n versionValue: valueTo,\n } = args\n\n const internalDocToHref = async ({\n linkNode,\n populate,\n }: {\n linkNode: SerializedLinkNode\n populate?: HTMLPopulateFn\n }) => {\n if (!linkNode.fields.doc) {\n return '#'\n }\n\n const { relationTo, value } = linkNode.fields.doc\n\n let docId: number | string\n\n if (typeof value === 'object' && value !== null) {\n docId = value.id\n } else if (populate && typeof value !== 'object') {\n const doc = await populate({\n id: value,\n collectionSlug: relationTo,\n })\n\n if (!doc || !doc.id) {\n return '#'\n }\n\n docId = doc.id\n } else {\n docId = value\n }\n\n return formatAdminURL({\n adminRoute: req.payload.config.routes.admin,\n path: `/collections/${relationTo}/${docId}`,\n serverURL: req.payload.config.serverURL,\n })\n }\n\n const converters: HTMLConvertersFunctionAsync = ({ defaultConverters }) => ({\n ...defaultConverters,\n ...LinkDiffHTMLConverterAsync({ internalDocToHref }),\n ...ListItemDiffHTMLConverterAsync,\n ...UploadDiffHTMLConverterAsync({ i18n, req }),\n ...RelationshipDiffHTMLConverterAsync({ i18n, req }),\n ...UnknownDiffHTMLConverterAsync({ i18n, req }),\n })\n\n const payloadPopulateFn = await getPayloadPopulateFn({\n currentDepth: 0,\n depth: 1,\n req,\n })\n const fromHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueFrom as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const toHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueTo as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const { From, To } = getHTMLDiffComponents({\n // Ensure empty paragraph is displayed for empty rich text fields - otherwise, toHTML may be displayed in the wrong column\n fromHTML: fromHTML?.length ? fromHTML : '<p></p>',\n toHTML: toHTML?.length ? toHTML : '<p></p>',\n })\n\n return (\n <FieldDiffContainer\n className={baseClass}\n From={From}\n i18n={i18n}\n label={{\n label: field.label,\n locale,\n }}\n nestingLevel={nestingLevel}\n To={To}\n />\n )\n}\n"],"mappings":";AAGA,SAASA,kBAAkB,EAAEC,qBAAqB,QAAQ;AAE1D,OAAO;AACP,OAAO;AAEP,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAQlB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,kCAAkC,QAAQ;AACnD,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,4BAA4B,QAAQ;AAE7C,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,oBAAA,GAAyD,MAAOC,IAAA;EAC3E,MAAM;IACJC,eAAA,EAAiBC,SAAS;IAC1BC,KAAK;IACLC,IAAI;IACJC,MAAM;IACNC,YAAY;IACZC,GAAG;IACHC,YAAA,EAAcC;EAAO,CACtB,GAAGT,IAAA;EAEJ,MAAMU,iBAAA,GAAoB,MAAAA,CAAO;IAC/BC,QAAQ;IACRC;EAAQ,CAIT;IACC,IAAI,CAACD,QAAA,CAASE,MAAM,CAACC,GAAG,EAAE;MACxB,OAAO;IACT;IAEA,MAAM;MAAEC,UAAU;MAAEC;IAAK,CAAE,GAAGL,QAAA,CAASE,MAAM,CAACC,GAAG;IAEjD,IAAIG,KAAA;IAE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,MAAA,GAAS,MAAM5C,yBAAA,CAA0B;IAC7CoC,UAAA;IACAM,IAAA,EAAMxB,OAAA;IACNyB,gBAAA,EAAkB;IAClBtB,QAAA,EAAUiB;EACZ;EAEA,MAAM;IAAEO,IAAI;IAAEC;EAAE,CAAE,GAAGjD,qBAAA,CAAsB;IACzC;IACA4C,QAAA,EAAUA,QAAA,EAAUM,MAAA,GAASN,QAAA,GAAW;IACxCG,MAAA,EAAQA,MAAA,EAAQG,MAAA,GAASH,MAAA,GAAS;EACpC;EAEA,oBACEI,IAAA,CAACpD,kBAAA;IACCqD,SAAA,EAAW1C,SAAA;IACXsC,IAAA,EAAMA,IAAA;IACNhC,IAAA,EAAMA,IAAA;IACNqC,KAAA,EAAO;MACLA,KAAA,EAAOtC,KAAA,CAAMsC,KAAK;MAClBpC;IACF;IACAC,YAAA,EAAcA,YAAA;IACd+B,EAAA,EAAIA;;AAGV","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["FieldDiffContainer","getHTMLDiffComponents","formatAdminURL","React","convertLexicalToHTMLAsync","getPayloadPopulateFn","LinkDiffHTMLConverterAsync","ListItemDiffHTMLConverterAsync","RelationshipDiffHTMLConverterAsync","UnknownDiffHTMLConverterAsync","UploadDiffHTMLConverterAsync","baseClass","LexicalDiffComponent","args","comparisonValue","valueFrom","field","i18n","locale","nestingLevel","req","versionValue","valueTo","internalDocToHref","linkNode","populate","fields","doc","relationTo","value","docId","id","collectionSlug","adminRoute","payload","config","routes","admin","path","serverURL","converters","defaultConverters","payloadPopulateFn","currentDepth","depth","overrideAccess","fromHTML","data","disableContainer","toHTML","From","To","length","_jsx","className","label"],"sources":["../../../src/field/Diff/index.tsx"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextFieldDiffServerProps } from 'payload'\n\nimport { FieldDiffContainer, getHTMLDiffComponents } from '@payloadcms/ui/rsc'\n\nimport './index.css'\nimport '../bundled.css'\n\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type {\n HTMLConvertersFunctionAsync,\n HTMLPopulateFn,\n} from '../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedLinkNode } from '../../types/nodeTypes.js'\n\nimport { convertLexicalToHTMLAsync } from '../../features/converters/lexicalToHtml/async/index.js'\nimport { getPayloadPopulateFn } from '../../features/converters/utilities/payloadPopulateFn.js'\nimport { LinkDiffHTMLConverterAsync } from './converters/link.js'\nimport { ListItemDiffHTMLConverterAsync } from './converters/listitem/index.js'\nimport { RelationshipDiffHTMLConverterAsync } from './converters/relationship/index.js'\nimport { UnknownDiffHTMLConverterAsync } from './converters/unknown/index.js'\nimport { UploadDiffHTMLConverterAsync } from './converters/upload/index.js'\n\nconst baseClass = 'lexical-diff'\n\nexport const LexicalDiffComponent: React.FC<RichTextFieldDiffServerProps> = async (args) => {\n const {\n comparisonValue: valueFrom,\n field,\n i18n,\n locale,\n nestingLevel,\n req,\n versionValue: valueTo,\n } = args\n\n const internalDocToHref = async ({\n linkNode,\n populate,\n }: {\n linkNode: SerializedLinkNode\n populate?: HTMLPopulateFn\n }) => {\n if (!linkNode.fields.doc) {\n return '#'\n }\n\n const { relationTo, value } = linkNode.fields.doc\n\n let docId: number | string\n\n if (typeof value === 'object' && value !== null) {\n docId = value.id\n } else if (populate && typeof value !== 'object') {\n const doc = await populate({\n id: value,\n collectionSlug: relationTo,\n })\n\n if (!doc || !doc.id) {\n return '#'\n }\n\n docId = doc.id\n } else {\n docId = value\n }\n\n return formatAdminURL({\n adminRoute: req.payload.config.routes.admin,\n path: `/collections/${relationTo}/${docId}`,\n serverURL: req.payload.config.serverURL,\n })\n }\n\n const converters: HTMLConvertersFunctionAsync = ({ defaultConverters }) => ({\n ...defaultConverters,\n ...LinkDiffHTMLConverterAsync({ internalDocToHref }),\n ...ListItemDiffHTMLConverterAsync,\n ...UploadDiffHTMLConverterAsync({ i18n, req }),\n ...RelationshipDiffHTMLConverterAsync({ i18n, req }),\n ...UnknownDiffHTMLConverterAsync({ i18n, req }),\n })\n\n const payloadPopulateFn = await getPayloadPopulateFn({\n currentDepth: 0,\n depth: 1,\n overrideAccess: false,\n req,\n })\n const fromHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueFrom as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const toHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueTo as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const { From, To } = getHTMLDiffComponents({\n // Ensure empty paragraph is displayed for empty rich text fields - otherwise, toHTML may be displayed in the wrong column\n fromHTML: fromHTML?.length ? fromHTML : '<p></p>',\n toHTML: toHTML?.length ? toHTML : '<p></p>',\n })\n\n return (\n <FieldDiffContainer\n className={baseClass}\n From={From}\n i18n={i18n}\n label={{\n label: field.label,\n locale,\n }}\n nestingLevel={nestingLevel}\n To={To}\n />\n )\n}\n"],"mappings":";AAGA,SAASA,kBAAkB,EAAEC,qBAAqB,QAAQ;AAE1D,OAAO;AACP,OAAO;AAEP,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAQlB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,kCAAkC,QAAQ;AACnD,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,4BAA4B,QAAQ;AAE7C,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,oBAAA,GAA+D,MAAOC,IAAA;EACjF,MAAM;IACJC,eAAA,EAAiBC,SAAS;IAC1BC,KAAK;IACLC,IAAI;IACJC,MAAM;IACNC,YAAY;IACZC,GAAG;IACHC,YAAA,EAAcC;EAAO,CACtB,GAAGT,IAAA;EAEJ,MAAMU,iBAAA,GAAoB,MAAAA,CAAO;IAC/BC,QAAQ;IACRC;EAAQ,CAIT;IACC,IAAI,CAACD,QAAA,CAASE,MAAM,CAACC,GAAG,EAAE;MACxB,OAA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GAAW,MAAM1C,yBAAA,CAA0B;IAC/CoC,UAAA;IACAO,IAAA,EAAMhC,SAAA;IACNiC,gBAAA,EAAkB;IAClBvB,QAAA,EAAUiB;EACZ;EAEA,MAAMO,MAAA,GAAS,MAAM7C,yBAAA,CAA0B;IAC7CoC,UAAA;IACAO,IAAA,EAAMzB,OAAA;IACN0B,gBAAA,EAAkB;IAClBvB,QAAA,EAAUiB;EACZ;EAEA,MAAM;IAAEQ,IAAI;IAAEC;EAAE,CAAE,GAAGlD,qBAAA,CAAsB;IACzC;IACA6C,QAAA,EAAUA,QAAA,EAAUM,MAAA,GAASN,QAAA,GAAW;IACxCG,MAAA,EAAQA,MAAA,EAAQG,MAAA,GAASH,MAAA,GAAS;EACpC;EAEA,oBACEI,IAAA,CAACrD,kBAAA;IACCsD,SAAA,EAAW3C,SAAA;IACXuC,IAAA,EAAMA,IAAA;IACNjC,IAAA,EAAMA,IAAA;IACNsC,KAAA,EAAO;MACLA,KAAA,EAAOvC,KAAA,CAAMuC,KAAK;MAClBrC;IACF;IACAC,YAAA,EAAcA,YAAA;IACdgC,EAAA,EAAIA;;AAGV","ignoreList":[]}
@@ -14,11 +14,13 @@ export declare const RenderLexical: React.FC<
14
14
  * If neither is passed, it will rely on the parent form to manage the value.
15
15
  */
16
16
  {
17
+ /** @deprecated Use `name` and `label` instead. */
18
+ field?: Partial<LexicalRichTextField>;
17
19
  /**
18
20
  * Override the loading state while the field component is being fetched and rendered.
19
21
  */
20
22
  Loading?: React.ReactElement;
21
23
  setValue?: FieldType<DefaultTypedEditorState | undefined>['setValue'];
22
24
  value?: FieldType<DefaultTypedEditorState | undefined>['value'];
23
- } & RenderFieldServerFnArgs<LexicalRichTextField>>;
25
+ } & Omit<RenderFieldServerFnArgs, 'hidden'>>;
24
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/field/RenderLexical/index.tsx"],"names":[],"mappings":"AAGA,OAA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,EAAE,SAAS,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAA;CAChE,GAAG,IAAI,CAAC,uBAAuB,EAAE,QAAQ,CAAC,CA0F5C,CAAA"}
@@ -11,10 +11,12 @@ import React, { useCallback, useEffect, useRef } from 'react';
11
11
  * @todo - replace this with a general utility that works for all fields. Maybe merge with packages/ui/src/forms/RenderFields/RenderField.tsx
12
12
  */
13
13
  export const RenderLexical = args => {
14
- const $ = _c(9);
14
+ const $ = _c(10);
15
15
  const {
16
+ name,
16
17
  field,
17
18
  initialValue,
19
+ label,
18
20
  Loading,
19
21
  path,
20
22
  schemaPath,
@@ -27,23 +29,20 @@ export const RenderLexical = args => {
27
29
  _internal_renderField
28
30
  } = serverFunctionContext;
29
31
  const [entityType, entitySlug] = schemaPath.split(".", 2);
30
- const fieldPath = path ?? (field && "name" in field ? field?.name : "") ?? "";
32
+ const fieldName = name !== undefined ? name : field?.name;
33
+ const fieldLabel = label !== undefined ? label : field?.label;
34
+ const fieldPath = path ?? fieldName ?? "";
31
35
  let t0;
32
- if ($[0] !== _internal_renderField || $[1] !== field || $[2] !== initialValue || $[3] !== path || $[4] !== schemaPath) {
36
+ if ($[0] !== _internal_renderField || $[1] !== fieldLabel || $[2] !== fieldName || $[3] !== initialValue || $[4] !== path || $[5] !== schemaPath) {
33
37
  t0 = () => {
34
38
  const render = async function render() {
35
39
  const {
36
40
  Field
37
41
  } = await _internal_renderField({
38
- field: {
39
- ...(field || {}),
40
- type: "richText",
41
- admin: {
42
- ...(field?.admin || {}),
43
- hidden: false
44
- }
45
- },
42
+ name: fieldName,
43
+ hidden: false,
46
44
  initialValue: initialValue ?? undefined,
45
+ label: typeof fieldLabel === "function" ? undefined : fieldLabel,
47
46
  path,
48
47
  schemaPath
49
48
  });
@@ -52,19 +51,20 @@ export const RenderLexical = args => {
52
51
  render();
53
52
  };
54
53
  $[0] = _internal_renderField;
55
- $[1] = field;
56
- $[2] = initialValue;
57
- $[3] = path;
58
- $[4] = schemaPath;
59
- $[5] = t0;
54
+ $[1] = fieldLabel;
55
+ $[2] = fieldName;
56
+ $[3] = initialValue;
57
+ $[4] = path;
58
+ $[5] = schemaPath;
59
+ $[6] = t0;
60
60
  } else {
61
- t0 = $[5];
61
+ t0 = $[6];
62
62
  }
63
63
  const renderLexical = t0;
64
64
  const mounted = useRef(false);
65
65
  let t1;
66
66
  let t2;
67
- if ($[6] !== renderLexical) {
67
+ if ($[7] !== renderLexical) {
68
68
  t1 = () => {
69
69
  if (mounted.current) {
70
70
  return;
@@ -73,12 +73,12 @@ export const RenderLexical = args => {
73
73
  renderLexical();
74
74
  };
75
75
  t2 = [renderLexical];
76
- $[6] = renderLexical;
77
- $[7] = t1;
78
- $[8] = t2;
76
+ $[7] = renderLexical;
77
+ $[8] = t1;
78
+ $[9] = t2;
79
79
  } else {
80
- t1 = $[7];
81
- t2 = $[8];
80
+ t1 = $[8];
81
+ t2 = $[9];
82
82
  }
83
83
  useEffect(t1, t2);
84
84
  if (!Component) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","FieldContext","FieldPathContext","ServerFunctionsContext","ShimmerEffect","useServerFunctions","React","useCallback","useEffect","useRef","RenderLexical","args","$","field","initialValue","Loading","path","schemaPath","setValue","value","Component","setComponent","useState","serverFunctionContext","_internal_renderField","entityType","entitySlug","split","fieldPath","name","t0","render","Field","type","admin","hidden","undefined","renderLexical","mounted","t1","t2","current","_jsx","adjustedServerFunctionContext","getFormState","getFormStateArgs","collectionSlug","globalSlug","children","fieldValue","disabled","formInitializing","formProcessing","formSubmitted","_temp","showError"],"sources":["../../../src/field/RenderLexical/index.tsx"],"sourcesContent":["'use client'\nimport type { RichTextField } from 'payload'\n\nimport {\n FieldContext,\n FieldPathContext,\n type FieldType,\n type RenderFieldServerFnArgs,\n ServerFunctionsContext,\n type ServerFunctionsContextType,\n ShimmerEffect,\n useServerFunctions,\n} from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useRef } from 'react'\n\nimport type { LexicalRichTextField } from '../../types/index.js'\nimport type { DefaultTypedEditorState } from '../../types/nodeTypes.js'\n\n/**\n * Utility to render a lexical editor on the client.\n *\n * @experimental - may break in minor releases\n * @todo - replace this with a general utility that works for all fields. Maybe merge with packages/ui/src/forms/RenderFields/RenderField.tsx\n */\nexport const RenderLexical: React.FC<\n /**\n * If value or setValue, or both, is provided, this component will manage its own value.\n * If neither is passed, it will rely on the parent form to manage the value.\n */\n {\n /**\n * Override the loading state while the field component is being fetched and rendered.\n */\n Loading?: React.ReactElement\n\n setValue?: FieldType<DefaultTypedEditorState | undefined>['setValue']\n value?: FieldType<DefaultTypedEditorState | undefined>['value']\n } & RenderFieldServerFnArgs<LexicalRichTextField>\n> = (args) => {\n const { field, initialValue, Loading, path, schemaPath, setValue, value } = args\n const [Component, setComponent] = React.useState<null | React.ReactNode>(null)\n const serverFunctionContext = useServerFunctions()\n const { _internal_renderField } = serverFunctionContext\n\n const [entityType, entitySlug] = schemaPath.split('.', 2)\n\n const fieldPath = path ?? (field && 'name' in field ? field?.name : '') ?? ''\n\n const renderLexical = useCallback(() => {\n async function render() {\n const { Field } = await _internal_renderField({\n field: {\n ...((field as RichTextField) || {}),\n type: 'richText',\n admin: {\n ...((field as RichTextField)?.admin || {}),\n // When using \"fake\" anchor fields, hidden is often set to true. We need to override that here to ensure the field is rendered.\n hidden: false,\n },\n },\n initialValue: initialValue ?? undefined,\n path,\n schemaPath,\n })\n\n setComponent(Field)\n }\n void render()\n }, [_internal_renderField, schemaPath, path, field, initialValue])\n\n const mounted = useRef(false)\n\n useEffect(() => {\n if (mounted.current) {\n return\n }\n mounted.current = true\n void renderLexical()\n }, [renderLexical])\n\n if (!Component) {\n return typeof Loading !== 'undefined' ? Loading : <ShimmerEffect />\n }\n\n /**\n * By default, the lexical will make form state requests (e.g. to get drawer fields), passing in the arguments\n * of the current field. However, we need to override those arguments to get it to make requests based on the\n * *target* field. The server only knows the schema map of the target field.\n */\n const adjustedServerFunctionContext: ServerFunctionsContextType = {\n ...serverFunctionContext,\n getFormState: async (getFormStateArgs) => {\n return serverFunctionContext.getFormState({\n ...getFormStateArgs,\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n })\n },\n }\n\n if (typeof value === 'undefined' && !setValue) {\n return (\n <ServerFunctionsContext value={{ ...adjustedServerFunctionContext }}>\n <FieldPathContext key={fieldPath} value={fieldPath}>\n {Component}\n </FieldPathContext>\n </ServerFunctionsContext>\n )\n }\n\n const fieldValue: FieldType<DefaultTypedEditorState | undefined> = {\n disabled: false,\n formInitializing: false,\n formProcessing: false,\n formSubmitted: false,\n initialValue: value,\n path: fieldPath,\n setValue: setValue ?? (() => undefined),\n showError: false,\n value,\n }\n\n return (\n <ServerFunctionsContext value={{ ...adjustedServerFunctionContext }}>\n <FieldPathContext key={fieldPath} value={fieldPath}>\n <FieldContext value={fieldValue}>{Component}</FieldContext>\n </FieldPathContext>\n </ServerFunctionsContext>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SACEC,YAAY,EACZC,gBAAgB,EAGhBC,sBAAsB,EAEtBC,aAAa,EACbC,kBAAkB,QACb;AACP,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ;AAKtD;;;;;;AAMA,OAAO,MAAMC,aAAA,GAcTC,IAAA;EAAA,MAAAC,CAAA,GAAAZ,EAAA;EACF;IAAAa,KAAA;IAAAC,YAAA;IAAAC,OAAA;IAAAC,IAAA;IAAAC,UAAA;IAAAC,QAAA;IAAAC;EAAA,IAA4ER,IAAA;EAC5E,OAAAS,SAAA,EAAAC,YAAA,IAAkCf,KAAA,CAAAgB,QAAA,KAAuC;EACzE,MAAAC,qBAAA,GAA8BlB,kBAAA;EAC9B;IAAAmB;EAAA,IAAkCD,qBAAA;EAElC,OAAAE,UAAA,EAAAC,UAAA,IAAiCT,UAAA,CAAAU,KAAA,CA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1
+ {"version":3,"file":"index.js","names":["c","_c","FieldContext","FieldPathContext","ServerFunctionsContext","ShimmerEffect","useServerFunctions","React","useCallback","useEffect","useRef","RenderLexical","args","$","name","field","initialValue","label","Loading","path","schemaPath","setValue","value","Component","setComponent","useState","serverFunctionContext","_internal_renderField","entityType","entitySlug","split","fieldName","undefined","fieldLabel","fieldPath","t0","render","Field","hidden","renderLexical","mounted","t1","t2","current","_jsx","adjustedServerFunctionContext","getFormState","getFormStateArgs","collectionSlug","globalSlug","children","fieldValue","disabled","formInitializing","formProcessing","formSubmitted","_temp","showError"],"sources":["../../../src/field/RenderLexical/index.tsx"],"sourcesContent":["'use client'\nimport {\n FieldContext,\n FieldPathContext,\n type FieldType,\n type RenderFieldServerFnArgs,\n ServerFunctionsContext,\n type ServerFunctionsContextType,\n ShimmerEffect,\n useServerFunctions,\n} from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useRef } from 'react'\n\nimport type { LexicalRichTextField } from '../../types/index.js'\nimport type { DefaultTypedEditorState } from '../../types/nodeTypes.js'\n\n/**\n * Utility to render a lexical editor on the client.\n *\n * @experimental - may break in minor releases\n * @todo - replace this with a general utility that works for all fields. Maybe merge with packages/ui/src/forms/RenderFields/RenderField.tsx\n */\nexport const RenderLexical: React.FC<\n /**\n * If value or setValue, or both, is provided, this component will manage its own value.\n * If neither is passed, it will rely on the parent form to manage the value.\n */\n {\n /** @deprecated Use `name` and `label` instead. */\n field?: Partial<LexicalRichTextField>\n /**\n * Override the loading state while the field component is being fetched and rendered.\n */\n Loading?: React.ReactElement\n\n setValue?: FieldType<DefaultTypedEditorState | undefined>['setValue']\n value?: FieldType<DefaultTypedEditorState | undefined>['value']\n } & Omit<RenderFieldServerFnArgs, 'hidden'>\n> = (args) => {\n const { name, field, initialValue, label, Loading, path, schemaPath, setValue, value } = args\n const [Component, setComponent] = React.useState<null | React.ReactNode>(null)\n const serverFunctionContext = useServerFunctions()\n const { _internal_renderField } = serverFunctionContext\n\n const [entityType, entitySlug] = schemaPath.split('.', 2)\n\n const fieldName = name !== undefined ? name : field?.name\n const fieldLabel = label !== undefined ? label : field?.label\n const fieldPath = path ?? fieldName ?? ''\n\n const renderLexical = useCallback(() => {\n async function render() {\n const { Field } = await _internal_renderField({\n name: fieldName,\n // When using \"fake\" anchor fields, hidden is often set to true.\n // We need to override that here to ensure the field is rendered.\n hidden: false,\n initialValue: initialValue ?? undefined,\n label: typeof fieldLabel === 'function' ? undefined : fieldLabel,\n path,\n schemaPath,\n })\n\n setComponent(Field)\n }\n void render()\n }, [_internal_renderField, schemaPath, path, fieldName, fieldLabel, initialValue])\n\n const mounted = useRef(false)\n\n useEffect(() => {\n if (mounted.current) {\n return\n }\n mounted.current = true\n void renderLexical()\n }, [renderLexical])\n\n if (!Component) {\n return typeof Loading !== 'undefined' ? Loading : <ShimmerEffect />\n }\n\n /**\n * By default, the lexical will make form state requests (e.g. to get drawer fields), passing in the arguments\n * of the current field. However, we need to override those arguments to get it to make requests based on the\n * *target* field. The server only knows the schema map of the target field.\n */\n const adjustedServerFunctionContext: ServerFunctionsContextType = {\n ...serverFunctionContext,\n getFormState: async (getFormStateArgs) => {\n return serverFunctionContext.getFormState({\n ...getFormStateArgs,\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n })\n },\n }\n\n if (typeof value === 'undefined' && !setValue) {\n return (\n <ServerFunctionsContext value={{ ...adjustedServerFunctionContext }}>\n <FieldPathContext key={fieldPath} value={fieldPath}>\n {Component}\n </FieldPathContext>\n </ServerFunctionsContext>\n )\n }\n\n const fieldValue: FieldType<DefaultTypedEditorState | undefined> = {\n disabled: false,\n formInitializing: false,\n formProcessing: false,\n formSubmitted: false,\n initialValue: value,\n path: fieldPath,\n setValue: setValue ?? (() => undefined),\n showError: false,\n value,\n }\n\n return (\n <ServerFunctionsContext value={{ ...adjustedServerFunctionContext }}>\n <FieldPathContext key={fieldPath} value={fieldPath}>\n <FieldContext value={fieldValue}>{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