@payloadcms/richtext-lexical 3.0.0-canary.ff8c8fd → 3.0.0

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 (821) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts +12 -0
  3. package/dist/cell/rscEntry.d.ts.map +1 -0
  4. package/dist/cell/rscEntry.js +82 -0
  5. package/dist/cell/rscEntry.js.map +1 -0
  6. package/dist/exports/client/Field-KKSJXHR7.js +2 -0
  7. package/dist/exports/client/Field-KKSJXHR7.js.map +7 -0
  8. package/dist/exports/client/RelationshipComponent-2RT3YXUT.js +2 -0
  9. package/dist/exports/client/RelationshipComponent-2RT3YXUT.js.map +7 -0
  10. package/dist/exports/client/bundled.css +1 -1
  11. package/dist/exports/client/chunk-2CYU43GM.js +2 -0
  12. package/dist/exports/client/chunk-2CYU43GM.js.map +7 -0
  13. package/dist/exports/client/chunk-5PBXL4HT.js +2 -0
  14. package/dist/exports/client/chunk-5PBXL4HT.js.map +7 -0
  15. package/dist/exports/client/chunk-C7S3V4EB.js +2 -0
  16. package/dist/exports/client/chunk-C7S3V4EB.js.map +7 -0
  17. package/dist/exports/client/chunk-CUIBIFW2.js +2 -0
  18. package/dist/exports/client/chunk-CUIBIFW2.js.map +7 -0
  19. package/dist/exports/client/{chunk-UJDWBQ2K.js → chunk-MI5HS4QX.js} +2 -2
  20. package/dist/exports/client/{chunk-UJDWBQ2K.js.map → chunk-MI5HS4QX.js.map} +2 -2
  21. package/dist/exports/client/chunk-QPPOQTHD.js +2 -0
  22. package/dist/exports/client/chunk-QPPOQTHD.js.map +7 -0
  23. package/dist/exports/client/chunk-U7O7EYCP.js +2 -0
  24. package/dist/exports/client/chunk-U7O7EYCP.js.map +7 -0
  25. package/dist/exports/client/{chunk-V2LKLT2F.js → chunk-XCEM47RI.js} +3 -3
  26. package/dist/exports/client/{chunk-V2LKLT2F.js.map → chunk-XCEM47RI.js.map} +3 -3
  27. package/dist/exports/client/component-ANB7VZLA.js +2 -0
  28. package/dist/exports/client/component-ANB7VZLA.js.map +7 -0
  29. package/dist/exports/client/component-H3EYQ5KG.js +2 -0
  30. package/dist/exports/client/component-H3EYQ5KG.js.map +7 -0
  31. package/dist/exports/client/componentInline-ZGO3K4TA.js +2 -0
  32. package/dist/exports/client/componentInline-ZGO3K4TA.js.map +7 -0
  33. package/dist/exports/client/index.d.ts +10 -4
  34. package/dist/exports/client/index.d.ts.map +1 -1
  35. package/dist/exports/client/index.js +10 -8
  36. package/dist/exports/client/index.js.map +4 -4
  37. package/dist/exports/server/ast/mdx.d.ts +7 -0
  38. package/dist/exports/server/ast/mdx.d.ts.map +1 -0
  39. package/dist/exports/server/ast/mdx.js +37 -0
  40. package/dist/exports/server/ast/mdx.js.map +1 -0
  41. package/dist/exports/server/rsc.d.ts +3 -0
  42. package/dist/exports/server/rsc.d.ts.map +1 -0
  43. package/dist/exports/server/rsc.js +3 -0
  44. package/dist/exports/server/rsc.js.map +1 -0
  45. package/dist/exports/shared.d.ts +4 -0
  46. package/dist/exports/shared.d.ts.map +1 -0
  47. package/dist/exports/shared.js +4 -0
  48. package/dist/exports/shared.js.map +1 -0
  49. package/dist/features/align/client/index.d.ts +1 -4
  50. package/dist/features/align/client/index.d.ts.map +1 -1
  51. package/dist/features/blockquote/client/index.d.ts +1 -4
  52. package/dist/features/blockquote/client/index.d.ts.map +1 -1
  53. package/dist/features/blockquote/markdownTransformer.js.map +1 -1
  54. package/dist/features/blockquote/server/index.d.ts +1 -1
  55. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  56. package/dist/features/blockquote/server/index.js +5 -1
  57. package/dist/features/blockquote/server/index.js.map +1 -1
  58. package/dist/features/blocks/client/component/BlockContent.d.ts +34 -8
  59. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  60. package/dist/features/blocks/client/component/BlockContent.js +66 -170
  61. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  62. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts +11 -0
  63. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts.map +1 -0
  64. package/dist/features/blocks/client/component/components/BlockCollapsible.js +37 -0
  65. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -0
  66. package/dist/features/blocks/client/component/components/BlockEditButton.d.ts +3 -0
  67. package/dist/features/blocks/client/component/components/BlockEditButton.d.ts.map +1 -0
  68. package/dist/features/blocks/client/component/components/BlockEditButton.js +22 -0
  69. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -0
  70. package/dist/features/blocks/client/component/components/BlockRemoveButton.d.ts +3 -0
  71. package/dist/features/blocks/client/component/components/BlockRemoveButton.d.ts.map +1 -0
  72. package/dist/features/blocks/client/component/components/BlockRemoveButton.js +22 -0
  73. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -0
  74. package/dist/features/blocks/client/component/index.d.ts +1 -1
  75. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  76. package/dist/features/blocks/client/component/index.js +294 -93
  77. package/dist/features/blocks/client/component/index.js.map +1 -1
  78. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts +5 -0
  79. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -0
  80. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +28 -0
  81. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -0
  82. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.d.ts +3 -0
  83. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.d.ts.map +1 -0
  84. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +22 -0
  85. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -0
  86. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.d.ts +3 -0
  87. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.d.ts.map +1 -0
  88. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +22 -0
  89. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -0
  90. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.d.ts +3 -0
  91. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.d.ts.map +1 -0
  92. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +22 -0
  93. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -0
  94. package/dist/features/blocks/client/componentInline/index.d.ts +14 -2
  95. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  96. package/dist/features/blocks/client/componentInline/index.js +237 -63
  97. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  98. package/dist/features/blocks/client/index.d.ts +1 -8
  99. package/dist/features/blocks/client/index.d.ts.map +1 -1
  100. package/dist/features/blocks/client/index.js +140 -147
  101. package/dist/features/blocks/client/index.js.map +1 -1
  102. package/dist/features/blocks/client/markdownTransformer.d.ts +16 -0
  103. package/dist/features/blocks/client/markdownTransformer.d.ts.map +1 -0
  104. package/dist/features/blocks/client/markdownTransformer.js +144 -0
  105. package/dist/features/blocks/client/markdownTransformer.js.map +1 -0
  106. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  107. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  108. package/dist/features/blocks/client/nodes/BlocksNode.js +1 -3
  109. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  110. package/dist/features/blocks/client/plugin/commands.d.ts +0 -4
  111. package/dist/features/blocks/client/plugin/commands.d.ts.map +1 -1
  112. package/dist/features/blocks/client/plugin/commands.js +0 -1
  113. package/dist/features/blocks/client/plugin/commands.js.map +1 -1
  114. package/dist/features/blocks/client/plugin/index.d.ts +3 -4
  115. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  116. package/dist/features/blocks/client/plugin/index.js +25 -129
  117. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  118. package/dist/features/blocks/server/index.d.ts +1 -2
  119. package/dist/features/blocks/server/index.d.ts.map +1 -1
  120. package/dist/features/blocks/server/index.js +72 -35
  121. package/dist/features/blocks/server/index.js.map +1 -1
  122. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts +22 -0
  123. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts.map +1 -0
  124. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js +136 -0
  125. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js.map +1 -0
  126. package/dist/features/blocks/server/markdownTransformer.d.ts +22 -0
  127. package/dist/features/blocks/server/markdownTransformer.d.ts.map +1 -0
  128. package/dist/features/blocks/server/markdownTransformer.js +400 -0
  129. package/dist/features/blocks/server/markdownTransformer.js.map +1 -0
  130. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +11 -5
  131. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  132. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  133. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +3 -3
  134. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  135. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  136. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  137. package/dist/features/blocks/server/validate.js +8 -5
  138. package/dist/features/blocks/server/validate.js.map +1 -1
  139. package/dist/features/converters/html/converter/converters/paragraph.d.ts.map +1 -1
  140. package/dist/features/converters/html/converter/converters/paragraph.js +4 -0
  141. package/dist/features/converters/html/converter/converters/paragraph.js.map +1 -1
  142. package/dist/features/converters/html/converter/converters/text.d.ts.map +1 -1
  143. package/dist/features/converters/html/converter/converters/text.js +2 -1
  144. package/dist/features/converters/html/converter/converters/text.js.map +1 -1
  145. package/dist/features/converters/html/converter/index.d.ts +11 -7
  146. package/dist/features/converters/html/converter/index.d.ts.map +1 -1
  147. package/dist/features/converters/html/converter/index.js +17 -1
  148. package/dist/features/converters/html/converter/index.js.map +1 -1
  149. package/dist/features/converters/html/converter/types.d.ts +3 -1
  150. package/dist/features/converters/html/converter/types.d.ts.map +1 -1
  151. package/dist/features/converters/html/converter/types.js.map +1 -1
  152. package/dist/features/converters/html/field/index.d.ts.map +1 -1
  153. package/dist/features/converters/html/field/index.js +7 -1
  154. package/dist/features/converters/html/field/index.js.map +1 -1
  155. package/dist/features/debug/testRecorder/client/index.d.ts +1 -4
  156. package/dist/features/debug/testRecorder/client/index.d.ts.map +1 -1
  157. package/dist/features/debug/testRecorder/client/plugin/index.js +25 -14
  158. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  159. package/dist/features/debug/treeView/client/index.d.ts +1 -4
  160. package/dist/features/debug/treeView/client/index.d.ts.map +1 -1
  161. package/dist/features/experimental_table/client/index.d.ts +1 -1
  162. package/dist/features/experimental_table/client/index.d.ts.map +1 -1
  163. package/dist/features/experimental_table/client/index.js +2 -0
  164. package/dist/features/experimental_table/client/index.js.map +1 -1
  165. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  166. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +49 -51
  167. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  168. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  169. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +55 -42
  170. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  171. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts +1 -1
  172. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
  173. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +58 -19
  174. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  175. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
  176. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +52 -50
  177. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  178. package/dist/features/experimental_table/client/utils/debounce.js +4 -4
  179. package/dist/features/experimental_table/client/utils/debounce.js.map +1 -1
  180. package/dist/features/experimental_table/client/utils/useDebounce.js.map +1 -1
  181. package/dist/features/experimental_table/markdownTransformer.d.ts +5 -0
  182. package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -0
  183. package/dist/features/experimental_table/markdownTransformer.js +127 -0
  184. package/dist/features/experimental_table/markdownTransformer.js.map +1 -0
  185. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  186. package/dist/features/experimental_table/server/index.js +22 -4
  187. package/dist/features/experimental_table/server/index.js.map +1 -1
  188. package/dist/features/format/bold/feature.client.d.ts +1 -4
  189. package/dist/features/format/bold/feature.client.d.ts.map +1 -1
  190. package/dist/features/format/bold/feature.client.js +2 -1
  191. package/dist/features/format/bold/feature.client.js.map +1 -1
  192. package/dist/features/format/inlineCode/feature.client.d.ts +1 -4
  193. package/dist/features/format/inlineCode/feature.client.d.ts.map +1 -1
  194. package/dist/features/format/inlineCode/feature.client.js +2 -1
  195. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  196. package/dist/features/format/italic/feature.client.d.ts +1 -4
  197. package/dist/features/format/italic/feature.client.d.ts.map +1 -1
  198. package/dist/features/format/italic/feature.client.js +2 -1
  199. package/dist/features/format/italic/feature.client.js.map +1 -1
  200. package/dist/features/format/strikethrough/feature.client.d.ts +1 -4
  201. package/dist/features/format/strikethrough/feature.client.d.ts.map +1 -1
  202. package/dist/features/format/strikethrough/feature.client.js +2 -1
  203. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  204. package/dist/features/format/subscript/feature.client.d.ts +1 -4
  205. package/dist/features/format/subscript/feature.client.d.ts.map +1 -1
  206. package/dist/features/format/subscript/feature.client.js +2 -1
  207. package/dist/features/format/subscript/feature.client.js.map +1 -1
  208. package/dist/features/format/superscript/feature.client.d.ts +1 -4
  209. package/dist/features/format/superscript/feature.client.d.ts.map +1 -1
  210. package/dist/features/format/superscript/feature.client.js +2 -1
  211. package/dist/features/format/superscript/feature.client.js.map +1 -1
  212. package/dist/features/format/underline/feature.client.d.ts +1 -4
  213. package/dist/features/format/underline/feature.client.d.ts.map +1 -1
  214. package/dist/features/format/underline/feature.client.js +2 -1
  215. package/dist/features/format/underline/feature.client.js.map +1 -1
  216. package/dist/features/heading/client/index.d.ts +1 -4
  217. package/dist/features/heading/client/index.d.ts.map +1 -1
  218. package/dist/features/heading/server/index.d.ts.map +1 -1
  219. package/dist/features/heading/server/index.js +4 -0
  220. package/dist/features/heading/server/index.js.map +1 -1
  221. package/dist/features/horizontalRule/client/component/index.d.ts +1 -1
  222. package/dist/features/horizontalRule/client/component/index.d.ts.map +1 -1
  223. package/dist/features/horizontalRule/client/component/index.js +12 -9
  224. package/dist/features/horizontalRule/client/component/index.js.map +1 -1
  225. package/dist/features/horizontalRule/client/index.d.ts +1 -4
  226. package/dist/features/horizontalRule/client/index.d.ts.map +1 -1
  227. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +2 -2
  228. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  229. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  230. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  231. package/dist/features/indent/client/index.d.ts +1 -4
  232. package/dist/features/indent/client/index.d.ts.map +1 -1
  233. package/dist/features/indent/client/index.js +2 -1
  234. package/dist/features/indent/client/index.js.map +1 -1
  235. package/dist/features/link/client/index.d.ts +1 -13
  236. package/dist/features/link/client/index.d.ts.map +1 -1
  237. package/dist/features/link/client/index.js +2 -2
  238. package/dist/features/link/client/index.js.map +1 -1
  239. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  240. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  241. package/dist/features/link/client/plugins/autoLink/index.js +3 -1
  242. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  243. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  244. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +78 -40
  245. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  246. package/dist/features/link/client/plugins/floatingLinkEditor/index.d.ts.map +1 -1
  247. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +1 -1
  248. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  249. package/dist/features/link/nodes/AutoLinkNode.js +2 -2
  250. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  251. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  252. package/dist/features/link/nodes/LinkNode.js +12 -7
  253. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  254. package/dist/features/link/nodes/types.d.ts +3 -3
  255. package/dist/features/link/nodes/types.d.ts.map +1 -1
  256. package/dist/features/link/nodes/types.js.map +1 -1
  257. package/dist/features/link/server/baseFields.d.ts +1 -1
  258. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  259. package/dist/features/link/server/baseFields.js +15 -3
  260. package/dist/features/link/server/baseFields.js.map +1 -1
  261. package/dist/features/link/server/i18n.d.ts.map +1 -1
  262. package/dist/features/link/server/i18n.js +64 -32
  263. package/dist/features/link/server/i18n.js.map +1 -1
  264. package/dist/features/link/server/index.d.ts.map +1 -1
  265. package/dist/features/link/server/index.js +17 -4
  266. package/dist/features/link/server/index.js.map +1 -1
  267. package/dist/features/link/server/transformExtraFields.d.ts +1 -1
  268. package/dist/features/link/server/transformExtraFields.d.ts.map +1 -1
  269. package/dist/features/link/server/transformExtraFields.js.map +1 -1
  270. package/dist/features/link/server/validate.d.ts.map +1 -1
  271. package/dist/features/link/server/validate.js +8 -5
  272. package/dist/features/link/server/validate.js.map +1 -1
  273. package/dist/features/lists/checklist/client/index.d.ts +1 -4
  274. package/dist/features/lists/checklist/client/index.d.ts.map +1 -1
  275. package/dist/features/lists/htmlConverter.d.ts.map +1 -1
  276. package/dist/features/lists/htmlConverter.js +8 -0
  277. package/dist/features/lists/htmlConverter.js.map +1 -1
  278. package/dist/features/lists/orderedList/client/index.d.ts +1 -4
  279. package/dist/features/lists/orderedList/client/index.d.ts.map +1 -1
  280. package/dist/features/lists/shared/markdown.js.map +1 -1
  281. package/dist/features/lists/unorderedList/client/index.d.ts +1 -4
  282. package/dist/features/lists/unorderedList/client/index.d.ts.map +1 -1
  283. package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts.map +1 -1
  284. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +1 -0
  285. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +1 -1
  286. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts +1 -4
  287. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +1 -1
  288. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
  289. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  290. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  291. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +1 -1
  292. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +1 -1
  293. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +1 -1
  294. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +1 -1
  295. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +1 -1
  296. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +1 -1
  297. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +1 -1
  298. package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
  299. package/dist/features/migrations/slateToLexical/converter/index.js +1 -0
  300. package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
  301. package/dist/features/migrations/slateToLexical/feature.client.d.ts +1 -4
  302. package/dist/features/migrations/slateToLexical/feature.client.d.ts.map +1 -1
  303. package/dist/features/migrations/slateToLexical/feature.client.js +1 -3
  304. package/dist/features/migrations/slateToLexical/feature.client.js.map +1 -1
  305. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
  306. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  307. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  308. package/dist/features/paragraph/client/index.d.ts +1 -4
  309. package/dist/features/paragraph/client/index.d.ts.map +1 -1
  310. package/dist/features/paragraph/server/index.d.ts +1 -1
  311. package/dist/features/paragraph/server/index.d.ts.map +1 -1
  312. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  313. package/dist/features/relationship/client/components/RelationshipComponent.js +34 -24
  314. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  315. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  316. package/dist/features/relationship/client/drawer/index.js +27 -26
  317. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  318. package/dist/features/relationship/client/index.d.ts +2 -17
  319. package/dist/features/relationship/client/index.d.ts.map +1 -1
  320. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  321. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  322. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  323. package/dist/features/relationship/client/plugins/index.js +1 -1
  324. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  325. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +1 -1
  326. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
  327. package/dist/features/relationship/server/index.d.ts +1 -1
  328. package/dist/features/relationship/server/index.d.ts.map +1 -1
  329. package/dist/features/relationship/server/index.js +50 -40
  330. package/dist/features/relationship/server/index.js.map +1 -1
  331. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +2 -2
  332. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  333. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  334. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  335. package/dist/features/toolbars/fixed/client/Toolbar/index.js +93 -66
  336. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  337. package/dist/features/toolbars/fixed/client/index.d.ts +1 -4
  338. package/dist/features/toolbars/fixed/client/index.d.ts.map +1 -1
  339. package/dist/features/toolbars/inline/client/Toolbar/index.js +135 -97
  340. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  341. package/dist/features/toolbars/inline/client/index.d.ts +1 -4
  342. package/dist/features/toolbars/inline/client/index.d.ts.map +1 -1
  343. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  344. package/dist/features/toolbars/shared/ToolbarButton/index.js +5 -2
  345. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  346. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +5 -4
  347. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  348. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +24 -10
  349. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  350. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +4 -5
  351. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  352. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +127 -127
  353. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  354. package/dist/features/toolbars/types.d.ts +23 -11
  355. package/dist/features/toolbars/types.d.ts.map +1 -1
  356. package/dist/features/toolbars/types.js.map +1 -1
  357. package/dist/features/typesClient.d.ts +22 -30
  358. package/dist/features/typesClient.d.ts.map +1 -1
  359. package/dist/features/typesClient.js.map +1 -1
  360. package/dist/features/typesServer.d.ts +23 -28
  361. package/dist/features/typesServer.d.ts.map +1 -1
  362. package/dist/features/typesServer.js.map +1 -1
  363. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  364. package/dist/features/upload/client/component/index.js +66 -58
  365. package/dist/features/upload/client/component/index.js.map +1 -1
  366. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  367. package/dist/features/upload/client/drawer/index.js +34 -32
  368. package/dist/features/upload/client/drawer/index.js.map +1 -1
  369. package/dist/features/upload/client/feature.client.d.ts +1 -4
  370. package/dist/features/upload/client/feature.client.d.ts.map +1 -1
  371. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  372. package/dist/features/upload/client/nodes/UploadNode.js +1 -1
  373. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  374. package/dist/features/upload/client/plugin/index.js +1 -1
  375. package/dist/features/upload/client/plugin/index.js.map +1 -1
  376. package/dist/features/upload/server/feature.server.d.ts.map +1 -1
  377. package/dist/features/upload/server/feature.server.js +17 -8
  378. package/dist/features/upload/server/feature.server.js.map +1 -1
  379. package/dist/features/upload/server/validate.d.ts.map +1 -1
  380. package/dist/features/upload/server/validate.js +7 -4
  381. package/dist/features/upload/server/validate.js.map +1 -1
  382. package/dist/field/Field.d.ts.map +1 -1
  383. package/dist/field/Field.js +39 -65
  384. package/dist/field/Field.js.map +1 -1
  385. package/dist/field/bundled.css +1 -1
  386. package/dist/field/index.d.ts.map +1 -1
  387. package/dist/field/index.js +74 -74
  388. package/dist/field/index.js.map +1 -1
  389. package/dist/field/rscEntry.d.ts +9 -0
  390. package/dist/field/rscEntry.d.ts.map +1 -0
  391. package/dist/field/rscEntry.js +56 -0
  392. package/dist/field/rscEntry.js.map +1 -0
  393. package/dist/index.d.ts +8 -4
  394. package/dist/index.d.ts.map +1 -1
  395. package/dist/index.js +101 -105
  396. package/dist/index.js.map +1 -1
  397. package/dist/lexical/EditorPlugin.d.ts.map +1 -1
  398. package/dist/lexical/EditorPlugin.js +2 -1
  399. package/dist/lexical/EditorPlugin.js.map +1 -1
  400. package/dist/lexical/LexicalEditor.d.ts +1 -1
  401. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  402. package/dist/lexical/LexicalEditor.js +10 -10
  403. package/dist/lexical/LexicalEditor.js.map +1 -1
  404. package/dist/lexical/LexicalProvider.d.ts +2 -2
  405. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  406. package/dist/lexical/LexicalProvider.js +18 -25
  407. package/dist/lexical/LexicalProvider.js.map +1 -1
  408. package/dist/lexical/config/client/EditorConfigProvider.d.ts +6 -5
  409. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  410. package/dist/lexical/config/client/EditorConfigProvider.js +14 -13
  411. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  412. package/dist/lexical/config/client/loader.d.ts +5 -2
  413. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  414. package/dist/lexical/config/client/loader.js +12 -18
  415. package/dist/lexical/config/client/loader.js.map +1 -1
  416. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  417. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  418. package/dist/lexical/config/client/sanitize.js +19 -18
  419. package/dist/lexical/config/client/sanitize.js.map +1 -1
  420. package/dist/lexical/config/server/loader.d.ts +2 -1
  421. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  422. package/dist/lexical/config/server/loader.js +2 -0
  423. package/dist/lexical/config/server/loader.js.map +1 -1
  424. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  425. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  426. package/dist/lexical/config/server/sanitize.js +27 -13
  427. package/dist/lexical/config/server/sanitize.js.map +1 -1
  428. package/dist/lexical/config/types.d.ts +2 -2
  429. package/dist/lexical/config/types.d.ts.map +1 -1
  430. package/dist/lexical/config/types.js.map +1 -1
  431. package/dist/lexical/nodes/index.d.ts +4 -0
  432. package/dist/lexical/nodes/index.d.ts.map +1 -1
  433. package/dist/lexical/nodes/index.js +8 -1
  434. package/dist/lexical/nodes/index.js.map +1 -1
  435. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +6 -6
  436. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  437. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +19 -8
  438. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  439. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +2 -2
  440. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  441. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +7 -7
  442. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  443. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +3 -2
  444. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  445. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  446. package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  447. package/dist/lexical/plugins/SlashMenu/index.js +24 -30
  448. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  449. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
  450. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +11 -9
  451. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  452. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts +1 -1
  453. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  454. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js +1 -1
  455. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js.map +1 -1
  456. package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js +1 -1
  457. package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js.map +1 -1
  458. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  459. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +15 -8
  460. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  461. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts.map +1 -1
  462. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +9 -7
  463. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
  464. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts.map +1 -1
  465. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js +3 -1
  466. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -1
  467. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.d.ts.map +1 -1
  468. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js +3 -4
  469. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -1
  470. package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
  471. package/dist/lexical/theme/EditorTheme.js +1 -2
  472. package/dist/lexical/theme/EditorTheme.js.map +1 -1
  473. package/dist/lexical/utils/nodeFormat.d.ts +2 -2
  474. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  475. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  476. package/dist/lexical/utils/rect.d.ts +4 -4
  477. package/dist/lexical/utils/rect.d.ts.map +1 -1
  478. package/dist/lexical/utils/rect.js.map +1 -1
  479. package/dist/lexical/utils/setFloatingElemPosition.d.ts +1 -1
  480. package/dist/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
  481. package/dist/lexical/utils/setFloatingElemPosition.js.map +1 -1
  482. package/dist/lexical/utils/url.d.ts +5 -0
  483. package/dist/lexical/utils/url.d.ts.map +1 -1
  484. package/dist/lexical/utils/url.js +25 -5
  485. package/dist/lexical/utils/url.js.map +1 -1
  486. package/dist/lexical-proxy/@lexical-headless.d.ts +2 -0
  487. package/dist/lexical-proxy/@lexical-headless.d.ts.map +1 -0
  488. package/dist/lexical-proxy/@lexical-headless.js +2 -0
  489. package/dist/lexical-proxy/@lexical-headless.js.map +1 -0
  490. package/dist/lexical-proxy/@lexical-link.d.ts +2 -0
  491. package/dist/lexical-proxy/@lexical-link.d.ts.map +1 -0
  492. package/dist/lexical-proxy/@lexical-link.js +2 -0
  493. package/dist/lexical-proxy/@lexical-link.js.map +1 -0
  494. package/dist/lexical-proxy/@lexical-list.d.ts +2 -0
  495. package/dist/lexical-proxy/@lexical-list.d.ts.map +1 -0
  496. package/dist/lexical-proxy/@lexical-list.js +2 -0
  497. package/dist/lexical-proxy/@lexical-list.js.map +1 -0
  498. package/dist/lexical-proxy/@lexical-mark.d.ts +2 -0
  499. package/dist/lexical-proxy/@lexical-mark.d.ts.map +1 -0
  500. package/dist/lexical-proxy/@lexical-mark.js +2 -0
  501. package/dist/lexical-proxy/@lexical-mark.js.map +1 -0
  502. package/dist/lexical-proxy/@lexical-markdown.d.ts +2 -0
  503. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -0
  504. package/dist/lexical-proxy/@lexical-markdown.js +2 -0
  505. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -0
  506. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.d.ts +2 -0
  507. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.d.ts.map +1 -0
  508. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.js +2 -0
  509. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.js.map +1 -0
  510. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.d.ts +2 -0
  511. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.d.ts.map +1 -0
  512. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.js +2 -0
  513. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.js.map +1 -0
  514. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.d.ts +2 -0
  515. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.d.ts.map +1 -0
  516. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.js +2 -0
  517. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.js.map +1 -0
  518. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.d.ts +2 -0
  519. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.d.ts.map +1 -0
  520. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.js +2 -0
  521. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.js.map +1 -0
  522. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.d.ts +2 -0
  523. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.d.ts.map +1 -0
  524. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.js +2 -0
  525. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.js.map +1 -0
  526. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.d.ts +2 -0
  527. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.d.ts.map +1 -0
  528. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.js +2 -0
  529. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.js.map +1 -0
  530. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.d.ts +2 -0
  531. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.d.ts.map +1 -0
  532. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.js +2 -0
  533. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.js.map +1 -0
  534. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.d.ts +2 -0
  535. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.d.ts.map +1 -0
  536. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.js +2 -0
  537. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.js.map +1 -0
  538. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.d.ts +2 -0
  539. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.d.ts.map +1 -0
  540. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.js +2 -0
  541. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.js.map +1 -0
  542. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.d.ts +2 -0
  543. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.d.ts.map +1 -0
  544. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.js +2 -0
  545. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.js.map +1 -0
  546. package/dist/lexical-proxy/@lexical-react/LexicalComposer.d.ts +2 -0
  547. package/dist/lexical-proxy/@lexical-react/LexicalComposer.d.ts.map +1 -0
  548. package/dist/lexical-proxy/@lexical-react/LexicalComposer.js +2 -0
  549. package/dist/lexical-proxy/@lexical-react/LexicalComposer.js.map +1 -0
  550. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.d.ts +2 -0
  551. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.d.ts.map +1 -0
  552. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.js +2 -0
  553. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.js.map +1 -0
  554. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.d.ts +2 -0
  555. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.d.ts.map +1 -0
  556. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.js +2 -0
  557. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.js.map +1 -0
  558. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +2 -0
  559. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +1 -0
  560. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +2 -0
  561. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +1 -0
  562. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.d.ts +2 -0
  563. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.d.ts.map +1 -0
  564. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.js +2 -0
  565. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.js.map +1 -0
  566. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.d.ts +2 -0
  567. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.d.ts.map +1 -0
  568. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.js +2 -0
  569. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.js.map +1 -0
  570. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.d.ts +2 -0
  571. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.d.ts.map +1 -0
  572. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.js +2 -0
  573. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.js.map +1 -0
  574. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.d.ts +2 -0
  575. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.d.ts.map +1 -0
  576. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.js +2 -0
  577. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.js.map +1 -0
  578. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.d.ts +2 -0
  579. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.d.ts.map +1 -0
  580. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.js +2 -0
  581. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.js.map +1 -0
  582. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.d.ts +2 -0
  583. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.d.ts.map +1 -0
  584. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.js +2 -0
  585. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.js.map +1 -0
  586. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.d.ts +2 -0
  587. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.d.ts.map +1 -0
  588. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.js +2 -0
  589. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.js.map +1 -0
  590. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.d.ts +2 -0
  591. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.d.ts.map +1 -0
  592. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.js +2 -0
  593. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.js.map +1 -0
  594. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.d.ts +2 -0
  595. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.d.ts.map +1 -0
  596. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.js +2 -0
  597. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.js.map +1 -0
  598. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.d.ts +2 -0
  599. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.d.ts.map +1 -0
  600. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.js +2 -0
  601. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.js.map +1 -0
  602. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.d.ts +2 -0
  603. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.d.ts.map +1 -0
  604. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.js +2 -0
  605. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.js.map +1 -0
  606. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.d.ts +2 -0
  607. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.d.ts.map +1 -0
  608. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.js +2 -0
  609. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.js.map +1 -0
  610. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.d.ts +2 -0
  611. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.d.ts.map +1 -0
  612. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.js +2 -0
  613. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.js.map +1 -0
  614. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.d.ts +2 -0
  615. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.d.ts.map +1 -0
  616. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.js +2 -0
  617. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.js.map +1 -0
  618. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.d.ts +2 -0
  619. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.d.ts.map +1 -0
  620. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.js +2 -0
  621. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.js.map +1 -0
  622. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.d.ts +2 -0
  623. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.d.ts.map +1 -0
  624. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.js +2 -0
  625. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.js.map +1 -0
  626. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.d.ts +2 -0
  627. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.d.ts.map +1 -0
  628. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.js +2 -0
  629. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.js.map +1 -0
  630. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.d.ts +2 -0
  631. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.d.ts.map +1 -0
  632. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.js +2 -0
  633. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.js.map +1 -0
  634. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.d.ts +2 -0
  635. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.d.ts.map +1 -0
  636. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.js +2 -0
  637. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.js.map +1 -0
  638. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.d.ts +2 -0
  639. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.d.ts.map +1 -0
  640. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.js +2 -0
  641. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.js.map +1 -0
  642. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.d.ts +2 -0
  643. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.d.ts.map +1 -0
  644. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.js +2 -0
  645. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.js.map +1 -0
  646. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.d.ts +2 -0
  647. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.d.ts.map +1 -0
  648. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.js +2 -0
  649. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.js.map +1 -0
  650. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.d.ts +2 -0
  651. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.d.ts.map +1 -0
  652. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.js +2 -0
  653. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.js.map +1 -0
  654. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.d.ts +2 -0
  655. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.d.ts.map +1 -0
  656. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.js +2 -0
  657. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.js.map +1 -0
  658. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.d.ts +2 -0
  659. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.d.ts.map +1 -0
  660. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.js +2 -0
  661. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.js.map +1 -0
  662. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.d.ts +2 -0
  663. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.d.ts.map +1 -0
  664. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.js +2 -0
  665. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.js.map +1 -0
  666. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.d.ts +2 -0
  667. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.d.ts.map +1 -0
  668. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.js +2 -0
  669. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.js.map +1 -0
  670. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.d.ts +2 -0
  671. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.d.ts.map +1 -0
  672. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.js +2 -0
  673. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.js.map +1 -0
  674. package/dist/lexical-proxy/@lexical-rich-text.d.ts +2 -0
  675. package/dist/lexical-proxy/@lexical-rich-text.d.ts.map +1 -0
  676. package/dist/lexical-proxy/@lexical-rich-text.js +2 -0
  677. package/dist/lexical-proxy/@lexical-rich-text.js.map +1 -0
  678. package/dist/lexical-proxy/@lexical-selection.d.ts +2 -0
  679. package/dist/lexical-proxy/@lexical-selection.d.ts.map +1 -0
  680. package/dist/lexical-proxy/@lexical-selection.js +2 -0
  681. package/dist/lexical-proxy/@lexical-selection.js.map +1 -0
  682. package/dist/lexical-proxy/@lexical-utils.d.ts +2 -0
  683. package/dist/lexical-proxy/@lexical-utils.d.ts.map +1 -0
  684. package/dist/lexical-proxy/@lexical-utils.js +2 -0
  685. package/dist/lexical-proxy/@lexical-utils.js.map +1 -0
  686. package/dist/lexical-proxy/lexical.d.ts +2 -0
  687. package/dist/lexical-proxy/lexical.d.ts.map +1 -0
  688. package/dist/lexical-proxy/lexical.js +2 -0
  689. package/dist/lexical-proxy/lexical.js.map +1 -0
  690. package/dist/populateGraphQL/populate.d.ts +3 -2
  691. package/dist/populateGraphQL/populate.d.ts.map +1 -1
  692. package/dist/populateGraphQL/populate.js +3 -1
  693. package/dist/populateGraphQL/populate.js.map +1 -1
  694. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
  695. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  696. package/dist/populateGraphQL/populateLexicalPopulationPromises.js +5 -4
  697. package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
  698. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js.map +1 -1
  699. package/dist/types.d.ts +23 -8
  700. package/dist/types.d.ts.map +1 -1
  701. package/dist/types.js.map +1 -1
  702. package/dist/utilities/buildInitialState.d.ts +27 -0
  703. package/dist/utilities/buildInitialState.d.ts.map +1 -0
  704. package/dist/utilities/buildInitialState.js +53 -0
  705. package/dist/utilities/buildInitialState.js.map +1 -0
  706. package/dist/utilities/createClientFeature.d.ts +8 -5
  707. package/dist/utilities/createClientFeature.d.ts.map +1 -1
  708. package/dist/utilities/createClientFeature.js +7 -4
  709. package/dist/utilities/createClientFeature.js.map +1 -1
  710. package/dist/utilities/createServerFeature.d.ts +1 -0
  711. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  712. package/dist/utilities/createServerFeature.js +2 -0
  713. package/dist/utilities/createServerFeature.js.map +1 -1
  714. package/dist/utilities/fieldsDrawer/Drawer.d.ts +1 -0
  715. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  716. package/dist/utilities/fieldsDrawer/Drawer.js +68 -27
  717. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  718. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  719. package/dist/utilities/fieldsDrawer/DrawerContent.js +102 -138
  720. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  721. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts +13 -0
  722. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -0
  723. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +129 -0
  724. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -0
  725. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts +10 -0
  726. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -0
  727. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js +136 -0
  728. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -0
  729. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts +16 -0
  730. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -0
  731. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +144 -0
  732. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -0
  733. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  734. package/dist/utilities/generateImportMap.js +2 -3
  735. package/dist/utilities/generateImportMap.js.map +1 -1
  736. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  737. package/dist/utilities/generateSchemaMap.js +13 -10
  738. package/dist/utilities/generateSchemaMap.js.map +1 -1
  739. package/dist/utilities/initLexicalFeatures.d.ts +18 -0
  740. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -0
  741. package/dist/utilities/initLexicalFeatures.js +96 -0
  742. package/dist/utilities/initLexicalFeatures.js.map +1 -0
  743. package/dist/utilities/jsx/collectTopLevelJSXInLines.d.ts +52 -0
  744. package/dist/utilities/jsx/collectTopLevelJSXInLines.d.ts.map +1 -0
  745. package/dist/utilities/jsx/collectTopLevelJSXInLines.js +79 -0
  746. package/dist/utilities/jsx/collectTopLevelJSXInLines.js.map +1 -0
  747. package/dist/utilities/jsx/extractPropsFromJSXPropsString.d.ts +12 -0
  748. package/dist/utilities/jsx/extractPropsFromJSXPropsString.d.ts.map +1 -0
  749. package/dist/utilities/jsx/extractPropsFromJSXPropsString.js +125 -0
  750. package/dist/utilities/jsx/extractPropsFromJSXPropsString.js.map +1 -0
  751. package/dist/utilities/jsx/jsx.d.ts +26 -0
  752. package/dist/utilities/jsx/jsx.d.ts.map +1 -0
  753. package/dist/utilities/jsx/jsx.js +105 -0
  754. package/dist/utilities/jsx/jsx.js.map +1 -0
  755. package/dist/utilities/jsx/jsx.spec.d.ts +2 -0
  756. package/dist/utilities/jsx/jsx.spec.d.ts.map +1 -0
  757. package/dist/utilities/jsx/jsx.spec.js +142 -0
  758. package/dist/utilities/jsx/jsx.spec.js.map +1 -0
  759. package/dist/utilities/jsx/lexicalMarkdownCopy.d.ts +11 -0
  760. package/dist/utilities/jsx/lexicalMarkdownCopy.d.ts.map +1 -0
  761. package/dist/utilities/jsx/lexicalMarkdownCopy.js +61 -0
  762. package/dist/utilities/jsx/lexicalMarkdownCopy.js.map +1 -0
  763. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +1 -1
  764. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +1 -1
  765. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +1 -1
  766. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
  767. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts +1 -1
  768. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  769. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +5 -1
  770. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  771. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  772. package/dist/utilities/useLexicalFeature.js +12 -4
  773. package/dist/utilities/useLexicalFeature.js.map +1 -1
  774. package/dist/validate/index.d.ts.map +1 -1
  775. package/dist/validate/index.js +2 -2
  776. package/dist/validate/index.js.map +1 -1
  777. package/dist/validate/validateNodes.d.ts +2 -2
  778. package/dist/validate/validateNodes.d.ts.map +1 -1
  779. package/dist/validate/validateNodes.js +4 -4
  780. package/dist/validate/validateNodes.js.map +1 -1
  781. package/package.json +332 -46
  782. package/dist/cell/index.d.ts +0 -9
  783. package/dist/cell/index.d.ts.map +0 -1
  784. package/dist/cell/index.js +0 -135
  785. package/dist/cell/index.js.map +0 -1
  786. package/dist/exports/client/Field-SUWHJ4HF.js +0 -2
  787. package/dist/exports/client/Field-SUWHJ4HF.js.map +0 -7
  788. package/dist/exports/client/RelationshipComponent-EZORSGUZ.js +0 -2
  789. package/dist/exports/client/RelationshipComponent-EZORSGUZ.js.map +0 -7
  790. package/dist/exports/client/chunk-OLSILJA6.js +0 -2
  791. package/dist/exports/client/chunk-OLSILJA6.js.map +0 -7
  792. package/dist/exports/client/chunk-TD7O23AB.js +0 -2
  793. package/dist/exports/client/chunk-TD7O23AB.js.map +0 -7
  794. package/dist/exports/client/chunk-YL453UOS.js +0 -2
  795. package/dist/exports/client/chunk-YL453UOS.js.map +0 -7
  796. package/dist/exports/client/chunk-YSI2QILQ.js +0 -2
  797. package/dist/exports/client/chunk-YSI2QILQ.js.map +0 -7
  798. package/dist/exports/client/component-2YLEVOFH.js +0 -2
  799. package/dist/exports/client/component-2YLEVOFH.js.map +0 -7
  800. package/dist/exports/client/component-7RAP75FW.js +0 -2
  801. package/dist/exports/client/component-7RAP75FW.js.map +0 -7
  802. package/dist/exports/client/component-LLWMZU6K.js +0 -2
  803. package/dist/exports/client/component-LLWMZU6K.js.map +0 -7
  804. package/dist/exports/client/componentInline-YSHGRL2J.js +0 -2
  805. package/dist/exports/client/componentInline-YSHGRL2J.js.map +0 -7
  806. package/dist/features/blocks/client/component/FormSavePlugin.d.ts +0 -11
  807. package/dist/features/blocks/client/component/FormSavePlugin.d.ts.map +0 -1
  808. package/dist/features/blocks/client/component/FormSavePlugin.js +0 -53
  809. package/dist/features/blocks/client/component/FormSavePlugin.js.map +0 -1
  810. package/dist/features/createClientComponent.d.ts +0 -7
  811. package/dist/features/createClientComponent.d.ts.map +0 -1
  812. package/dist/features/createClientComponent.js +0 -13
  813. package/dist/features/createClientComponent.js.map +0 -1
  814. package/dist/features/createFeaturePropComponent.d.ts +0 -6
  815. package/dist/features/createFeaturePropComponent.d.ts.map +0 -1
  816. package/dist/features/createFeaturePropComponent.js +0 -19
  817. package/dist/features/createFeaturePropComponent.js.map +0 -1
  818. package/dist/utilities/generateComponentMap.d.ts +0 -6
  819. package/dist/utilities/generateComponentMap.d.ts.map +0 -1
  820. package/dist/utilities/generateComponentMap.js +0 -99
  821. package/dist/utilities/generateComponentMap.js.map +0 -1
@@ -16,6 +16,7 @@ export const UploadFeature = createServerFeature({
16
16
  feature: async ({
17
17
  config: _config,
18
18
  isRoot,
19
+ parentIsLocalized,
19
20
  props
20
21
  }) => {
21
22
  if (!props) {
@@ -39,6 +40,7 @@ export const UploadFeature = createServerFeature({
39
40
  props.collections[collection].fields = await sanitizeFields({
40
41
  config: _config,
41
42
  fields: props.collections[collection].fields,
43
+ parentIsLocalized,
42
44
  requireFieldLevelRichTextEditor: isRoot,
43
45
  validRelationships
44
46
  });
@@ -50,11 +52,15 @@ export const UploadFeature = createServerFeature({
50
52
  generateSchemaMap: ({
51
53
  props
52
54
  }) => {
53
- if (!props?.collections) return null;
55
+ if (!props?.collections) {
56
+ return null;
57
+ }
54
58
  const schemaMap = new Map();
55
59
  for (const collection in props.collections) {
56
60
  if (props.collections[collection].fields?.length) {
57
- schemaMap.set(collection, props.collections[collection].fields);
61
+ schemaMap.set(collection, {
62
+ fields: props.collections[collection].fields
63
+ });
58
64
  }
59
65
  }
60
66
  return schemaMap;
@@ -64,24 +70,25 @@ export const UploadFeature = createServerFeature({
64
70
  converters: {
65
71
  html: {
66
72
  converter: async ({
73
+ currentDepth,
74
+ depth,
67
75
  draft,
68
76
  node,
69
77
  overrideAccess,
70
78
  req,
71
79
  showHiddenFields
72
80
  }) => {
73
- // @ts-expect-error
74
- const id = node?.value?.id || node?.value // for backwards-compatibility
75
- ;
81
+ // @ts-expect-error - for backwards-compatibility
82
+ const id = node?.value?.id || node?.value;
76
83
  if (req?.payload) {
77
84
  const uploadDocument = {};
78
85
  try {
79
86
  await populate({
80
87
  id,
81
88
  collectionSlug: node.relationTo,
82
- currentDepth: 0,
89
+ currentDepth,
83
90
  data: uploadDocument,
84
- depth: 1,
91
+ depth,
85
92
  draft,
86
93
  key: 'value',
87
94
  overrideAccess,
@@ -93,7 +100,7 @@ export const UploadFeature = createServerFeature({
93
100
  console.error('Lexical upload node HTML converter: error fetching upload file', ignored, 'Node:', node);
94
101
  return `<img />`;
95
102
  }
96
- const url = getAbsoluteURL(uploadDocument?.value?.url, req?.payload);
103
+ const url = getAbsoluteURL(uploadDocument?.value?.url ?? '', req?.payload);
97
104
  /**
98
105
  * If the upload is not an image, return a link to the upload
99
106
  */
@@ -167,6 +174,7 @@ export const UploadFeature = createServerFeature({
167
174
  draft,
168
175
  node,
169
176
  overrideAccess,
177
+ populateArg,
170
178
  populationPromises,
171
179
  req,
172
180
  showHiddenFields
@@ -192,6 +200,7 @@ export const UploadFeature = createServerFeature({
192
200
  key: 'value',
193
201
  overrideAccess,
194
202
  req,
203
+ select: populateArg?.[collection.config.slug] ?? collection.config.defaultPopulate,
195
204
  showHiddenFields
196
205
  }));
197
206
  return node;
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.js","names":["sanitizeFields","populate","createServerFeature","createNode","uploadPopulationPromiseHOC","i18n","UploadServerNode","uploadValidation","getAbsoluteURL","url","payload","startsWith","config","serverURL","UploadFeature","feature","_config","isRoot","props","collections","clientProps","collection","hasExtraFields","fields","length","validRelationships","map","c","slug","requireFieldLevelRichTextEditor","ClientFeature","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","nodes","converters","html","converter","draft","node","overrideAccess","req","showHiddenFields","id","value","uploadDocument","collectionSlug","relationTo","currentDepth","data","depth","key","ignored","console","error","mimeType","filename","sizes","Object","keys","width","height","pictureHTML","size","imageSize","filesize","imageSizeURL","nodeTypes","getType","getSubFields","allSubFields","concat","collectionFieldSchema","Array","isArray","getSubFieldsData","graphQLPopulationPromises","hooks","afterRead","populationPromises","populateDepth","maxDepth","undefined","push","validations","sanitizedServerFeatureProps"],"sources":["../../../../src/features/upload/server/feature.server.ts"],"sourcesContent":["import type {\n CollectionSlug,\n Config,\n Field,\n FileData,\n FileSize,\n Payload,\n TypeWithID,\n} from 'payload'\n\nimport { sanitizeFields } from 'payload'\n\nimport type { UploadFeaturePropsClient } from '../client/feature.client.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 { UploadServerNode } from './nodes/UploadNode.js'\nimport { uploadValidation } from './validate.js'\n\nexport type UploadFeatureProps = {\n collections?: {\n [collection: CollectionSlug]: {\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}\n\n/**\n * Get the absolute URL for an upload URL by potentially prepending the serverURL\n */\nfunction getAbsoluteURL(url: string, payload: Payload): string {\n return url?.startsWith('http') ? url : (payload?.config?.serverURL || '') + url\n}\n\nexport const UploadFeature = createServerFeature<\n UploadFeatureProps,\n UploadFeatureProps,\n UploadFeaturePropsClient\n>({\n feature: async ({ config: _config, isRoot, props }) => {\n if (!props) {\n props = { collections: {} }\n }\n\n const clientProps: UploadFeaturePropsClient = {\n collections: {},\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 collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n props.collections[collection].fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: props.collections[collection].fields,\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) return null\n\n const schemaMap = new Map<string, Field[]>()\n\n for (const collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n schemaMap.set(collection, props.collections[collection].fields)\n }\n }\n\n return schemaMap\n },\n i18n,\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ draft, node, overrideAccess, req, showHiddenFields }) => {\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n if (req?.payload) {\n const uploadDocument: {\n value?: FileData & TypeWithID\n } = {}\n\n try {\n await populate({\n id,\n collectionSlug: node.relationTo,\n currentDepth: 0,\n data: uploadDocument,\n depth: 1,\n draft,\n key: 'value',\n overrideAccess,\n req,\n showHiddenFields,\n })\n } catch (ignored) {\n // eslint-disable-next-line no-console\n console.error(\n 'Lexical upload node HTML converter: error fetching upload file',\n ignored,\n 'Node:',\n node,\n )\n return `<img />`\n }\n\n const url = getAbsoluteURL(uploadDocument?.value?.url, req?.payload)\n\n /**\n * If the upload is not an image, return a link to the upload\n */\n if (!uploadDocument?.value?.mimeType?.startsWith('image')) {\n return `<a href=\"${url}\" rel=\"noopener noreferrer\">${uploadDocument.value?.filename}</a>`\n }\n\n /**\n * If the upload is a simple image with no different sizes, return a simple img tag\n */\n if (\n !uploadDocument?.value?.sizes ||\n !Object.keys(uploadDocument?.value?.sizes).length\n ) {\n return `<img src=\"${url}\" alt=\"${uploadDocument?.value?.filename}\" width=\"${uploadDocument?.value?.width}\" height=\"${uploadDocument?.value?.height}\"/>`\n }\n\n /**\n * If the upload is an image with different sizes, return a picture element\n */\n let pictureHTML = '<picture>'\n\n // Iterate through each size in the data.sizes object\n for (const size in uploadDocument.value?.sizes) {\n const imageSize: {\n url?: string\n } & FileSize = uploadDocument.value?.sizes[size]\n\n // Skip if any property of the size object is null\n if (\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n const imageSizeURL = getAbsoluteURL(imageSize?.url, req?.payload)\n\n pictureHTML += `<source srcset=\"${imageSizeURL}\" media=\"(max-width: ${imageSize.width}px)\" type=\"${imageSize.mimeType}\">`\n }\n\n // Add the default img tag\n pictureHTML += `<img src=\"${url}\" alt=\"Image\" width=\"${uploadDocument.value?.width}\" height=\"${uploadDocument.value?.height}\">`\n pictureHTML += '</picture>'\n return pictureHTML\n } else {\n return `<img src=\"${id}\" />`\n }\n },\n nodeTypes: [UploadServerNode.getType()],\n },\n },\n getSubFields: ({ node, req }) => {\n if (!node) {\n let allSubFields: Field[] = []\n for (const collection in props?.collections) {\n allSubFields = allSubFields.concat(props?.collections?.[collection]?.fields)\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 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 // @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 return node\n },\n ],\n },\n node: UploadServerNode,\n validations: [uploadValidation(props)],\n }),\n ],\n sanitizedServerFeatureProps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EpC;QAAI,CAAE;UACzB,OAAOA,IAAA,EAAMlB,MAAA;QACf;QACAuD,yBAAA,EAA2B,CAAC1E,0BAAA,CAA2Bc,KAAA,EAAO;QAC9D6D,KAAA,EAAO;UACLC,SAAA,EAAW,CACT,CAAC;YACC9B,YAAY;YACZE,KAAK;YACLZ,KAAK;YACLC,IAAI;YACJC,cAAc;YACduC,kBAAkB;YAClBtC,GAAG;YACHC;UAAgB,CACjB;YACC,IAAI,CAACH,IAAA,EAAMK,KAAA,EAAO;cAChB,OAAOL,IAAA;YACT;YACA,MAAMpB,UAAA,GAAasB,GAAA,CAAIjC,OAAO,CAACS,WAAW,CAACsB,IAAA,EAAMQ,UAAA,CAAW;YAE5D,IAAI,CAAC5B,UAAA,EAAY;cACf,OAAOoB,IAAA;YACT;YACA;YACA,MAAMI,EAAA,GAAKJ,IAAA,EAAMK,KAAA,EAAOD,EAAA,IAAMJ,IAAA,EAAMK,KAAA,CAAM;YAAA;YAE1C,MAAMoC,aAAA,GACJhE,KAAA,EAAOiE,QAAA,KAAaC,SAAA,IAAalE,KAAA,EAAOiE,QAAA,GAAW/B,KAAA,GAAQlC,KAAA,EAAOiE,QAAA,GAAW/B,KAAA;YAE/E6B,kBAAA,CAAmBI,IAAI,CACrBpF,QAAA,CAAS;cACP4C,EAAA;cACAG,cAAA,EAAgB3B,UAAA,CAAWT,MAAM,CAACgB,IAAI;cACtCsB,YAAA;cACAC,IAAA,EAAMV,IAAA;cACNW,KAAA,EAAO8B,aAAA;cACP1C,KAAA;cACAa,GAAA,EAAK;cACLX,cAAA;cACAC,GAAA;cACAC;YACF;YAGF,OAAOH,IAAA;UACT;QAEJ;QACAA,IAAA,EAAMnC,gBAAA;QACNgF,WAAA,EAAa,CAAC/E,gBAAA,CAAiBW,KAAA;MACjC,GACD;MACDqE,2BAAA,EAA6BrE;IAC/B;EACF;EACAmC,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"feature.server.js","names":["sanitizeFields","populate","createServerFeature","createNode","uploadPopulationPromiseHOC","i18n","UploadServerNode","uploadValidation","getAbsoluteURL","url","payload","startsWith","config","serverURL","UploadFeature","feature","_config","isRoot","parentIsLocalized","props","collections","clientProps","collection","hasExtraFields","fields","length","validRelationships","map","c","slug","requireFieldLevelRichTextEditor","ClientFeature","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","nodes","converters","html","converter","currentDepth","depth","draft","node","overrideAccess","req","showHiddenFields","id","value","uploadDocument","collectionSlug","relationTo","data","key","ignored","console","error","mimeType","filename","sizes","Object","keys","width","height","pictureHTML","size","imageSize","filesize","imageSizeURL","nodeTypes","getType","getSubFields","allSubFields","concat","collectionFieldSchema","Array","isArray","getSubFieldsData","graphQLPopulationPromises","hooks","afterRead","populateArg","populationPromises","populateDepth","maxDepth","undefined","push","select","defaultPopulate","validations","sanitizedServerFeatureProps"],"sources":["../../../../src/features/upload/server/feature.server.ts"],"sourcesContent":["import type {\n CollectionSlug,\n Config,\n Field,\n FieldSchemaMap,\n FileData,\n FileSize,\n Payload,\n TypeWithID,\n} from 'payload'\n\nimport { sanitizeFields } from 'payload'\n\nimport type { UploadFeaturePropsClient } from '../client/feature.client.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 { UploadServerNode } from './nodes/UploadNode.js'\nimport { uploadValidation } from './validate.js'\n\nexport type UploadFeatureProps = {\n collections?: {\n [collection: CollectionSlug]: {\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}\n\n/**\n * Get the absolute URL for an upload URL by potentially prepending the serverURL\n */\nfunction getAbsoluteURL(url: string, payload: Payload): string {\n return url?.startsWith('http') ? url : (payload?.config?.serverURL || '') + url\n}\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.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 collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n props.collections[collection].fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: props.collections[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 collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n schemaMap.set(collection, {\n fields: props.collections[collection].fields,\n })\n }\n }\n\n return schemaMap\n },\n i18n,\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n req,\n showHiddenFields,\n }) => {\n // @ts-expect-error - for backwards-compatibility\n const id = node?.value?.id || node?.value\n\n if (req?.payload) {\n const uploadDocument: {\n value?: FileData & TypeWithID\n } = {}\n\n try {\n await populate({\n id,\n collectionSlug: node.relationTo,\n currentDepth,\n data: uploadDocument,\n depth,\n draft,\n key: 'value',\n overrideAccess,\n req,\n showHiddenFields,\n })\n } catch (ignored) {\n // eslint-disable-next-line no-console\n console.error(\n 'Lexical upload node HTML converter: error fetching upload file',\n ignored,\n 'Node:',\n node,\n )\n return `<img />`\n }\n\n const url = getAbsoluteURL(uploadDocument?.value?.url ?? '', req?.payload)\n\n /**\n * If the upload is not an image, return a link to the upload\n */\n if (!uploadDocument?.value?.mimeType?.startsWith('image')) {\n return `<a href=\"${url}\" rel=\"noopener noreferrer\">${uploadDocument.value?.filename}</a>`\n }\n\n /**\n * If the upload is a simple image with no different sizes, return a simple img tag\n */\n if (\n !uploadDocument?.value?.sizes ||\n !Object.keys(uploadDocument?.value?.sizes).length\n ) {\n return `<img src=\"${url}\" alt=\"${uploadDocument?.value?.filename}\" width=\"${uploadDocument?.value?.width}\" height=\"${uploadDocument?.value?.height}\"/>`\n }\n\n /**\n * If the upload is an image with different sizes, return a picture element\n */\n let pictureHTML = '<picture>'\n\n // Iterate through each size in the data.sizes object\n for (const size in uploadDocument.value?.sizes) {\n const imageSize: {\n url?: string\n } & FileSize = uploadDocument.value?.sizes[size]\n\n // Skip if any property of the size object is null\n if (\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n const imageSizeURL = getAbsoluteURL(imageSize?.url, req?.payload)\n\n pictureHTML += `<source srcset=\"${imageSizeURL}\" media=\"(max-width: ${imageSize.width}px)\" type=\"${imageSize.mimeType}\">`\n }\n\n // Add the default img tag\n pictureHTML += `<img src=\"${url}\" alt=\"Image\" width=\"${uploadDocument.value?.width}\" height=\"${uploadDocument.value?.height}\">`\n pictureHTML += '</picture>'\n return pictureHTML\n } else {\n return `<img src=\"${id}\" />`\n }\n },\n nodeTypes: [UploadServerNode.getType()],\n },\n },\n getSubFields: ({ node, req }) => {\n if (!node) {\n let allSubFields: Field[] = []\n for (const collection in props?.collections) {\n allSubFields = allSubFields.concat(props?.collections?.[collection]?.fields)\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 // @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 select:\n populateArg?.[collection.config.slug] ?? collection.config.defaultPopulate,\n showHiddenFields,\n }),\n )\n\n return node\n },\n ],\n },\n node: UploadServerNode,\n validations: [uploadValidation(props)],\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'upload',\n})\n"],"mappings":"AAWA,SAASA,cAAc,QAAQ;AAI/B,SAASC,QAAQ,QAAQ;AACzB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,IAAI,QAAQ;AACrB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,gBAAgB,QAAQ;AAiBjC;;;AAGA,SAASC,eAAeC,GAAW,EAAEC,OAAgB;EACnD,OAAOD,GAAA,EAAKE,UAAA,CAAW,UAAUF,GAAA,GAAM,CAACC,OAAA,EAASE,MAAA,EAAQC,SAAA,IAAa,EAAC,IAAKJ,GAAA;AAC9E;AAEA,OAAO,MAAMK,aAAA,GAAgBZ,mBAAA,CAI3B;EACAa,OAAA,EAAS,MAAAA,CAAO;IAAEH,MAAA,EAAQI,OAAO;IAAEC,MAAM;IAAEC,iBAAiB;IAAEC;EAAK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,IAAA,EAAMK,KAAA,EAAOD,EAAA,IAAMJ,IAAA,EAAMK,KAAA,CAAM;YAAA;YAE1C,MAAMmC,aAAA,GACJjE,KAAA,EAAOkE,QAAA,KAAaC,SAAA,IAAanE,KAAA,EAAOkE,QAAA,GAAW3C,KAAA,GAAQvB,KAAA,EAAOkE,QAAA,GAAW3C,KAAA;YAE/EyC,kBAAA,CAAmBI,IAAI,CACrBtF,QAAA,CAAS;cACP+C,EAAA;cACAG,cAAA,EAAgB7B,UAAA,CAAWV,MAAM,CAACiB,IAAI;cACtCY,YAAA;cACAY,IAAA,EAAMT,IAAA;cACNF,KAAA,EAAO0C,aAAA;cACPzC,KAAA;cACAW,GAAA,EAAK;cACLT,cAAA;cACAC,GAAA;cACA0C,MAAA,EACEN,WAAA,GAAc5D,UAAA,CAAWV,MAAM,CAACiB,IAAI,CAAC,IAAIP,UAAA,CAAWV,MAAM,CAAC6E,eAAe;cAC5E1C;YACF;YAGF,OAAOH,IAAA;UACT;QAEJ;QACAA,IAAA,EAAMtC,gBAAA;QACNoF,WAAA,EAAa,CAACnF,gBAAA,CAAiBY,KAAA;MACjC,GACD;MACDwE,2BAAA,EAA6BxE;IAC/B;EACF;EACAmC,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAEjE,eAAO,MAAM,gBAAgB,UACpB,kBAAkB,KACxB,cAAc,CAAC,oBAAoB,CA2DrC,CAAA"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAEjE,eAAO,MAAM,gBAAgB,UACpB,kBAAkB,KACxB,cAAc,CAAC,oBAAoB,CA8DrC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { buildStateFromSchema } from '@payloadcms/ui/forms/buildStateFromSchema';
1
+ import { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState';
2
2
  import { isValidID } from 'payload';
3
3
  export const uploadValidation = props => {
4
4
  return async ({
@@ -33,15 +33,18 @@ export const uploadValidation = props => {
33
33
  if (!collection?.fields?.length) {
34
34
  return true;
35
35
  }
36
- const result = await buildStateFromSchema({
36
+ const result = await fieldSchemasToFormState({
37
37
  id,
38
38
  collectionSlug: node.relationTo,
39
39
  data: node?.fields ?? {},
40
- fieldSchema: collection.fields,
40
+ fields: collection.fields,
41
+ fieldSchemaMap: undefined,
41
42
  operation: operation === 'create' || operation === 'update' ? operation : 'update',
43
+ permissions: {},
42
44
  preferences,
45
+ renderAllFields: false,
43
46
  req,
44
- siblingData: node?.fields ?? {}
47
+ schemaPath: ''
45
48
  });
46
49
  let errorPaths = [];
47
50
  for (const fieldKey in result) {
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","names":["buildStateFromSchema","isValidID","uploadValidation","props","node","validation","options","id","operation","preferences","req","payload","t","idType","collections","relationTo","customIDType","db","defaultIDType","nodeID","value","Object","keys","length","collection","fields","result","collectionSlug","data","fieldSchema","siblingData","errorPaths","fieldKey","concat","join"],"sources":["../../../../src/features/upload/server/validate.ts"],"sourcesContent":["import { buildStateFromSchema } from '@payloadcms/ui/forms/buildStateFromSchema'\nimport { isValidID } from 'payload'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { UploadFeatureProps } from './feature.server.js'\nimport type { SerializedUploadNode } from './nodes/UploadNode.js'\n\nexport const uploadValidation = (\n props: UploadFeatureProps,\n): NodeValidation<SerializedUploadNode> => {\n return async ({\n node,\n validation: {\n options: {\n id,\n operation,\n preferences,\n req,\n req: { payload, t },\n },\n },\n }) => {\n const idType = payload.collections[node.relationTo].customIDType || payload.db.defaultIDType\n // @ts-expect-error\n const nodeID = node?.value?.id || node?.value // for backwards-compatibility\n\n if (!isValidID(nodeID, idType)) {\n return t('validation:validUploadID')\n }\n\n if (!props?.collections) {\n return true\n }\n\n if (Object.keys(props?.collections).length === 0) {\n return true\n }\n\n const collection = props?.collections[node.relationTo]\n\n if (!collection?.fields?.length) {\n return true\n }\n\n const result = await buildStateFromSchema({\n id,\n collectionSlug: node.relationTo,\n data: node?.fields ?? {},\n fieldSchema: collection.fields,\n operation: operation === 'create' || operation === 'update' ? operation : 'update',\n preferences,\n req,\n siblingData: node?.fields ?? {},\n })\n\n let errorPaths = []\n for (const fieldKey in result) {\n if (result[fieldKey].errorPaths) {\n errorPaths = errorPaths.concat(result[fieldKey].errorPaths)\n }\n }\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,SAAS,QAAQ;AAM1B,OAAO,MAAMC,gBAAA,GACXC,KAAA;EAEA,OAAO,OAAO;IACZC,IAAI;IACJC,UAAA,EAAY;MACVC,OAAA,EAAS;QACPC,EAAE;QACFC,SAAS;QACTC,WAAW;QACXC,GAAG;QACHA,GAAA,EAAK;UAAEC,OAAO;UAAEC;QAAC;MAAE;IACpB;EACF,CACF;IACC,MAAMC,MAAA,GAASF,OAAA,CAAQG,WAAW,CAACV,IAAA,CAAKW,UAAU,CAAC,CAACC,YAAY,IAAIL,OAAA,CAAQM,EAAE,CAACC,aAAa;IAC5F;IACA,MAAMC,MAAA,GAASf,IAAA,EAAMgB,KAAA,EAAOb,EAAA,IAAMH,IAAA,EAAMgB,KAAA,CAAM;IAAA;IAE9C,IAAI,CAACnB,SAAA,CAAUkB,MAAA,EAAQN,MAAA,GAAS;MAC9B,OAAOD,CAAA,CAAE;IACX;IAEA,IAAI,CAACT,KAAA,EAAOW,WAAA,EAAa;MACvB,OAAO;IACT;IAEA,IAAIO,MAAA,CAAOC,IAAI,CAACnB,KAAA,EAAOW,WAAA,EAAaS,MAAM,KAAK,GAAG;MAChD,OAAO;IACT;IAEA,MAAMC,UAAA,GAAarB,KAAA,EAAOW,WAAW,CAACV,IAAA,CAAKW,UAAU,CAAC;IAEtD,IAAI,CAACS,UAAA,EAAYC,MAAA,EAAQF,MAAA,EAAQ;MAC/B,OAAO;IACT;IAEA,MAAMG,MAAA,GAAS,MAAM1B,oBAAA,CAAqB;MACxCO,EAAA;MACAoB,cAAA,EAAgBvB,IAAA,CAAKW,UAAU;MAC/Ba,IAAA,EAAMxB,IAAA,EAAMqB,MAAA,IAAU,CAAC;MACvBI,WAAA,EAAaL,UAAA,CAAWC,MAAM;MAC9BjB,SAAA,EAAWA,SAAA,KAAc,YAAYA,SAAA,KAAc,WAAWA,SAAA,GAAY;MAC1EC,WAAA;MACAC,GAAA;MACAoB,WAAA,EAAa1B,IAAA,EAAMqB,MAAA,IAAU,CAAC;IAChC;IAEA,IAAIM,UAAA,GAAa,EAAE;IACnB,KAAK,MAAMC,QAAA,IAAYN,MAAA,EAAQ;MAC7B,IAAIA,MAAM,CAACM,QAAA,CAAS,CAACD,UAAU,EAAE;QAC/BA,UAAA,GAAaA,UAAA,CAAWE,MAAM,CAACP,MAAM,CAACM,QAAA,CAAS,CAACD,UAAU;MAC5D;IACF;IAEA,IAAIA,UAAA,CAAWR,MAAM,EAAE;MACrB,OAAO,uCAAuCQ,UAAA,CAAWG,IAAI,CAAC;IAChE;IAEA,OAAO;EACT;AACF","ignoreList":[]}
1
+ {"version":3,"file":"validate.js","names":["fieldSchemasToFormState","isValidID","uploadValidation","props","node","validation","options","id","operation","preferences","req","payload","t","idType","collections","relationTo","customIDType","db","defaultIDType","nodeID","value","Object","keys","length","collection","fields","result","collectionSlug","data","fieldSchemaMap","undefined","permissions","renderAllFields","schemaPath","errorPaths","fieldKey","concat","join"],"sources":["../../../../src/features/upload/server/validate.ts"],"sourcesContent":["import { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\nimport { isValidID } from 'payload'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { UploadFeatureProps } from './feature.server.js'\nimport type { SerializedUploadNode } from './nodes/UploadNode.js'\n\nexport const uploadValidation = (\n props: UploadFeatureProps,\n): NodeValidation<SerializedUploadNode> => {\n return async ({\n node,\n validation: {\n options: {\n id,\n operation,\n preferences,\n req,\n req: { payload, t },\n },\n },\n }) => {\n const idType = payload.collections[node.relationTo].customIDType || payload.db.defaultIDType\n // @ts-expect-error\n const nodeID = node?.value?.id || node?.value // for backwards-compatibility\n\n if (!isValidID(nodeID, idType)) {\n return t('validation:validUploadID')\n }\n\n if (!props?.collections) {\n return true\n }\n\n if (Object.keys(props?.collections).length === 0) {\n return true\n }\n\n const collection = props?.collections[node.relationTo]\n\n if (!collection?.fields?.length) {\n return true\n }\n\n const result = await fieldSchemasToFormState({\n id,\n collectionSlug: node.relationTo,\n data: node?.fields ?? {},\n fields: collection.fields,\n fieldSchemaMap: undefined,\n operation: operation === 'create' || operation === 'update' ? operation : 'update',\n permissions: {},\n preferences,\n renderAllFields: false,\n req,\n schemaPath: '',\n })\n\n let errorPaths: string[] = []\n for (const fieldKey in result) {\n if (result[fieldKey].errorPaths) {\n errorPaths = errorPaths.concat(result[fieldKey].errorPaths)\n }\n }\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ;AACxC,SAASC,SAAS,QAAQ;AAM1B,OAAO,MAAMC,gBAAA,GACXC,KAAA;EAEA,OAAO,OAAO;IACZC,IAAI;IACJC,UAAA,EAAY;MACVC,OAAA,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AQ;MAC7B,IAAIA,MAAM,CAACS,QAAA,CAAS,CAACD,UAAU,EAAE;QAC/BA,UAAA,GAAaA,UAAA,CAAWE,MAAM,CAACV,MAAM,CAACS,QAAA,CAAS,CAACD,UAAU;MAC5D;IACF;IAEA,IAAIA,UAAA,CAAWX,MAAM,EAAE;MACrB,OAAO,uCAAuCW,UAAA,CAAWG,IAAI,CAAC;IAChE;IAEA,OAAO;EACT;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAG1C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAG5D,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AACrB,OAAO,mCAAmC,CAAA;AAI1C,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,CA8G9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAoD,CAAA"}
1
+ {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAGnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAG5D,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AACrB,OAAO,mCAAmC,CAAA;AAI1C,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,CA8F9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAoD,CAAA"}
@@ -1,45 +1,38 @@
1
1
  'use client';
2
2
 
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- import { FieldDescription, FieldError, FieldLabel, useField, useFieldProps, withCondition } from '@payloadcms/ui';
5
- import React, { useCallback } from 'react';
4
+ import { FieldLabel, useEditDepth, useField, withCondition } from '@payloadcms/ui';
5
+ import { mergeFieldStyles } from '@payloadcms/ui/shared';
6
+ import React, { useCallback, useMemo } from 'react';
6
7
  import { ErrorBoundary } from 'react-error-boundary';
7
8
  import { LexicalProvider } from '../lexical/LexicalProvider.js';
8
9
  import './bundled.css';
9
10
  const baseClass = 'rich-text-lexical';
10
11
  const RichTextComponent = props => {
11
12
  const {
12
- descriptionProps,
13
13
  editorConfig,
14
- errorProps,
14
+ field,
15
15
  field: {
16
16
  name,
17
- _path: pathFromProps,
18
17
  admin: {
19
18
  className,
20
- components: {
21
- Description,
22
- Error,
23
- Label
24
- },
25
- readOnly: readOnlyFromAdmin,
26
- style,
27
- width
19
+ readOnly: readOnlyFromAdmin
28
20
  } = {},
29
21
  label,
22
+ localized,
30
23
  required
31
24
  },
32
- field,
33
- labelProps,
25
+ path: pathFromProps,
34
26
  readOnly: readOnlyFromTopLevelProps,
35
27
  validate
36
28
  } = props;
37
29
  const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin;
30
+ const path = pathFromProps ?? name;
31
+ const editDepth = useEditDepth();
38
32
  const memoizedValidate = useCallback((value, validationOptions) => {
39
33
  if (typeof validate === 'function') {
40
34
  return validate(value, {
41
35
  ...validationOptions,
42
- props,
43
36
  required
44
37
  });
45
38
  }
@@ -49,76 +42,57 @@ const RichTextComponent = props => {
49
42
  // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709
50
43
  [validate, required]);
51
44
  const {
52
- path: pathFromContext,
53
- readOnly: readOnlyFromContext
54
- } = useFieldProps();
55
- const fieldType = useField({
56
- path: pathFromContext ?? pathFromProps ?? name,
57
- validate: memoizedValidate
58
- });
59
- const {
45
+ customComponents: {
46
+ AfterInput,
47
+ BeforeInput,
48
+ Description,
49
+ Error,
50
+ Label
51
+ } = {},
60
52
  formInitializing,
61
53
  formProcessing,
62
54
  initialValue,
63
- path,
64
55
  setValue,
65
56
  showError,
66
57
  value: value_0
67
- } = fieldType;
68
- const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing;
58
+ } = useField({
59
+ path,
60
+ // @ts-expect-error: TODO: Fix this
61
+ validate: memoizedValidate
62
+ });
63
+ const disabled = readOnlyFromProps || formProcessing || formInitializing;
69
64
  const classes = [baseClass, 'field-type', className, showError && 'error', disabled && `${baseClass}--read-only`, editorConfig?.admin?.hideGutter !== true ? `${baseClass}--show-gutter` : null].filter(Boolean).join(' ');
65
+ const pathWithEditDepth = `${path}.${editDepth}`;
66
+ const handleChange = useCallback(editorState => {
67
+ setValue(editorState.toJSON());
68
+ }, [setValue]);
69
+ const styles = useMemo(() => mergeFieldStyles(field), [field]);
70
70
  return /*#__PURE__*/_jsxs("div", {
71
71
  className: classes,
72
- style: {
73
- ...style,
74
- width
75
- },
76
- children: [/*#__PURE__*/_jsx(FieldError, {
77
- CustomError: Error,
78
- field: field,
79
- path: path,
80
- ...(errorProps || {}),
81
- alignCaret: "left"
82
- }), /*#__PURE__*/_jsx(FieldLabel, {
83
- Label: Label,
84
- field: field,
72
+ style: styles,
73
+ children: [Error, Label || /*#__PURE__*/_jsx(FieldLabel, {
85
74
  label: label,
86
- required: required,
87
- ...(labelProps || {})
75
+ localized: localized,
76
+ required: required
88
77
  }), /*#__PURE__*/_jsxs("div", {
89
78
  className: `${baseClass}__wrap`,
90
- children: [/*#__PURE__*/_jsx(ErrorBoundary, {
79
+ children: [/*#__PURE__*/_jsxs(ErrorBoundary, {
91
80
  fallbackRender: fallbackRender,
92
81
  onReset: () => {},
93
- children: /*#__PURE__*/_jsx(LexicalProvider, {
82
+ children: [BeforeInput, /*#__PURE__*/_jsx(LexicalProvider, {
83
+ composerKey: pathWithEditDepth,
94
84
  editorConfig: editorConfig,
95
- field: field,
96
- onChange: editorState => {
97
- let serializedEditorState = editorState.toJSON();
98
- // Transform state through save hooks
99
- if (editorConfig?.features?.hooks?.save?.length) {
100
- editorConfig.features.hooks.save.forEach(hook => {
101
- serializedEditorState = hook({
102
- incomingEditorState: serializedEditorState
103
- });
104
- });
105
- }
106
- setValue(serializedEditorState);
107
- },
108
- path: path,
85
+ fieldProps: props,
86
+ onChange: handleChange,
109
87
  readOnly: disabled,
110
88
  value: value_0
111
89
  }, JSON.stringify({
112
90
  initialValue,
113
91
  path
114
- }))
115
- }), /*#__PURE__*/_jsx(FieldDescription, {
116
- Description: Description,
117
- field: field,
118
- ...(descriptionProps || {})
119
- })]
92
+ })), AfterInput]
93
+ }), Description]
120
94
  })]
121
- }, path);
95
+ }, pathWithEditDepth);
122
96
  };
123
97
  function fallbackRender({
124
98
  error
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","names":["FieldDescription","FieldError","FieldLabel","useField","useFieldProps","withCondition","React","useCallback","ErrorBoundary","LexicalProvider","baseClass","RichTextComponent","props","descriptionProps","editorConfig","errorProps","field","name","_path","pathFromProps","admin","className","components","Description","Error","Label","readOnly","readOnlyFromAdmin","style","width","label","required","labelProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","memoizedValidate","value","validationOptions","path","pathFromContext","readOnlyFromContext","fieldType","formInitializing","formProcessing","initialValue","setValue","showError","disabled","classes","hideGutter","filter","Boolean","join","_jsxs","_jsx","CustomError","alignCaret","fallbackRender","onReset","onChange","editorState","serializedEditorState","toJSON","features","hooks","save","length","forEach","hook","incomingEditorState","JSON","stringify","error","role","color","message","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { SerializedEditorState } from 'lexical'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n useField,\n useFieldProps,\n withCondition,\n} from '@payloadcms/ui'\nimport React, { useCallback } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport './bundled.css'\nimport './index.scss'\nimport '../lexical/theme/EditorTheme.scss'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n descriptionProps,\n editorConfig,\n errorProps,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n className,\n components: { Description, Error, Label },\n readOnly: readOnlyFromAdmin,\n style,\n width,\n } = {},\n label,\n required,\n },\n field,\n labelProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const memoizedValidate = useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n return validate(value, { ...validationOptions, props, required })\n }\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const fieldType = useField<SerializedEditorState>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const { formInitializing, formProcessing, initialValue, path, setValue, showError, value } =\n fieldType\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true ? `${baseClass}--show-gutter` : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <div\n className={classes}\n key={path}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError\n CustomError={Error}\n field={field}\n path={path}\n {...(errorProps || {})}\n alignCaret=\"left\"\n />\n <FieldLabel\n Label={Label}\n field={field}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n <LexicalProvider\n editorConfig={editorConfig}\n field={field}\n key={JSON.stringify({ initialValue, path })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={(editorState) => {\n let serializedEditorState = editorState.toJSON()\n\n // Transform state through save hooks\n if (editorConfig?.features?.hooks?.save?.length) {\n editorConfig.features.hooks.save.forEach((hook) => {\n serializedEditorState = hook({ incomingEditorState: serializedEditorState })\n })\n }\n\n setValue(serializedEditorState)\n }}\n path={path}\n readOnly={disabled}\n value={value}\n />\n </ErrorBoundary>\n <FieldDescription Description={Description} field={field} {...(descriptionProps || {})} />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }): React.ReactElement {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = withCondition(RichTextComponent)\n"],"mappings":"AAAA;;;AAGA,SACEA,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,QAAQ,EACRC,aAAa,EACbC,aAAa,QACR;AACP,OAAOC,KAAA,IAASC,WAAW,QAAQ;AACnC,SAASC,aAAa,QAAQ;AAK9B,SAASC,eAAe,QAAQ;AAChC,OAAO;AAIP,MAAMC,SAAA,GAAY;AAElB,MAAMC,iBAAA,GAIDC,KAAA;EACH,MAAM;IACJC,gBAAgB;IAChBC,YAAY;IACZC,UAAU;IACVC,KAAA,EAAO;MACLC,IAAI;MACJC,KAAA,EAAOC,aAAa;MACp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AACvD,gBAAA;QAAiBuB,WAAA,EAAaA,WAAA;QAAaP,KAAA,EAAOA,KAAA;QAAQ,IAAIH,gBAAA,IAAoB,CAAC,CAAC;;;KA3ClF0B,IAAA;AA+CX;AAEA,SAASmB,eAAe;EAAEe;AAAK,CAAE;EAC/B;EAEA,oBACEnB,KAAA,CAAC;IAAIjC,SAAA,EAAU;IAAgBqD,IAAA,EAAK;4BAClCnB,IAAA,CAAC;gBAAE;qBACHA,IAAA,CAAC;MAAI3B,KAAA,EAAO;QAAE+C,KAAA,EAAO;MAAM;gBAAIF,KAAA,CAAMG;;;AAG3C;AAEA,OAAO,MAAMC,QAAA,GAAqCxE,aAAA,CAAcM,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"Field.js","names":["FieldLabel","useEditDepth","useField","withCondition","mergeFieldStyles","React","useCallback","useMemo","ErrorBoundary","LexicalProvider","baseClass","RichTextComponent","props","editorConfig","field","name","admin","className","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","editDepth","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","formInitializing","formProcessing","initialValue","setValue","showError","disabled","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","handleChange","editorState","toJSON","styles","_jsxs","style","_jsx","fallbackRender","onReset","composerKey","fieldProps","onChange","JSON","stringify","error","role","color","message","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\n\nimport { FieldLabel, useEditDepth, useField, withCondition } from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport React, { useCallback, useMemo } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport './bundled.css'\nimport './index.scss'\nimport '../lexical/theme/EditorTheme.scss'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n name,\n admin: { className, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n const path = pathFromProps ?? name\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n return validate(value, { ...validationOptions, required })\n }\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n formInitializing,\n formProcessing,\n initialValue,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n path,\n // @ts-expect-error: TODO: Fix this\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || formProcessing || formInitializing\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true ? `${baseClass}--show-gutter` : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n setValue(editorState.toJSON())\n },\n [setValue],\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div className={classes} key={pathWithEditDepth} style={styles}>\n {Error}\n {Label || <FieldLabel label={label} localized={localized} required={required} />}\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n key={JSON.stringify({ initialValue, path })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n {Description}\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }): React.ReactElement {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = withCondition(RichTextComponent)\n"],"mappings":"AAAA;;;AAGA,SAASA,UAAU,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,aAAa,QAAQ;AAClE,SAASC,gBAAgB,QAAQ;AACjC,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAC5C,SAASC,aAAa,QAAQ;AAK9B,SAASC,eAAe,QAAQ;AAChC,OAAO;AAIP,MAAMC,SAAA,GAAY;AAElB,MAAMC,iBAAA,GAIDC,KAAA;EACH,MAAM;IACJC,YAAY;IACZC,KAAK;IACLA,KAAA,EAAO;MACLC,IAAI;MACJC,KAAA,EAAO;QAAEC,SAAS;QAAEC,QAAA,EAAUC;MAAiB,CAAE,GAAG,CAAC,CAAC;MACtDC,KAAK;MACLC,SAAS;MACTC;IAAQ,CACT;IACDC,IAAA,EAAMC,aAAa;IACnBN,QAAA,EAAUO,yBAAyB;IACnCC;EAAQ,CACT,GAAGd,KAAA;EAEJ,MAAMe,iBAAA,GAAoBF,yBAAA,IAA6BN,iBAAA;EACvD,MAAMI,IAAA,GAAOC,aAAA,IAAiBT,IAAA;EAE9B,MAAMa,SAAA,GAAY3B,YAAA;EAElB,MAAM4B,gBAAA,GAAmBvB,WAAA,CACvB,C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