@payloadcms/richtext-lexical 4.0.0-internal.435b2d6 → 4.0.0-internal.44ac9c8

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 (405) hide show
  1. package/dist/exports/client/Field-BPLEYPXV.js +2 -0
  2. package/dist/exports/client/Field-BPLEYPXV.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-43E5QYAA.js +2 -0
  5. package/dist/exports/client/chunk-43E5QYAA.js.map +7 -0
  6. package/dist/exports/client/chunk-LN6VX25I.js +2 -0
  7. package/dist/exports/client/chunk-LN6VX25I.js.map +7 -0
  8. package/dist/exports/client/component-D5QLYS7W.js +2 -0
  9. package/dist/exports/client/component-D5QLYS7W.js.map +7 -0
  10. package/dist/exports/client/index.d.ts +1 -1
  11. package/dist/exports/client/index.d.ts.map +1 -1
  12. package/dist/exports/client/index.js +27 -27
  13. package/dist/exports/client/index.js.map +4 -4
  14. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  15. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  16. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  17. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  18. package/dist/features/blocks/client/component/index.d.ts +0 -6
  19. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  20. package/dist/features/blocks/client/component/index.js +126 -69
  21. package/dist/features/blocks/client/component/index.js.map +1 -1
  22. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  23. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  24. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  25. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  26. package/dist/features/blocks/server/index.js +2 -2
  27. package/dist/features/blocks/server/index.js.map +1 -1
  28. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  29. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  30. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  31. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  32. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  33. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  34. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  35. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  36. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  37. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  38. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  39. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  40. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  41. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  42. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  43. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  44. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  45. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  46. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  47. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  48. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  49. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  50. package/dist/features/debug/testRecorder/client/plugin/index.css +0 -1
  51. package/dist/features/heading/constants.d.ts +2 -0
  52. package/dist/features/heading/constants.d.ts.map +1 -0
  53. package/dist/features/heading/constants.js +2 -0
  54. package/dist/features/heading/constants.js.map +1 -0
  55. package/dist/features/heading/server/index.d.ts.map +1 -1
  56. package/dist/features/heading/server/index.js +5 -1
  57. package/dist/features/heading/server/index.js.map +1 -1
  58. package/dist/features/heading/server/validate.d.ts +6 -0
  59. package/dist/features/heading/server/validate.d.ts.map +1 -0
  60. package/dist/features/heading/server/validate.js +15 -0
  61. package/dist/features/heading/server/validate.js.map +1 -0
  62. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  63. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  64. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +1 -1
  65. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  66. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -1
  67. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  68. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  69. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  70. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +1 -0
  71. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  72. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
  73. package/dist/features/link/nodes/AutoLinkNode.d.ts +1 -1
  74. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  75. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  76. package/dist/features/link/nodes/LinkNode.d.ts +1 -1
  77. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  78. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  79. package/dist/features/link/server/index.js +2 -2
  80. package/dist/features/link/server/index.js.map +1 -1
  81. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  82. package/dist/features/lists/checklist/server/index.js +5 -2
  83. package/dist/features/lists/checklist/server/index.js.map +1 -1
  84. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  85. package/dist/features/lists/orderedList/server/index.js +5 -2
  86. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  87. package/dist/features/lists/shared/constants.d.ts +2 -0
  88. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  89. package/dist/features/lists/shared/constants.js +2 -0
  90. package/dist/features/lists/shared/constants.js.map +1 -0
  91. package/dist/features/lists/shared/validate.d.ts +5 -0
  92. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  93. package/dist/features/lists/shared/validate.js +15 -0
  94. package/dist/features/lists/shared/validate.js.map +1 -0
  95. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  96. package/dist/features/lists/unorderedList/server/index.js +5 -2
  97. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  98. package/dist/features/relationship/client/index.d.ts +2 -2
  99. package/dist/features/relationship/client/index.d.ts.map +1 -1
  100. package/dist/features/relationship/client/index.js.map +1 -1
  101. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  102. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  103. package/dist/features/relationship/client/plugins/index.js +27 -31
  104. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  105. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  106. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  107. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  108. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  109. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  110. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  111. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  112. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  113. package/dist/features/relationship/server/index.d.ts +8 -1
  114. package/dist/features/relationship/server/index.d.ts.map +1 -1
  115. package/dist/features/relationship/server/index.js +28 -11
  116. package/dist/features/relationship/server/index.js.map +1 -1
  117. package/dist/features/relationship/server/schema.d.ts +2 -2
  118. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  119. package/dist/features/relationship/server/schema.js +5 -10
  120. package/dist/features/relationship/server/schema.js.map +1 -1
  121. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  122. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  123. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  124. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  125. package/dist/features/table/client/index.d.ts.map +1 -0
  126. package/dist/features/table/client/index.js.map +1 -0
  127. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  128. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  129. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  130. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  131. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  132. package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +17 -44
  133. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  134. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  135. package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +41 -18
  136. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  137. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  138. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  139. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  140. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  141. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  142. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  143. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  144. package/dist/features/table/client/utils/debounce.js.map +1 -0
  145. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  146. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  147. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  148. package/dist/features/table/markdownTransformer.js.map +1 -0
  149. package/dist/features/table/server/index.d.ts +3 -0
  150. package/dist/features/table/server/index.d.ts.map +1 -0
  151. package/dist/features/{experimental_table → table}/server/index.js +4 -4
  152. package/dist/features/table/server/index.js.map +1 -0
  153. package/dist/features/table/server/schema.d.ts.map +1 -0
  154. package/dist/features/table/server/schema.js.map +1 -0
  155. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  156. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  157. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  158. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  159. package/dist/features/toolbars/fixed/client/Toolbar/index.css +78 -6
  160. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  161. package/dist/features/toolbars/fixed/client/Toolbar/index.js +4 -1
  162. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  163. package/dist/features/toolbars/inline/client/Toolbar/index.css +0 -1
  164. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  165. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  166. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  167. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  168. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  169. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  170. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -13
  171. package/dist/features/typesServer.d.ts +1 -1
  172. package/dist/features/typesServer.d.ts.map +1 -1
  173. package/dist/features/typesServer.js.map +1 -1
  174. package/dist/features/upload/client/component/index.js +2 -1
  175. package/dist/features/upload/client/component/index.js.map +1 -1
  176. package/dist/features/upload/client/index.d.ts +3 -2
  177. package/dist/features/upload/client/index.d.ts.map +1 -1
  178. package/dist/features/upload/client/index.js.map +1 -1
  179. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  180. package/dist/features/upload/client/plugin/index.js +47 -52
  181. package/dist/features/upload/client/plugin/index.js.map +1 -1
  182. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  183. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  184. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  185. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  186. package/dist/features/upload/server/index.d.ts +6 -2
  187. package/dist/features/upload/server/index.d.ts.map +1 -1
  188. package/dist/features/upload/server/index.js +20 -16
  189. package/dist/features/upload/server/index.js.map +1 -1
  190. package/dist/features/upload/server/schema.d.ts +2 -2
  191. package/dist/features/upload/server/schema.d.ts.map +1 -1
  192. package/dist/features/upload/server/schema.js +4 -8
  193. package/dist/features/upload/server/schema.js.map +1 -1
  194. package/dist/features/upload/server/validate.d.ts +2 -2
  195. package/dist/features/upload/server/validate.d.ts.map +1 -1
  196. package/dist/features/upload/server/validate.js +3 -0
  197. package/dist/features/upload/server/validate.js.map +1 -1
  198. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  199. package/dist/field/Diff/converters/listitem/index.js +2 -1
  200. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  201. package/dist/field/Diff/index.d.ts +3 -2
  202. package/dist/field/Diff/index.d.ts.map +1 -1
  203. package/dist/field/Diff/index.js +1 -0
  204. package/dist/field/Diff/index.js.map +1 -1
  205. package/dist/field/RenderLexical/index.d.ts +3 -1
  206. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  207. package/dist/field/RenderLexical/index.js +23 -23
  208. package/dist/field/RenderLexical/index.js.map +1 -1
  209. package/dist/field/ViewSelector.d.ts.map +1 -1
  210. package/dist/field/ViewSelector.js +1 -0
  211. package/dist/field/ViewSelector.js.map +1 -1
  212. package/dist/field/bundled.css +1 -1
  213. package/dist/field/index.css +10 -10
  214. package/dist/i18n.d.ts.map +1 -1
  215. package/dist/i18n.js +68 -0
  216. package/dist/i18n.js.map +1 -1
  217. package/dist/index.d.ts +2 -2
  218. package/dist/index.d.ts.map +1 -1
  219. package/dist/index.js +5 -5
  220. package/dist/index.js.map +1 -1
  221. package/dist/lexical/LexicalEditor.css +18 -20
  222. package/dist/lexical/LexicalEditor.js.map +1 -1
  223. package/dist/lexical/config/server/loader.d.ts +1 -1
  224. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  225. package/dist/lexical/config/server/loader.js +2 -2
  226. package/dist/lexical/config/server/loader.js.map +1 -1
  227. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  228. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  229. package/dist/lexical/config/server/sanitize.js +2 -2
  230. package/dist/lexical/config/server/sanitize.js.map +1 -1
  231. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +16 -24
  232. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  233. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  234. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  235. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +0 -1
  236. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  237. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +1 -20
  238. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  239. package/dist/lexical/plugins/SlashMenu/index.css +0 -1
  240. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  241. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -2
  242. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  243. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  244. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  245. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  246. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  247. package/dist/lexical/ui/ContentEditable.css +16 -15
  248. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  249. package/dist/lexical/ui/icons/H3/index.js +13 -6
  250. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  251. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  252. package/dist/lexical/ui/icons/H4/index.js +13 -6
  253. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  254. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  255. package/dist/lexical/ui/icons/H5/index.js +13 -6
  256. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  257. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  258. package/dist/lexical/ui/icons/H6/index.js +13 -6
  259. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  260. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
  261. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
  262. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
  263. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
  264. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
  265. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
  266. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
  267. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
  268. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
  269. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
  270. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
  271. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
  272. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
  273. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
  274. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
  275. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
  276. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
  277. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
  278. package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
  279. package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
  280. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
  281. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
  282. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
  283. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
  284. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
  285. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
  286. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
  287. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
  288. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
  289. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
  290. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
  291. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
  292. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
  293. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
  294. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
  295. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
  296. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
  297. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
  298. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
  299. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
  300. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
  301. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
  302. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
  303. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
  304. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
  305. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
  306. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
  307. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
  308. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
  309. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
  310. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
  311. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
  312. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
  313. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
  314. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
  315. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
  316. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
  317. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
  318. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
  319. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
  320. package/dist/types/index.d.ts +1 -1
  321. package/dist/types/index.d.ts.map +1 -1
  322. package/dist/types/index.js.map +1 -1
  323. package/dist/types/nodeTypes.d.ts +1 -1
  324. package/dist/types/nodeTypes.d.ts.map +1 -1
  325. package/dist/types/nodeTypes.js.map +1 -1
  326. package/dist/utilities/createServerFeature.d.ts +1 -1
  327. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  328. package/dist/utilities/createServerFeature.js +2 -2
  329. package/dist/utilities/createServerFeature.js.map +1 -1
  330. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  331. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  332. package/dist/utilities/editorConfigFactory.js +9 -9
  333. package/dist/utilities/editorConfigFactory.js.map +1 -1
  334. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  335. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  336. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  337. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  338. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  339. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  340. package/package.json +97 -24
  341. package/dist/dependencyChecker.spec.js +0 -16
  342. package/dist/dependencyChecker.spec.js.map +0 -1
  343. package/dist/exports/client/Field-QGSHF22S.js +0 -2
  344. package/dist/exports/client/Field-QGSHF22S.js.map +0 -7
  345. package/dist/exports/client/chunk-UD4DQ4AK.js +0 -2
  346. package/dist/exports/client/chunk-UD4DQ4AK.js.map +0 -7
  347. package/dist/exports/client/chunk-X3D4LZS7.js +0 -2
  348. package/dist/exports/client/chunk-X3D4LZS7.js.map +0 -7
  349. package/dist/exports/client/component-PHZQBOJE.js +0 -2
  350. package/dist/exports/client/component-PHZQBOJE.js.map +0 -7
  351. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  352. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  353. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  354. package/dist/features/experimental_table/client/index.js.map +0 -1
  355. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  356. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  357. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  358. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  359. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  360. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  361. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  362. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  363. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  364. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  365. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  366. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  367. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  368. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  369. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  370. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  371. package/dist/features/experimental_table/server/index.d.ts +0 -3
  372. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  373. package/dist/features/experimental_table/server/index.js.map +0 -1
  374. package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
  375. package/dist/features/experimental_table/server/schema.js.map +0 -1
  376. package/dist/features/link/markdownTransformer.spec.js +0 -195
  377. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  378. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  379. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  380. package/dist/lexical/utils/url.spec.js +0 -114
  381. package/dist/lexical/utils/url.spec.js.map +0 -1
  382. package/dist/utilities/jsx/jsx.spec.js +0 -178
  383. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  384. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  385. /package/dist/features/{experimental_table → table}/client/index.js +0 -0
  386. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +0 -0
  387. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  388. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  389. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  390. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  391. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  392. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -0
  393. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  394. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  395. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  396. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  397. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
  398. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  399. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  400. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  401. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
  402. /package/dist/features/{experimental_table → table}/markdownTransformer.d.ts +0 -0
  403. /package/dist/features/{experimental_table → table}/markdownTransformer.js +0 -0
  404. /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
  405. /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
@@ -1,10 +1,11 @@
1
- import type { ExclusiveUploadFeatureProps } from '../server/index.js';
1
+ import type { CollectionSlug } from 'payload';
2
2
  export type UploadFeaturePropsClient = {
3
3
  collections: {
4
4
  [collection: string]: {
5
5
  hasExtraFields: boolean;
6
6
  };
7
7
  };
8
- } & ExclusiveUploadFeatureProps;
8
+ enabledCollectionSlugs: CollectionSlug[];
9
+ };
9
10
  export declare const UploadFeatureClient: import("../../typesClient.js").FeatureProviderProviderClient<UploadFeaturePropsClient, UploadFeaturePropsClient>;
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/client/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAUrE,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,EAAE;QACX,CAAC,UAAU,EAAE,MAAM,GAAG;YACpB,cAAc,EAAE,OAAO,CAAA;SACxB,CAAA;KACF,CAAA;CACF,GAAG,2BAA2B,CAAA;AAE/B,eAAO,MAAM,mBAAmB,kHAqD9B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/client/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAY7C,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,EAAE;QACX,CAAC,UAAU,EAAE,MAAM,GAAG;YACpB,cAAc,EAAE,OAAO,CAAA;SACxB,CAAA;KACF,CAAA;IACD,sBAAsB,EAAE,cAAc,EAAE,CAAA;CACzC,CAAA;AAED,eAAO,MAAM,mBAAmB,kHAqD9B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$isNodeSelection","UploadIcon","createClientFeature","slashMenuBasicGroupWithItems","toolbarAddDropdownGroupWithItems","INSERT_UPLOAD_WITH_DRAWER_COMMAND","$isUploadNode","UploadNode","UploadPlugin","UploadFeatureClient","nodes","plugins","Component","position","slashMenu","groups","Icon","key","keywords","label","i18n","t","onSelect","editor","dispatchCommand","replace","toolbarFixed","ChildComponent","isActive","selection","getNodes","length","firstNode"],"sources":["../../../../src/features/upload/client/index.tsx"],"sourcesContent":["'use client'\n\nimport { $isNodeSelection } from 'lexical'\n\nimport type { ExclusiveUploadFeatureProps } from '../server/index.js'\n\nimport { UploadIcon } from '../../../lexical/ui/icons/Upload/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { slashMenuBasicGroupWithItems } from '../../shared/slashMenu/basicGroup.js'\nimport { toolbarAddDropdownGroupWithItems } from '../../shared/toolbar/addDropdownGroup.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from './drawer/commands.js'\nimport { $isUploadNode, UploadNode } from './nodes/UploadNode.js'\nimport { UploadPlugin } from './plugin/index.js'\n\nexport type UploadFeaturePropsClient = {\n collections: {\n [collection: string]: {\n hasExtraFields: boolean\n }\n }\n} & ExclusiveUploadFeatureProps\n\nexport const UploadFeatureClient = createClientFeature<UploadFeaturePropsClient>({\n nodes: [UploadNode],\n plugins: [\n {\n Component: UploadPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n slashMenuBasicGroupWithItems([\n {\n Icon: UploadIcon,\n key: 'upload',\n keywords: ['upload', 'image', 'file', 'img', 'picture', 'photo', 'media'],\n label: ({ i18n }) => {\n return i18n.t('lexical:upload:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: [\n toolbarAddDropdownGroupWithItems([\n {\n ChildComponent: UploadIcon,\n isActive: ({ selection }) => {\n if (!$isNodeSelection(selection) || !selection.getNodes().length) {\n return false\n }\n\n const firstNode = selection.getNodes()[0]\n return $isUploadNode(firstNode)\n },\n key: 'upload',\n label: ({ i18n }) => {\n return i18n.t('lexical:upload:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ]),\n ],\n },\n})\n"],"mappings":"AAAA;;AAEA,SAASA,gBAAgB,QAAQ;AAIjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,4BAA4B,QAAQ;AAC7C,SAASC,gCAAgC,QAAQ;AACjD,SAASC,iCAAiC,QAAQ;AAClD,SAASC,aAAa,EAAEC,UAAU,QAAQ;AAC1C,SAASC,YAAY,QAAQ;AAU7B,OAAO,MAAMC,mBAAA,GAAsBP,mBAAA,CAA8C;EAC/EQ,KAAA,EAAO,CAACH,UAAA,CAAW;EACnBI,OAAA,EAAS,CACP;IACEC,SAAA,EAAWJ,YAAA;IACXK,QAAA,EAAU;EACZ,EACD;EACDC,SAAA,EAAW;IACTC,MAAA,EAAQ,CACNZ,4BAAA,CAA6B,CAC3B;MACEa,IAAA,EAAMf,UAAA;MACNgB,GAAA,EAAK;MACLC,QAAA,EAAU,CAAC,UAAU,SAAS,QAAQ,OAAO,WAAW,SAAS,QAAQ;MACzEC,KAAA,EAAOA,CAAC;QAAEC;MAAI,CAAE;QACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;MAChB;MACAC,QAAA,EAAUA,CAAC;QAAEC;MAAM,CAAE;QACnBA,MAAA,CAAOC,eAAe,CAACnB,iCAAA,EAAmC;UACxDoB,OAAA,EAAS;QACX;MACF;IACF,EACD;EAEL;EACAC,YAAA,EAAc;IACZX,MAAA,EAAQ,CACNX,gCAAA,CAAiC,CAC/B;MACEuB,cAAA,EAAgB1B,UAAA;MAChB2B,QAAA,EAAUA,CAAC;QAAEC;MAAS,CAAE;QACtB,IAAI,CAAC7B,gBAAA,CAAiB6B,SAAA,KAAc,CAACA,SAAA,CAAUC,QAAQ,GAAGC,MAAM,EAAE;UAChE,OAAO;QACT;QAEA,MAAMC,SAAA,GAAYH,SAAA,CAAUC,QAAQ,EAAE,CAAC,EAAE;QACzC,OAAOxB,aAAA,CAAc0B,SAAA;MACvB;MACAf,GAAA,EAAK;MACLE,KAAA,EAAOA,CAAC;QAAEC;MAAI,CAAE;QACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;MAChB;MACAC,QAAA,EAAUA,CAAC;QAAEC;MAAM,CAAE;QACnBA,MAAA,CAAOC,eAAe,CAACnB,iCAAA,EAAmC;UACxDoB,OAAA,EAAS;QACX;MACF;IACF,EACD;EAEL;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$isNodeSelection","UploadIcon","createClientFeature","slashMenuBasicGroupWithItems","toolbarAddDropdownGroupWithItems","INSERT_UPLOAD_WITH_DRAWER_COMMAND","$isUploadNode","UploadNode","UploadPlugin","UploadFeatureClient","nodes","plugins","Component","position","slashMenu","groups","Icon","key","keywords","label","i18n","t","onSelect","editor","dispatchCommand","replace","toolbarFixed","ChildComponent","isActive","selection","getNodes","length","firstNode"],"sources":["../../../../src/features/upload/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { CollectionSlug } from 'payload'\n\nimport { $isNodeSelection } from 'lexical'\n\nimport { UploadIcon } from '../../../lexical/ui/icons/Upload/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { slashMenuBasicGroupWithItems } from '../../shared/slashMenu/basicGroup.js'\nimport { toolbarAddDropdownGroupWithItems } from '../../shared/toolbar/addDropdownGroup.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from './drawer/commands.js'\nimport { $isUploadNode, UploadNode } from './nodes/UploadNode.js'\nimport { UploadPlugin } from './plugin/index.js'\n\nexport type UploadFeaturePropsClient = {\n collections: {\n [collection: string]: {\n hasExtraFields: boolean\n }\n }\n enabledCollectionSlugs: CollectionSlug[]\n}\n\nexport const UploadFeatureClient = createClientFeature<UploadFeaturePropsClient>({\n nodes: [UploadNode],\n plugins: [\n {\n Component: UploadPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n slashMenuBasicGroupWithItems([\n {\n Icon: UploadIcon,\n key: 'upload',\n keywords: ['upload', 'image', 'file', 'img', 'picture', 'photo', 'media'],\n label: ({ i18n }) => {\n return i18n.t('lexical:upload:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: [\n toolbarAddDropdownGroupWithItems([\n {\n ChildComponent: UploadIcon,\n isActive: ({ selection }) => {\n if (!$isNodeSelection(selection) || !selection.getNodes().length) {\n return false\n }\n\n const firstNode = selection.getNodes()[0]\n return $isUploadNode(firstNode)\n },\n key: 'upload',\n label: ({ i18n }) => {\n return i18n.t('lexical:upload:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ]),\n ],\n },\n})\n"],"mappings":"AAAA;;AAIA,SAASA,gBAAgB,QAAQ;AAEjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,4BAA4B,QAAQ;AAC7C,SAASC,gCAAgC,QAAQ;AACjD,SAASC,iCA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ACX;MACF;IACF,EACD;EAEL;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/plugin/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAuB7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAuB,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAM3D,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;AAEpG,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,SAAS;QACjB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,WAAW,CAAC,EAAE,IAAI,CAAA;KACnB;CACF;AA4BD,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,mBAAmB,CAC9B,CAAA;AAYxC,eAAO,MAAM,YAAY,EAAE,eAAe,CAAC,wBAAwB,CAiUlE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/plugin/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAuB7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAuB,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAM3D,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;AAEpG,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,SAAS;QACjB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,WAAW,CAAC,EAAE,IAAI,CAAA;KACnB;CACF;AA4BD,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,mBAAmB,CAC9B,CAAA;AAYxC,eAAO,MAAM,YAAY,EAAE,eAAe,CAAC,wBAAwB,CA+TlE,CAAA"}
@@ -31,29 +31,24 @@ function getDragSelection(event) {
31
31
  }
32
32
  export const INSERT_UPLOAD_COMMAND = createCommand('INSERT_UPLOAD_COMMAND');
33
33
  export const UploadPlugin = t0 => {
34
- const $ = _c(21);
34
+ const $ = _c(20);
35
35
  const {
36
36
  clientProps
37
37
  } = t0;
38
38
  const [editor] = useLexicalComposerContext();
39
- const t1 = clientProps?.disabledCollections;
40
- const t2 = clientProps?.enabledCollections;
41
- let t3;
42
- if ($[0] !== t1 || $[1] !== t2) {
43
- t3 = {
44
- collectionSlugsBlacklist: t1,
45
- collectionSlugsWhitelist: t2,
46
- uploads: true
39
+ let t1;
40
+ if ($[0] !== clientProps.enabledCollectionSlugs) {
41
+ t1 = {
42
+ enabledCollectionSlugs: clientProps.enabledCollectionSlugs
47
43
  };
48
- $[0] = t1;
49
- $[1] = t2;
50
- $[2] = t3;
44
+ $[0] = clientProps.enabledCollectionSlugs;
45
+ $[1] = t1;
51
46
  } else {
52
- t3 = $[2];
47
+ t1 = $[1];
53
48
  }
54
49
  const {
55
50
  enabledCollectionSlugs
56
- } = useEnabledRelationships(t3);
51
+ } = useEnabledRelationships(t1);
57
52
  const {
58
53
  modalSlug: bulkUploadModalSlug,
59
54
  setCollectionSlug,
@@ -66,12 +61,12 @@ export const UploadPlugin = t0 => {
66
61
  isModalOpen,
67
62
  openModal
68
63
  } = useModal();
69
- let t4;
70
- if ($[3] !== bulkUploadModalSlug || $[4] !== editor || $[5] !== enabledCollectionSlugs || $[6] !== isModalOpen || $[7] !== openModal || $[8] !== setCollectionSlug || $[9] !== setInitialForms || $[10] !== setOnCancel || $[11] !== setOnSuccess || $[12] !== setSelectableCollections) {
71
- t4 = t5 => {
64
+ let t2;
65
+ if ($[2] !== bulkUploadModalSlug || $[3] !== editor || $[4] !== enabledCollectionSlugs || $[5] !== isModalOpen || $[6] !== openModal || $[7] !== setCollectionSlug || $[8] !== setInitialForms || $[9] !== setOnCancel || $[10] !== setOnSuccess || $[11] !== setSelectableCollections) {
66
+ t2 = t3 => {
72
67
  const {
73
68
  files
74
- } = t5;
69
+ } = t3;
75
70
  if (files?.length === 0) {
76
71
  return;
77
72
  }
@@ -112,24 +107,24 @@ export const UploadPlugin = t0 => {
112
107
  openModal(bulkUploadModalSlug);
113
108
  }
114
109
  };
115
- $[3] = bulkUploadModalSlug;
116
- $[4] = editor;
117
- $[5] = enabledCollectionSlugs;
118
- $[6] = isModalOpen;
119
- $[7] = openModal;
120
- $[8] = setCollectionSlug;
121
- $[9] = setInitialForms;
122
- $[10] = setOnCancel;
123
- $[11] = setOnSuccess;
124
- $[12] = setSelectableCollections;
125
- $[13] = t4;
110
+ $[2] = bulkUploadModalSlug;
111
+ $[3] = editor;
112
+ $[4] = enabledCollectionSlugs;
113
+ $[5] = isModalOpen;
114
+ $[6] = openModal;
115
+ $[7] = setCollectionSlug;
116
+ $[8] = setInitialForms;
117
+ $[9] = setOnCancel;
118
+ $[10] = setOnSuccess;
119
+ $[11] = setSelectableCollections;
120
+ $[12] = t2;
126
121
  } else {
127
- t4 = $[13];
122
+ t2 = $[12];
128
123
  }
129
- const openBulkUpload = useEffectEvent(t4);
130
- let t5;
131
- if ($[14] !== editor || $[15] !== openBulkUpload) {
132
- t5 = () => {
124
+ const openBulkUpload = useEffectEvent(t2);
125
+ let t3;
126
+ if ($[13] !== editor || $[14] !== openBulkUpload) {
127
+ t3 = () => {
133
128
  if (!editor.hasNodes([UploadNode])) {
134
129
  throw new Error("UploadPlugin: UploadNode not registered on editor");
135
130
  }
@@ -311,32 +306,32 @@ export const UploadPlugin = t0 => {
311
306
  return false;
312
307
  }, COMMAND_PRIORITY_LOW));
313
308
  };
314
- $[14] = editor;
315
- $[15] = openBulkUpload;
316
- $[16] = t5;
309
+ $[13] = editor;
310
+ $[14] = openBulkUpload;
311
+ $[15] = t3;
317
312
  } else {
318
- t5 = $[16];
313
+ t3 = $[15];
319
314
  }
320
- let t6;
321
- if ($[17] !== editor) {
322
- t6 = [editor];
323
- $[17] = editor;
324
- $[18] = t6;
315
+ let t4;
316
+ if ($[16] !== editor) {
317
+ t4 = [editor];
318
+ $[16] = editor;
319
+ $[17] = t4;
325
320
  } else {
326
- t6 = $[18];
321
+ t4 = $[17];
327
322
  }
328
- useEffect(t5, t6);
329
- let t7;
330
- if ($[19] !== enabledCollectionSlugs) {
331
- t7 = _jsx(UploadDrawer, {
323
+ useEffect(t3, t4);
324
+ let t5;
325
+ if ($[18] !== enabledCollectionSlugs) {
326
+ t5 = _jsx(UploadDrawer, {
332
327
  enabledCollectionSlugs
333
328
  });
334
- $[19] = enabledCollectionSlugs;
335
- $[20] = t7;
329
+ $[18] = enabledCollectionSlugs;
330
+ $[19] = t5;
336
331
  } else {
337
- t7 = $[20];
332
+ t5 = $[19];
338
333
  }
339
- return t7;
334
+ return t5;
340
335
  };
341
336
  function _temp(file) {
342
337
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$dfsIterator","$insertNodeToNearestRoot","mergeRegister","useBulkUpload","useEffectEvent","useModal","ObjectID","$createRangeSelection","$getPreviousSelection","$getSelection","$isParagraphNode","$isRangeSelection","$setSelection","COMMAND_PRIORITY_EDITOR","COMMAND_PRIORITY_LOW","createCommand","DROP_COMMAND","getDOMSelectionFromTarget","isHTMLElement","PASTE_COMMAND","React","useEffect","useEnabledRelationships","UploadDrawer","$createUploadNode","$isUploadNode","UploadNode","canDropImage","event","target","closest","parentElement","getDragSelection","range","domSelection","document","caretRangeFromPoint","clientX","clientY","rangeParent","collapse","rangeOffset","getRangeAt","Error","INSERT_UPLOAD_COMMAND","UploadPlugin","t0","$","clientProps","editor","t1","disabledCollections","t2","enabledCollections","t3","collectionSlugsBlacklist","collectionSlugsWhitelist","uploads","enabledCollectionSlugs","modalSlug","bulkUploadModalSlug","setCollectionSlug","setInitialForms","setOnCancel","setOnSuccess","setSelectableCollections","isModalOpen","openModal","t4","t5","files","length","initialForms","map","_temp","update","_temp2","newDocs","newDocsMap","Map","_temp3","dfsNode_0","node_0","dfsNode","node","nodeData_0","getData","nodeData","pending","newDoc","get","formID","replace","data","id","default","toHexString","fields","relationTo","collectionSlug","value","doc","openBulkUpload","hasNodes","registerNodeTransform","node_1","nodeData_1","upload","transformedImage","src","startsWith","mimeMatch","match","mimeType","base64Data","byteCharacters","atob","byteNumbers","Array","i","charCodeAt","byteArray","Uint8Array","file_0","File","split","type","file","res","fetch","blob","inferredFileName","pop","file_1","registerCommand","payload","selection","uploadNode","focus","focusNode","getNode","__first","remove","ClipboardEvent","clipboardData","types","includes","files_0","from","forEach","file_2","push","alt","selection_0","file_3","pendingUploadNode","URL","createObjectURL","focus_0","focusNode_0","event_0","DragEvent","dt","dataTransfer","files_1","file_4","preventDefault","stopPropagation","selection_1","undefined","applyDOMRange","file_5","pendingUploadNode_0","focus_1","focusNode_1","t6","t7","_jsx"],"sources":["../../../../../src/features/upload/client/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $dfsIterator, $insertNodeToNearestRoot, mergeRegister } from '@lexical/utils'\nimport { useBulkUpload, useEffectEvent, useModal } from '@payloadcms/ui'\nimport ObjectID from 'bson-objectid'\nimport {\n $createRangeSelection,\n $getPreviousSelection,\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n $setSelection,\n COMMAND_PRIORITY_EDITOR,\n COMMAND_PRIORITY_LOW,\n createCommand,\n DROP_COMMAND,\n getDOMSelectionFromTarget,\n isHTMLElement,\n PASTE_COMMAND,\n} from 'lexical'\nimport React, { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { Internal_UploadData, UploadData } from '../../server/schema.js'\nimport type { UploadFeaturePropsClient } from '../index.js'\n\nimport { useEnabledRelationships } from '../../../relationship/client/utils/useEnabledRelationships.js'\nimport { UploadDrawer } from '../drawer/index.js'\nimport { $createUploadNode, $isUploadNode, UploadNode } from '../nodes/UploadNode.js'\n\nexport type InsertUploadPayload = Readonly<Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>>\n\ndeclare global {\n interface DragEvent {\n rangeOffset?: number\n rangeParent?: Node\n }\n}\n\nfunction canDropImage(event: DragEvent): boolean {\n const target = event.target\n return !!(\n isHTMLElement(target) &&\n !target.closest('code, span.editor-image') &&\n isHTMLElement(target.parentElement) &&\n target.parentElement.closest('div.ContentEditable__root')\n )\n}\n\nfunction getDragSelection(event: DragEvent): null | Range | undefined {\n // Source: https://github.com/AlessioGr/lexical/blob/main/packages/lexical-playground/src/plugins/ImagesPlugin/index.tsx\n let range\n const domSelection = getDOMSelectionFromTarget(event.target)\n if (document.caretRangeFromPoint) {\n range = document.caretRangeFromPoint(event.clientX, event.clientY)\n } else if (event.rangeParent && domSelection !== null) {\n domSelection.collapse(event.rangeParent, event.rangeOffset || 0)\n range = domSelection.getRangeAt(0)\n } else {\n throw Error(`Cannot get the selection when dragging`)\n }\n\n return range\n}\n\nexport const INSERT_UPLOAD_COMMAND: LexicalCommand<InsertUploadPayload> =\n createCommand('INSERT_UPLOAD_COMMAND')\n\ntype FileToUpload = {\n alt?: string\n file: File\n /**\n * Bulk Upload Form ID that should be created, which can then be matched\n * against the node formID if the upload is successful\n */\n formID: string\n}\n\nexport const UploadPlugin: PluginComponent<UploadFeaturePropsClient> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n\n const { enabledCollectionSlugs } = useEnabledRelationships({\n collectionSlugsBlacklist: clientProps?.disabledCollections,\n collectionSlugsWhitelist: clientProps?.enabledCollections,\n uploads: true,\n })\n\n const {\n modalSlug: bulkUploadModalSlug,\n setCollectionSlug,\n setInitialForms,\n setOnCancel,\n setOnSuccess,\n setSelectableCollections,\n } = useBulkUpload()\n\n const { isModalOpen, openModal } = useModal()\n\n const openBulkUpload = useEffectEvent(({ files }: { files: FileToUpload[] }) => {\n if (files?.length === 0) {\n return\n }\n\n setInitialForms((initialForms) => [\n ...(initialForms ?? []),\n ...files.map((file) => ({\n file: file.file,\n formID: file.formID,\n })),\n ])\n\n if (!isModalOpen(bulkUploadModalSlug)) {\n if (!enabledCollectionSlugs.length || !enabledCollectionSlugs[0]) {\n return\n }\n\n setCollectionSlug(enabledCollectionSlugs[0])\n setSelectableCollections(enabledCollectionSlugs)\n\n setOnCancel(() => {\n // Remove all the pending upload nodes that were added but not uploaded\n editor.update(() => {\n for (const dfsNode of $dfsIterator()) {\n const node = dfsNode.node\n\n if ($isUploadNode(node)) {\n const nodeData = node.getData()\n if ((nodeData as Internal_UploadData)?.pending) {\n node.remove()\n }\n }\n }\n })\n })\n\n setOnSuccess((newDocs) => {\n const newDocsMap = new Map(newDocs.map((doc) => [doc.formID, doc]))\n editor.update(() => {\n for (const dfsNode of $dfsIterator()) {\n const node = dfsNode.node\n if ($isUploadNode(node)) {\n const nodeData: Internal_UploadData = node.getData()\n\n if (nodeData?.pending) {\n const newDoc = newDocsMap.get(nodeData.pending?.formID)\n if (newDoc) {\n node.replace(\n $createUploadNode({\n data: {\n id: new ObjectID.default().toHexString(),\n fields: {},\n relationTo: newDoc.collectionSlug,\n value: newDoc.doc.id,\n } as UploadData,\n }),\n )\n }\n }\n }\n }\n })\n })\n\n openModal(bulkUploadModalSlug)\n }\n })\n\n useEffect(() => {\n if (!editor.hasNodes([UploadNode])) {\n throw new Error('UploadPlugin: UploadNode not registered on editor')\n }\n\n return mergeRegister(\n /**\n * Handle auto-uploading files if you copy & paste an image dom element from the clipboard\n */\n editor.registerNodeTransform(UploadNode, (node) => {\n const nodeData: Internal_UploadData = node.getData()\n if (!nodeData?.pending) {\n return\n }\n\n async function upload() {\n let transformedImage: FileToUpload | null = null\n\n const src = nodeData?.pending?.src\n const formID = nodeData?.pending?.formID as string\n\n if (src?.startsWith('data:')) {\n // It's a base64-encoded image\n const mimeMatch = src.match(/data:(image\\/[a-zA-Z]+);base64,/)\n const mimeType = mimeMatch ? mimeMatch[1] : 'image/png' // Default to PNG if MIME type not found\n const base64Data = src.replace(/^data:image\\/[a-zA-Z]+;base64,/, '')\n const byteCharacters = atob(base64Data)\n const byteNumbers = new Array(byteCharacters.length)\n for (let i = 0; i < byteCharacters.length; i++) {\n byteNumbers[i] = byteCharacters.charCodeAt(i)\n }\n const byteArray = new Uint8Array(byteNumbers)\n const file = new File([byteArray], 'pasted-image.' + mimeType?.split('/', 2)[1], {\n type: mimeType,\n })\n transformedImage = { alt: undefined, file, formID }\n } else if (src?.startsWith('http') || src?.startsWith('https')) {\n // It's an image URL\n const res = await fetch(src)\n const blob = await res.blob()\n const inferredFileName =\n src.split('/').pop() || 'pasted-image' + blob.type.split('/', 2)[1]\n const file = new File([blob], inferredFileName, {\n type: blob.type,\n })\n\n transformedImage = { alt: undefined, file, formID }\n }\n\n if (!transformedImage) {\n return\n }\n\n openBulkUpload({ files: [transformedImage] })\n }\n void upload()\n }),\n editor.registerCommand<InsertUploadPayload>(\n INSERT_UPLOAD_COMMAND,\n (payload: InsertUploadPayload) => {\n editor.update(() => {\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n const uploadNode = $createUploadNode({\n data: {\n id: payload.id,\n fields: payload.fields,\n relationTo: payload.relationTo,\n value: payload.value,\n },\n })\n // we need to get the focus node before inserting the block node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert upload node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(uploadNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n })\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n ),\n editor.registerCommand(\n PASTE_COMMAND,\n (event) => {\n // Pending UploadNodes are automatically created when importDOM is called. However, if you paste a file from your computer\n // directly, importDOM won't be called, as it's not a HTML dom element. So we need to handle that case here.\n\n if (!(event instanceof ClipboardEvent)) {\n return false\n }\n const clipboardData = event.clipboardData\n\n if (!clipboardData?.types?.length || clipboardData?.types?.includes('text/html')) {\n // HTML is handled through importDOM => registerNodeTransform for pending UploadNode\n return false\n }\n\n const files: FileToUpload[] = []\n if (clipboardData?.files?.length) {\n Array.from(clipboardData.files).forEach((file) => {\n files.push({\n alt: '',\n file,\n formID: new ObjectID.default().toHexString(),\n })\n })\n }\n\n if (files.length) {\n // Insert a pending UploadNode for each image\n editor.update(() => {\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n for (const file of files) {\n const pendingUploadNode = $createUploadNode({\n data: {\n pending: {\n formID: file.formID,\n src: URL.createObjectURL(file.file),\n },\n } as Internal_UploadData,\n })\n // we need to get the focus node before inserting the upload node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert upload node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(pendingUploadNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n }\n })\n\n // Open the bulk drawer - the node transform will not open it for us, as it does not handle blob/file uploads\n openBulkUpload({ files })\n\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n // Handle drag & drop of files from the desktop into the editor\n editor.registerCommand(\n DROP_COMMAND,\n (event) => {\n if (!(event instanceof DragEvent)) {\n return false\n }\n\n const dt = event.dataTransfer\n\n if (!dt?.types?.length) {\n return false\n }\n\n const files: FileToUpload[] = []\n if (dt?.files?.length) {\n Array.from(dt.files).forEach((file) => {\n files.push({\n alt: '',\n file,\n formID: new ObjectID.default().toHexString(),\n })\n })\n }\n\n if (files.length) {\n // Prevent the default browser drop handling, which would open the file in the browser\n event.preventDefault()\n event.stopPropagation()\n\n // Insert a PendingUploadNode for each image\n editor.update(() => {\n if (canDropImage(event)) {\n const range = getDragSelection(event)\n const selection = $createRangeSelection()\n if (range !== null && range !== undefined) {\n selection.applyDOMRange(range)\n }\n $setSelection(selection)\n\n for (const file of files) {\n const pendingUploadNode = $createUploadNode({\n data: {\n pending: {\n formID: file.formID,\n src: URL.createObjectURL(file.file),\n },\n } as Internal_UploadData,\n })\n // we need to get the focus node before inserting the upload node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert upload node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(pendingUploadNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n }\n })\n\n // Open the bulk drawer - the node transform will not open it for us, as it does not handle blob/file uploads\n openBulkUpload({ files })\n\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor])\n\n return <UploadDrawer enabledCollectionSlugs={enabledCollectionSlugs} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,YAAY,EAAEC,wBAAwB,EAAEC,aAAa,QAAQ;AACtE,SAASC,aAAa,EAAEC,cAAc,EAAEC,QAAQ,QAAQ;AACxD,OAAOC,QAAA,MAAc;AACrB,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,aAAa,EACbC,uBAAuB,EACvBC,oBAAoB,EACpBC,aAAa,EACbC,YAAY,EACZC,yBAAyB,EACzBC,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AAAA;AA7BuD,SAAAf,OAAA;EAAA,KA4CxD,MAAAO,OAAM,IAAWnF,YAAA;IACpB,MAAAoF,IAAA,GAAaD,OAAA,CAAAC,IAAA;IAAY,IAErB3D,aAAA,CAAc2D,IAAA;MAChB,MAAAG,QAAA,GAAiBH,IAAA,CAAAE,OAAA,CAAY;MAAA,IACxBC,QAAA,EAAAC,OAAA;QACHJ,IAAA,CAAA0D,MAAA,CAAW;MAAA;IAAA;EAAA;AAAA;AAlD4C,SAAA9D,OAAAqB,GAAA;EAAA,QA0DdA,GAAA,CAAAV,MAAA,EAAYU,GAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$dfsIterator","$insertNodeToNearestRoot","mergeRegister","useBulkUpload","useEffectEvent","useModal","ObjectID","$createRangeSelection","$getPreviousSelection","$getSelection","$isParagraphNode","$isRangeSelection","$setSelection","COMMAND_PRIORITY_EDITOR","COMMAND_PRIORITY_LOW","createCommand","DROP_COMMAND","getDOMSelectionFromTarget","isHTMLElement","PASTE_COMMAND","React","useEffect","useEnabledRelationships","UploadDrawer","$createUploadNode","$isUploadNode","UploadNode","canDropImage","event","target","closest","parentElement","getDragSelection","range","domSelection","document","caretRangeFromPoint","clientX","clientY","rangeParent","collapse","rangeOffset","getRangeAt","Error","INSERT_UPLOAD_COMMAND","UploadPlugin","t0","$","clientProps","editor","t1","enabledCollectionSlugs","modalSlug","bulkUploadModalSlug","setCollectionSlug","setInitialForms","setOnCancel","setOnSuccess","setSelectableCollections","isModalOpen","openModal","t2","t3","files","length","initialForms","map","_temp","update","_temp2","newDocs","newDocsMap","Map","_temp3","dfsNode_0","node_0","dfsNode","node","nodeData_0","getData","nodeData","pending","newDoc","get","formID","replace","data","id","default","toHexString","fields","relationTo","collectionSlug","value","doc","openBulkUpload","hasNodes","registerNodeTransform","node_1","nodeData_1","upload","transformedImage","src","startsWith","mimeMatch","match","mimeType","base64Data","byteCharacters","atob","byteNumbers","Array","i","charCodeAt","byteArray","Uint8Array","file_0","File","split","type","file","res","fetch","blob","inferredFileName","pop","file_1","registerCommand","payload","selection","uploadNode","focus","focusNode","getNode","__first","remove","ClipboardEvent","clipboardData","types","includes","files_0","from","forEach","file_2","push","alt","selection_0","file_3","pendingUploadNode","URL","createObjectURL","focus_0","focusNode_0","event_0","DragEvent","dt","dataTransfer","files_1","file_4","preventDefault","stopPropagation","selection_1","undefined","applyDOMRange","file_5","pendingUploadNode_0","focus_1","focusNode_1","t4","t5","_jsx"],"sources":["../../../../../src/features/upload/client/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $dfsIterator, $insertNodeToNearestRoot, mergeRegister } from '@lexical/utils'\nimport { useBulkUpload, useEffectEvent, useModal } from '@payloadcms/ui'\nimport ObjectID from 'bson-objectid'\nimport {\n $createRangeSelection,\n $getPreviousSelection,\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n $setSelection,\n COMMAND_PRIORITY_EDITOR,\n COMMAND_PRIORITY_LOW,\n createCommand,\n DROP_COMMAND,\n getDOMSelectionFromTarget,\n isHTMLElement,\n PASTE_COMMAND,\n} from 'lexical'\nimport React, { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { Internal_UploadData, UploadData } from '../../server/schema.js'\nimport type { UploadFeaturePropsClient } from '../index.js'\n\nimport { useEnabledRelationships } from '../../../relationship/client/utils/useEnabledRelationships.js'\nimport { UploadDrawer } from '../drawer/index.js'\nimport { $createUploadNode, $isUploadNode, UploadNode } from '../nodes/UploadNode.js'\n\nexport type InsertUploadPayload = Readonly<Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>>\n\ndeclare global {\n interface DragEvent {\n rangeOffset?: number\n rangeParent?: Node\n }\n}\n\nfunction canDropImage(event: DragEvent): boolean {\n const target = event.target\n return !!(\n isHTMLElement(target) &&\n !target.closest('code, span.editor-image') &&\n isHTMLElement(target.parentElement) &&\n target.parentElement.closest('div.ContentEditable__root')\n )\n}\n\nfunction getDragSelection(event: DragEvent): null | Range | undefined {\n // Source: https://github.com/AlessioGr/lexical/blob/main/packages/lexical-playground/src/plugins/ImagesPlugin/index.tsx\n let range\n const domSelection = getDOMSelectionFromTarget(event.target)\n if (document.caretRangeFromPoint) {\n range = document.caretRangeFromPoint(event.clientX, event.clientY)\n } else if (event.rangeParent && domSelection !== null) {\n domSelection.collapse(event.rangeParent, event.rangeOffset || 0)\n range = domSelection.getRangeAt(0)\n } else {\n throw Error(`Cannot get the selection when dragging`)\n }\n\n return range\n}\n\nexport const INSERT_UPLOAD_COMMAND: LexicalCommand<InsertUploadPayload> =\n createCommand('INSERT_UPLOAD_COMMAND')\n\ntype FileToUpload = {\n alt?: string\n file: File\n /**\n * Bulk Upload Form ID that should be created, which can then be matched\n * against the node formID if the upload is successful\n */\n formID: string\n}\n\nexport const UploadPlugin: PluginComponent<UploadFeaturePropsClient> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n\n const { enabledCollectionSlugs } = useEnabledRelationships({\n enabledCollectionSlugs: clientProps.enabledCollectionSlugs,\n })\n\n const {\n modalSlug: bulkUploadModalSlug,\n setCollectionSlug,\n setInitialForms,\n setOnCancel,\n setOnSuccess,\n setSelectableCollections,\n } = useBulkUpload()\n\n const { isModalOpen, openModal } = useModal()\n\n const openBulkUpload = useEffectEvent(({ files }: { files: FileToUpload[] }) => {\n if (files?.length === 0) {\n return\n }\n\n setInitialForms((initialForms) => [\n ...(initialForms ?? []),\n ...files.map((file) => ({\n file: file.file,\n formID: file.formID,\n })),\n ])\n\n if (!isModalOpen(bulkUploadModalSlug)) {\n if (!enabledCollectionSlugs.length || !enabledCollectionSlugs[0]) {\n return\n }\n\n setCollectionSlug(enabledCollectionSlugs[0])\n setSelectableCollections(enabledCollectionSlugs)\n\n setOnCancel(() => {\n // Remove all the pending upload nodes that were added but not uploaded\n editor.update(() => {\n for (const dfsNode of $dfsIterator()) {\n const node = dfsNode.node\n\n if ($isUploadNode(node)) {\n const nodeData = node.getData()\n if ((nodeData as Internal_UploadData)?.pending) {\n node.remove()\n }\n }\n }\n })\n })\n\n setOnSuccess((newDocs) => {\n const newDocsMap = new Map(newDocs.map((doc) => [doc.formID, doc]))\n editor.update(() => {\n for (const dfsNode of $dfsIterator()) {\n const node = dfsNode.node\n if ($isUploadNode(node)) {\n const nodeData: Internal_UploadData = node.getData()\n\n if (nodeData?.pending) {\n const newDoc = newDocsMap.get(nodeData.pending?.formID)\n if (newDoc) {\n node.replace(\n $createUploadNode({\n data: {\n id: new ObjectID.default().toHexString(),\n fields: {},\n relationTo: newDoc.collectionSlug,\n value: newDoc.doc.id,\n } as UploadData,\n }),\n )\n }\n }\n }\n }\n })\n })\n\n openModal(bulkUploadModalSlug)\n }\n })\n\n useEffect(() => {\n if (!editor.hasNodes([UploadNode])) {\n throw new Error('UploadPlugin: UploadNode not registered on editor')\n }\n\n return mergeRegister(\n /**\n * Handle auto-uploading files if you copy & paste an image dom element from the clipboard\n */\n editor.registerNodeTransform(UploadNode, (node) => {\n const nodeData: Internal_UploadData = node.getData()\n if (!nodeData?.pending) {\n return\n }\n\n async function upload() {\n let transformedImage: FileToUpload | null = null\n\n const src = nodeData?.pending?.src\n const formID = nodeData?.pending?.formID as string\n\n if (src?.startsWith('data:')) {\n // It's a base64-encoded image\n const mimeMatch = src.match(/data:(image\\/[a-zA-Z]+);base64,/)\n const mimeType = mimeMatch ? mimeMatch[1] : 'image/png' // Default to PNG if MIME type not found\n const base64Data = src.replace(/^data:image\\/[a-zA-Z]+;base64,/, '')\n const byteCharacters = atob(base64Data)\n const byteNumbers = new Array(byteCharacters.length)\n for (let i = 0; i < byteCharacters.length; i++) {\n byteNumbers[i] = byteCharacters.charCodeAt(i)\n }\n const byteArray = new Uint8Array(byteNumbers)\n const file = new File([byteArray], 'pasted-image.' + mimeType?.split('/', 2)[1], {\n type: mimeType,\n })\n transformedImage = { alt: undefined, file, formID }\n } else if (src?.startsWith('http') || src?.startsWith('https')) {\n // It's an image URL\n const res = await fetch(src)\n const blob = await res.blob()\n const inferredFileName =\n src.split('/').pop() || 'pasted-image' + blob.type.split('/', 2)[1]\n const file = new File([blob], inferredFileName, {\n type: blob.type,\n })\n\n transformedImage = { alt: undefined, file, formID }\n }\n\n if (!transformedImage) {\n return\n }\n\n openBulkUpload({ files: [transformedImage] })\n }\n void upload()\n }),\n editor.registerCommand<InsertUploadPayload>(\n INSERT_UPLOAD_COMMAND,\n (payload: InsertUploadPayload) => {\n editor.update(() => {\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n const uploadNode = $createUploadNode({\n data: {\n id: payload.id,\n fields: payload.fields,\n relationTo: payload.relationTo,\n value: payload.value,\n },\n })\n // we need to get the focus node before inserting the block node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert upload node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(uploadNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n })\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n ),\n editor.registerCommand(\n PASTE_COMMAND,\n (event) => {\n // Pending UploadNodes are automatically created when importDOM is called. However, if you paste a file from your computer\n // directly, importDOM won't be called, as it's not a HTML dom element. So we need to handle that case here.\n\n if (!(event instanceof ClipboardEvent)) {\n return false\n }\n const clipboardData = event.clipboardData\n\n if (!clipboardData?.types?.length || clipboardData?.types?.includes('text/html')) {\n // HTML is handled through importDOM => registerNodeTransform for pending UploadNode\n return false\n }\n\n const files: FileToUpload[] = []\n if (clipboardData?.files?.length) {\n Array.from(clipboardData.files).forEach((file) => {\n files.push({\n alt: '',\n file,\n formID: new ObjectID.default().toHexString(),\n })\n })\n }\n\n if (files.length) {\n // Insert a pending UploadNode for each image\n editor.update(() => {\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n for (const file of files) {\n const pendingUploadNode = $createUploadNode({\n data: {\n pending: {\n formID: file.formID,\n src: URL.createObjectURL(file.file),\n },\n } as Internal_UploadData,\n })\n // we need to get the focus node before inserting the upload node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert upload node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(pendingUploadNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n }\n })\n\n // Open the bulk drawer - the node transform will not open it for us, as it does not handle blob/file uploads\n openBulkUpload({ files })\n\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n // Handle drag & drop of files from the desktop into the editor\n editor.registerCommand(\n DROP_COMMAND,\n (event) => {\n if (!(event instanceof DragEvent)) {\n return false\n }\n\n const dt = event.dataTransfer\n\n if (!dt?.types?.length) {\n return false\n }\n\n const files: FileToUpload[] = []\n if (dt?.files?.length) {\n Array.from(dt.files).forEach((file) => {\n files.push({\n alt: '',\n file,\n formID: new ObjectID.default().toHexString(),\n })\n })\n }\n\n if (files.length) {\n // Prevent the default browser drop handling, which would open the file in the browser\n event.preventDefault()\n event.stopPropagation()\n\n // Insert a PendingUploadNode for each image\n editor.update(() => {\n if (canDropImage(event)) {\n const range = getDragSelection(event)\n const selection = $createRangeSelection()\n if (range !== null && range !== undefined) {\n selection.applyDOMRange(range)\n }\n $setSelection(selection)\n\n for (const file of files) {\n const pendingUploadNode = $createUploadNode({\n data: {\n pending: {\n formID: file.formID,\n src: URL.createObjectURL(file.file),\n },\n } as Internal_UploadData,\n })\n // we need to get the focus node before inserting the upload node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert upload node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(pendingUploadNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n }\n })\n\n // Open the bulk drawer - the node transform will not open it for us, as it does not handle blob/file uploads\n openBulkUpload({ files })\n\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor])\n\n return <UploadDrawer enabledCollectionSlugs={enabledCollectionSlugs} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,YAAY,EAAEC,wBAAwB,EAAEC,aAAa,QAAQ;AACtE,SAASC,aAAa,EAAEC,cAAc,EAAEC,QAAQ,QAAQ;AACxD,OAAOC,QAAA,MAAc;AACrB,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,aAAa,EACbC,uBAAuB,EACvBC,oBAAoB,EACpBC,aAAa,EACbC,YAAY,EACZC,yBAAyB,EACzBC,aAAa,EACbC,aAAa,QACR;AACP,OAAOC,KAAA,IAASC,SAAS,QAAQ;AAMjC,SAASC,uBAAuB,QAAQ;AACxC,SAASC,YAAY,QAAQ;AAC7B,SAASC,iBAAiB,EAAEC,aAAa,EAAEC,UAAU,QAAQ;AAW7D,SAASC,aAAaC,KAAgB;EACpC,MAAMC,MAAA,GAASD,KAAA,CAAMC,MAAM;EAC3B,OAAO,CAAC,EACNX,aAAA,CAAcW,MAAA,KACd,CAACA,MAAA,CAAOC,OAAO,CAAC,8BAChBZ,aAAA,CAAcW,MAAA,CAAOE,aAAa,KAClCF,MAAA,CAAOE,aAAa,CAACD,OAAO,CAAC,4BAA2B;AAE5D;AAEA,SAASE,iBAAiBJ,KAAgB;EACxC;EACA,IAAIK,KAAA;EACJ,MAAMC,YAAA,GAAejB,yBAAA,CAA0BW,KAAA,CAAMC,MAAM;EAC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A;EAAA;IAAAA,EAAA,GAAAf,CAAA;EAAA;EAAA,IAAAyH,EAAA;EAAA,IAAAzH,CAAA,SAAAE,MAAA;IAAGuH,EAAA,IAACvH,MAAA;IAAOF,CAAA,OAAAE,MAAA;IAAAF,CAAA,OAAAyH,EAAA;EAAA;IAAAA,EAAA,GAAAzH,CAAA;EAAA;EArOX1B,SAAA,CAAUyC,EAqOV,EAAG0G,EAAQ;EAAA,IAAAC,EAAA;EAAA,IAAA1H,CAAA,SAAAI,sBAAA;IAEJsH,EAAA,GAAAC,IAAA,CAAAnJ,YAAA;MAAA4B;IAAA,C;;;;;;SAAAsH,E;CACT;AA/TuE,SAAAtG,MAAAqD,IAAA;EAAA;IAAAA,IAAA,EA0BzDA,IAAA,CAAAA,IAAA;IAAApC,MAAA,EACEoC,IAAA,CAAApC;EAAA;AAAA;AA3BuD,SAAAf,OAAA;EAAA,KA0CxD,MAAAO,OAAM,IAAW5E,YAAA;IACpB,MAAA6E,IAAA,GAAaD,OAAA,CAAAC,IAAA;IAAY,IAErBpD,aAAA,CAAcoD,IAAA;MAChB,MAAAG,QAAA,GAAiBH,IAAA,CAAAE,OAAA,CAAY;MAAA,IACxBC,QAAA,EAAAC,OAAA;QACHJ,IAAA,CAAA0D,MAAA,CAAW;MAAA;IAAA;EAAA;AAAA;AAhD4C,SAAA9D,OAAAqB,GAAA;EAAA,QAwDdA,GAAA,CAAAV,MAAA,EAAYU,GAAA;AAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { PopulationPromise } 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 uploadPopulationPromiseHOC: (props?: UploadFeatureProps) => PopulationPromise<SerializedUploadNode>;
4
+ export declare const uploadPopulationPromiseHOC: (props: UploadFeatureServerProps) => PopulationPromise<SerializedUploadNode>;
5
5
  //# sourceMappingURL=graphQLPopulationPromise.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphQLPopulationPromise.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/graphQLPopulationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAKvD,eAAO,MAAM,0BAA0B,WAC7B,kBAAkB,KACzB,iBAAiB,CAAC,oBAAoB,CAwExC,CAAA"}
1
+ {"version":3,"file":"graphQLPopulationPromise.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/graphQLPopulationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAKvD,eAAO,MAAM,0BAA0B,UAC9B,wBAAwB,KAC9B,iBAAiB,CAAC,oBAAoB,CAwExC,CAAA"}
@@ -18,7 +18,7 @@ export const uploadPopulationPromiseHOC = props => {
18
18
  req,
19
19
  showHiddenFields
20
20
  }) => {
21
- if (node?.value) {
21
+ if (node?.value && props.enabledCollectionSlugs.includes(node.relationTo)) {
22
22
  const collection = req.payload.collections[node?.relationTo];
23
23
  if (collection) {
24
24
  // @ts-expect-error
@@ -1 +1 @@
1
- {"version":3,"file":"graphQLPopulationPromise.js","names":["populate","recursivelyPopulateFieldsForGraphQL","uploadPopulationPromiseHOC","props","context","currentDepth","depth","draft","editorPopulationPromises","field","fieldPromises","findMany","flattenLocales","node","overrideAccess","parentIsLocalized","populationPromises","req","showHiddenFields","value","collection","payload","collections","relationTo","id","populateDepth","maxDepth","undefined","push","collectionSlug","config","slug","data","key","collectionFieldSchema","fields","Array","isArray","length","localized","siblingDoc"],"sources":["../../../../src/features/upload/server/graphQLPopulationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../../typesServer.js'\nimport type { UploadFeatureProps } from './index.js'\nimport type { SerializedUploadNode } from './schema.js'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { recursivelyPopulateFieldsForGraphQL } from '../../../populateGraphQL/recursivelyPopulateFieldsForGraphQL.js'\n\nexport const uploadPopulationPromiseHOC = (\n props?: UploadFeatureProps,\n): PopulationPromise<SerializedUploadNode> => {\n return ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (node?.value) {\n const collection = req.payload.collections[node?.relationTo]\n\n if (collection) {\n // @ts-expect-error\n const id = node?.value?.id || 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 showHiddenFields,\n }),\n )\n\n const collectionFieldSchema = props?.collections?.[node?.relationTo]?.fields\n\n if (Array.isArray(collectionFieldSchema)) {\n if (!collectionFieldSchema?.length) {\n return\n }\n recursivelyPopulateFieldsForGraphQL({\n context,\n currentDepth,\n data: node.fields || {},\n depth,\n parentIsLocalized: parentIsLocalized || field.localized || false,\n\n draft,\n editorPopulationPromises,\n fieldPromises,\n fields: collectionFieldSchema,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc: node.fields || {},\n })\n }\n }\n }\n }\n}\n"],"mappings":"AAIA,SAASA,QAAQ,QAAQ;AACzB,SAASC,mCAAmC,QAAQ;AAEpD,OAAO,MAAMC,0BAAA,GACXC,KAAA;EAEA,OAAO,CAAC;IACNC,OAAO;IACP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KAAA;YACAC,wBAAA;YACAE,aAAA;YACAyB,MAAA,EAAQD,qBAAA;YACRvB,QAAA;YACAC,cAAA;YACAE,cAAA;YACAE,kBAAA;YACAC,GAAA;YACAC,gBAAA;YACAsB,UAAA,EAAY3B,IAAA,CAAKsB,MAAM,IAAI,CAAC;UAC9B;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"graphQLPopulationPromise.js","names":["populate","recursivelyPopulateFieldsForGraphQL","uploadPopulationPromiseHOC","props","context","currentDepth","depth","draft","editorPopulationPromises","field","fieldPromises","findMany","flattenLocales","node","overrideAccess","parentIsLocalized","populationPromises","req","showHiddenFields","value","enabledCollectionSlugs","includes","relationTo","collection","payload","collections","id","populateDepth","maxDepth","undefined","push","collectionSlug","config","slug","data","key","collectionFieldSchema","fields","Array","isArray","length","localized","siblingDoc"],"sources":["../../../../src/features/upload/server/graphQLPopulationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../../typesServer.js'\nimport type { UploadFeatureServerProps } from './index.js'\nimport type { SerializedUploadNode } from './schema.js'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { recursivelyPopulateFieldsForGraphQL } from '../../../populateGraphQL/recursivelyPopulateFieldsForGraphQL.js'\n\nexport const uploadPopulationPromiseHOC = (\n props: UploadFeatureServerProps,\n): PopulationPromise<SerializedUploadNode> => {\n return ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (node?.value && props.enabledCollectionSlugs.includes(node.relationTo)) {\n const collection = req.payload.collections[node?.relationTo]\n\n if (collection) {\n // @ts-expect-error\n const id = node?.value?.id || 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 showHiddenFields,\n }),\n )\n\n const collectionFieldSchema = props?.collections?.[node?.relationTo]?.fields\n\n if (Array.isArray(collectionFieldSchema)) {\n if (!collectionFieldSchema?.length) {\n return\n }\n recursivelyPopulateFieldsForGraphQL({\n context,\n currentDepth,\n data: node.fields || {},\n depth,\n parentIsLocalized: parentIsLocalized || field.localized || false,\n\n draft,\n editorPopulationPromises,\n fieldPromises,\n fields: collectionFieldSchema,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc: node.fields || {},\n })\n }\n }\n }\n }\n}\n"],"mappings":"AAIA,SAASA,QAAQ,QAAQ;AACzB,SAASC,mCAAmC,QAAQ;AAEpD,OAAO,MAAMC,0BAAA,GACXC,KAAA;EAEA,OAAO,CAAC;IACNC,OAAO;IACPC,YAAY;IACZC,KAAK;IACLC,KAAK;IACLC,wBAAwB;IACxBC,KAAK;IACLC,aAAa;IACbC,QAAQ;IACRC,cAAc;IACdC,IAAI;IACJC,cAAc;IACdC,iBAAiB;IACjBC,kBAAkB;IAClBC,GAAG;IACHC;EAAgB,CACjB;IACC,IAAIL,IAAA,EAAMM,KAAA,IAAShB,KAAA,CAAMiB,sBAAsB,CAACC,QAAQ,CAACR,IAAA,CAAKS,UAAU,GAAG;MACzE,MAAMC,UAAA,GAAaN,GAAA,CAAIO,OAAO,CAACC,WAAW,CAACZ,IAAA,EAAMS,UAAA,CAAW;MAE5D,IAAIC,UAAA,EAAY;QACd;QACA,MAAMG,EAAA,GAAKb,IAAA,EAAMM,KAAA,EAAOO,EAAA,IAAMb,IAAA,EAAMM,KAAA,CAAM;AAAA;QAE1C,MAAMQ,aAAA,GACJxB,KAAA,EAAOyB,QAAA,KAAaC,SAAA,IAAa1B,KAAA,EAAOyB,QAAA,GAAWtB,KAAA,GAAQH,KAAA,EAAOyB,QAAA,GAAWtB,KAAA;QAE/EU,kBAAA,CAAmBc,IAAI,CACrB9B,QAAA,CAAS;UACP0B,EAAA;UACAK,cAAA,EAAgBR,UAAA,CAAWS,MAAM,CAACC,IAAI;UACtC5B,YAAA;UACA6B,IAAA,EAAMrB,IAAA;UACNP,KAAA,EAAOqB,aAAA;UACPpB,KAAA;UACA4B,GAAA,EAAK;UACLrB,cAAA;UACAG,GAAA;UACAC;QACF;QAGF,MAAMkB,qBAAA,GAAwBjC,KAAA,EAAOsB,WAAA,GAAcZ,IAAA,EAAMS,UAAA,CAAW,EAAEe,MAAA;QAEtE,IAAIC,KAAA,CAAMC,OAAO,CAACH,qBAAA,GAAwB;UACxC,IAAI,CAACA,qBAAA,EAAuBI,MAAA,EAAQ;YAClC;UACF;UACAvC,mCAAA,CAAoC;YAClCG,OAAA;YACAC,YAAA;YACA6B,IAAA,EAAMrB,IAAA,CAAKwB,MAAM,IAAI,CAAC;YACtB/B,KAAA;YACAS,iBAAA,EAAmBA,iBAAA,IAAqBN,KAAA,CAAMgC,SAAS,IAAI;YAE3DlC,KAAA;YACAC,wBAAA;YACAE,aAAA;YACA2B,MAAA,EAAQD,qBAAA;YACRzB,QAAA;YACAC,cAAA;YACAE,cAAA;YACAE,kBAAA;YACAC,GAAA;YACAC,gBAAA;YACAwB,UAAA,EAAY7B,IAAA,CAAKwB,MAAM,IAAI,CAAC;UAC9B;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { Field, UploadCollectionSlug } from 'payload';
1
+ import type { CollectionSlug, Field, UploadCollectionSlug } from 'payload';
2
2
  import type { UploadFeaturePropsClient } from '../client/index.js';
3
3
  export type { Internal_UploadData, SerializedUploadNode, UploadData, UploadDataImproved, } from './schema.js';
4
4
  export type ExclusiveUploadFeatureProps = {
@@ -30,5 +30,9 @@ export type UploadFeatureProps = {
30
30
  */
31
31
  maxDepth?: number;
32
32
  } & ExclusiveUploadFeatureProps;
33
- export declare const UploadFeature: import("../../typesServer.js").FeatureProviderProviderServer<UploadFeatureProps, UploadFeatureProps, UploadFeaturePropsClient>;
33
+ export type UploadFeatureServerProps = {
34
+ /** Collection policy resolved during feature initialization. */
35
+ enabledCollectionSlugs: CollectionSlug[];
36
+ } & UploadFeatureProps;
37
+ export declare const UploadFeature: import("../../typesServer.js").FeatureProviderProviderServer<UploadFeatureProps, UploadFeatureServerProps, UploadFeaturePropsClient>;
34
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,KAAK,EAAkB,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAIlF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAYlE,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,UAAU,EACV,kBAAkB,GACnB,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,2BAA2B,GACnC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,oBAAoB,EAAE,CAAA;IAG5C,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,oBAAoB,EAAE,CAAA;CAC5C,CAAA;AAEL,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,CAAC,EAAE;QACZ,CAAC,UAAU,EAAE,oBAAoB,GAAG;YAClC,MAAM,EAAE,KAAK,EAAE,CAAA;SAChB,CAAA;KACF,CAAA;IACD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,2BAA2B,CAAA;AAE/B,eAAO,MAAM,aAAa,gIA0JxB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAU,KAAK,EAAkB,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAIlG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAalE,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,UAAU,EACV,kBAAkB,GACnB,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,2BAA2B,GACnC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,oBAAoB,EAAE,CAAA;IAG5C,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,oBAAoB,EAAE,CAAA;CAC5C,CAAA;AAEL,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,CAAC,EAAE;QACZ,CAAC,UAAU,EAAE,oBAAoB,GAAG;YAClC,MAAM,EAAE,KAAK,EAAE,CAAA;SAChB,CAAA;KACF,CAAA;IACD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,2BAA2B,CAAA;AAE/B,MAAM,MAAM,wBAAwB,GAAG;IACrC,gEAAgE;IAChE,sBAAsB,EAAE,cAAc,EAAE,CAAA;CACzC,GAAG,kBAAkB,CAAA;AAEtB,eAAO,MAAM,aAAa,sIA6JxB,CAAA"}
@@ -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,QAA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K,cAAA,EAAgB9C,UAAA,CAAWT,MAAM,CAACgB,IAAI;cACtC0B,YAAA;cACAc,IAAA,EAAM5B,IAAA;cACNe,KAAA,EAAOQ,aAAA;cACPP,KAAA;cACAa,GAAA,EAAK;cACLZ,cAAA;cACAhB,GAAA;cACA6B,MAAA,EACEZ,WAAA,GAAcrC,UAAA,CAAWT,MAAM,CAACgB,IAAI,CAAC,IAAIP,UAAA,CAAWT,MAAM,CAAC2D,eAAe;cAC5EX;YACF;YAGF,OAAOpB,IAAA;UACT;QAEJ;QACAgC,UAAA,EAAYhE,0BAAA,CAA2BQ,KAAA;QACvCwB,IAAA,EAAMjC,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,KAA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a,GAAA,EAAK;cACLZ,cAAA;cACAjB,GAAA;cACA8B,MAAA,EACEZ,WAAA,GAAcpC,UAAA,CAAWZ,MAAM,CAACU,IAAI,CAAC,IAAIE,UAAA,CAAWZ,MAAM,CAAC6D,eAAe;cAC5EX;YACF;YAGF,OAAOrB,IAAA;UACT;QAEJ;QACAiC,UAAA,EAAYlE,0BAAA,CAA2BQ,KAAA;QACvCyB,IAAA,EAAMlC,gBAAA;QACNoE,WAAA,EAAa,CAAClE,gBAAA,CAAiBO,KAAA;MACjC,GACD;MACD4D,2BAAA,EAA6B5D;IAC/B;EACF;EACAuD,GAAA,EAAK;AACP","ignoreList":[]}
@@ -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,6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