@payloadcms/richtext-lexical 4.0.0-internal.38b7f1d → 4.0.0-internal.5f0cd13

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 (532) hide show
  1. package/dist/cell/rscEntry.d.ts +1 -1
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js.map +1 -1
  4. package/dist/exports/client/{Field-PJW7KUJG.js → Field-G5Z2HM5Y.js} +2 -2
  5. package/dist/exports/client/Field-G5Z2HM5Y.js.map +7 -0
  6. package/dist/exports/client/{RelationshipComponent-5RONAYJM.js → RelationshipComponent-YCPAKOL7.js} +2 -2
  7. package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
  8. package/dist/exports/client/bundled.css +1 -1
  9. package/dist/exports/client/{chunk-QJ5EETIB.js → chunk-6QWQ7JV4.js} +2 -2
  10. package/dist/exports/client/{chunk-FTT5KJ6W.js → chunk-LH634DPU.js} +1 -1
  11. package/dist/exports/client/chunk-LH634DPU.js.map +7 -0
  12. package/dist/exports/client/{chunk-BZZVLW4U.js → chunk-RJ5MAOKZ.js} +1 -1
  13. package/dist/exports/client/chunk-RJ5MAOKZ.js.map +7 -0
  14. package/dist/exports/client/{chunk-44G3K3W7.js → chunk-UAKNDD6R.js} +2 -2
  15. package/dist/exports/client/chunk-UAKNDD6R.js.map +7 -0
  16. package/dist/exports/client/component-HKTAZ77E.js +2 -0
  17. package/dist/exports/client/component-HKTAZ77E.js.map +7 -0
  18. package/dist/exports/client/componentInline-D3A6OW76.js +2 -0
  19. package/dist/exports/client/index.js +16 -16
  20. package/dist/exports/client/index.js.map +4 -4
  21. package/dist/exports/react/index.d.ts +1 -1
  22. package/dist/exports/react/index.d.ts.map +1 -1
  23. package/dist/exports/react/index.js.map +1 -1
  24. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  25. package/dist/features/blockquote/server/index.d.ts +1 -4
  26. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  27. package/dist/features/blockquote/server/index.js +2 -0
  28. package/dist/features/blockquote/server/index.js.map +1 -1
  29. package/dist/features/blockquote/server/schema.d.ts +8 -0
  30. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  31. package/dist/features/blockquote/server/schema.js +15 -0
  32. package/dist/features/blockquote/server/schema.js.map +1 -0
  33. package/dist/features/blocks/client/component/index.d.ts +2 -2
  34. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  35. package/dist/features/blocks/client/component/index.js +2 -2
  36. package/dist/features/blocks/client/component/index.js.map +1 -1
  37. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
  38. package/dist/features/blocks/client/componentInline/index.d.ts +2 -2
  39. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  40. package/dist/features/blocks/client/componentInline/index.js +2 -2
  41. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  42. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  43. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  44. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  45. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  46. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  47. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  48. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -2
  49. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  50. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  51. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  52. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  53. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  54. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  55. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  56. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  57. package/dist/features/blocks/server/index.d.ts +1 -0
  58. package/dist/features/blocks/server/index.d.ts.map +1 -1
  59. package/dist/features/blocks/server/index.js +20 -66
  60. package/dist/features/blocks/server/index.js.map +1 -1
  61. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  62. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  63. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  64. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  65. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  66. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  67. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  68. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  69. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  70. package/dist/features/blocks/server/schema.d.ts +45 -0
  71. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  72. package/dist/features/blocks/server/schema.js +136 -0
  73. package/dist/features/blocks/server/schema.js.map +1 -0
  74. package/dist/features/blocks/server/validate.d.ts +1 -2
  75. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  76. package/dist/features/blocks/server/validate.js.map +1 -1
  77. package/dist/features/converters/htmlToLexical/index.d.ts +1 -1
  78. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  79. package/dist/features/converters/htmlToLexical/index.js.map +1 -1
  80. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.d.ts +1 -1
  81. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.d.ts.map +1 -1
  82. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.js.map +1 -1
  83. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts +1 -1
  84. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts.map +1 -1
  85. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  86. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.d.ts +1 -1
  87. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.d.ts.map +1 -1
  88. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.js.map +1 -1
  89. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.d.ts +1 -1
  90. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.d.ts.map +1 -1
  91. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.js.map +1 -1
  92. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts +1 -1
  93. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts.map +1 -1
  94. package/dist/features/converters/lexicalToHtml/async/converters/link.js.map +1 -1
  95. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts +1 -1
  96. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  97. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  98. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.d.ts +1 -1
  99. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.d.ts.map +1 -1
  100. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.js.map +1 -1
  101. package/dist/features/converters/lexicalToHtml/async/converters/tab.d.ts +1 -1
  102. package/dist/features/converters/lexicalToHtml/async/converters/tab.d.ts.map +1 -1
  103. package/dist/features/converters/lexicalToHtml/async/converters/tab.js.map +1 -1
  104. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts +1 -1
  105. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts.map +1 -1
  106. package/dist/features/converters/lexicalToHtml/async/converters/table.js +1 -1
  107. package/dist/features/converters/lexicalToHtml/async/converters/table.js.map +1 -1
  108. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts +1 -1
  109. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts.map +1 -1
  110. package/dist/features/converters/lexicalToHtml/async/converters/text.js.map +1 -1
  111. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts +1 -1
  112. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts.map +1 -1
  113. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  114. package/dist/features/converters/lexicalToHtml/async/defaultConverters.d.ts +1 -1
  115. package/dist/features/converters/lexicalToHtml/async/defaultConverters.d.ts.map +1 -1
  116. package/dist/features/converters/lexicalToHtml/async/defaultConverters.js.map +1 -1
  117. package/dist/features/converters/lexicalToHtml/async/types.d.ts +2 -1
  118. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  119. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  120. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
  121. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  122. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.d.ts +1 -1
  123. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.d.ts.map +1 -1
  124. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.js.map +1 -1
  125. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts +1 -1
  126. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts.map +1 -1
  127. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  128. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.d.ts +1 -1
  129. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.d.ts.map +1 -1
  130. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.js.map +1 -1
  131. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.d.ts +1 -1
  132. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.d.ts.map +1 -1
  133. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.js.map +1 -1
  134. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts +1 -1
  135. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts.map +1 -1
  136. package/dist/features/converters/lexicalToHtml/sync/converters/link.js.map +1 -1
  137. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts +1 -1
  138. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  139. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  140. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.d.ts +1 -1
  141. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.d.ts.map +1 -1
  142. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.js.map +1 -1
  143. package/dist/features/converters/lexicalToHtml/sync/converters/tab.d.ts +1 -1
  144. package/dist/features/converters/lexicalToHtml/sync/converters/tab.d.ts.map +1 -1
  145. package/dist/features/converters/lexicalToHtml/sync/converters/tab.js.map +1 -1
  146. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts +1 -1
  147. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts.map +1 -1
  148. package/dist/features/converters/lexicalToHtml/sync/converters/table.js +1 -1
  149. package/dist/features/converters/lexicalToHtml/sync/converters/table.js.map +1 -1
  150. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts +1 -1
  151. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts.map +1 -1
  152. package/dist/features/converters/lexicalToHtml/sync/converters/text.js.map +1 -1
  153. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts +1 -1
  154. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts.map +1 -1
  155. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  156. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.d.ts +1 -1
  157. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.d.ts.map +1 -1
  158. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.js.map +1 -1
  159. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +2 -1
  160. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  161. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  162. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +4 -2
  163. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  164. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  165. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.d.ts +1 -1
  166. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.d.ts.map +1 -1
  167. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  168. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts +1 -1
  169. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  170. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  171. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.d.ts +1 -1
  172. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.d.ts.map +1 -1
  173. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  174. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.d.ts +1 -1
  175. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.d.ts.map +1 -1
  176. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  177. package/dist/features/converters/lexicalToJSX/converter/converters/link.d.ts +1 -1
  178. package/dist/features/converters/lexicalToJSX/converter/converters/link.d.ts.map +1 -1
  179. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  180. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts +1 -1
  181. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  182. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  183. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.d.ts +1 -1
  184. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.d.ts.map +1 -1
  185. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  186. package/dist/features/converters/lexicalToJSX/converter/converters/tab.d.ts +1 -1
  187. package/dist/features/converters/lexicalToJSX/converter/converters/tab.d.ts.map +1 -1
  188. package/dist/features/converters/lexicalToJSX/converter/converters/tab.js.map +1 -1
  189. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts +1 -1
  190. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts.map +1 -1
  191. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  192. package/dist/features/converters/lexicalToJSX/converter/converters/text.d.ts +1 -1
  193. package/dist/features/converters/lexicalToJSX/converter/converters/text.d.ts.map +1 -1
  194. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  195. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts +1 -1
  196. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  197. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  198. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.d.ts +1 -1
  199. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.d.ts.map +1 -1
  200. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.js.map +1 -1
  201. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +1 -1
  202. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  203. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  204. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +1 -1
  205. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  206. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  207. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  208. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +1 -1
  209. package/dist/features/converters/lexicalToPlaintext/shared/findConverterForNode.js.map +1 -1
  210. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +1 -1
  211. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  212. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  213. package/dist/features/converters/markdownToLexical/index.d.ts +1 -1
  214. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  215. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  216. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.css +4 -4
  217. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.css +1 -1
  218. package/dist/features/experimental_table/server/index.d.ts +1 -6
  219. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  220. package/dist/features/experimental_table/server/index.js +4 -0
  221. package/dist/features/experimental_table/server/index.js.map +1 -1
  222. package/dist/features/experimental_table/server/schema.d.ts +27 -0
  223. package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
  224. package/dist/features/experimental_table/server/schema.js +104 -0
  225. package/dist/features/experimental_table/server/schema.js.map +1 -0
  226. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  227. package/dist/features/heading/server/index.d.ts +2 -4
  228. package/dist/features/heading/server/index.d.ts.map +1 -1
  229. package/dist/features/heading/server/index.js +2 -0
  230. package/dist/features/heading/server/index.js.map +1 -1
  231. package/dist/features/heading/server/schema.d.ts +10 -0
  232. package/dist/features/heading/server/schema.d.ts.map +1 -0
  233. package/dist/features/heading/server/schema.js +37 -0
  234. package/dist/features/heading/server/schema.js.map +1 -0
  235. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  236. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  237. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  238. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  239. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  240. package/dist/features/horizontalRule/server/index.js +2 -0
  241. package/dist/features/horizontalRule/server/index.js.map +1 -1
  242. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
  243. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  244. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  245. package/dist/features/horizontalRule/server/schema.d.ts +7 -0
  246. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  247. package/dist/features/horizontalRule/server/schema.js +25 -0
  248. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  249. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  250. package/dist/features/link/client/index.d.ts.map +1 -1
  251. package/dist/features/link/client/index.js.map +1 -1
  252. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  253. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  254. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  255. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  256. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +2 -2
  257. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  258. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  259. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  260. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  261. package/dist/features/link/markdownTransformer.d.ts +1 -1
  262. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  263. package/dist/features/link/markdownTransformer.js.map +1 -1
  264. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  265. package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
  266. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  267. package/dist/features/link/nodes/AutoLinkNode.js +2 -1
  268. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  269. package/dist/features/link/nodes/LinkNode.d.ts +3 -3
  270. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  271. package/dist/features/link/nodes/LinkNode.js +2 -1
  272. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  273. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  274. package/dist/features/link/server/baseFields.js.map +1 -1
  275. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  276. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  277. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  278. package/dist/features/link/server/index.d.ts +2 -1
  279. package/dist/features/link/server/index.d.ts.map +1 -1
  280. package/dist/features/link/server/index.js +3 -0
  281. package/dist/features/link/server/index.js.map +1 -1
  282. package/dist/features/link/server/schema.d.ts +32 -0
  283. package/dist/features/link/server/schema.d.ts.map +1 -0
  284. package/dist/features/link/server/schema.js +166 -0
  285. package/dist/features/link/server/schema.js.map +1 -0
  286. package/dist/features/link/server/validate.d.ts +1 -1
  287. package/dist/features/link/server/validate.d.ts.map +1 -1
  288. package/dist/features/link/server/validate.js.map +1 -1
  289. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  290. package/dist/features/lists/checklist/server/index.js +3 -0
  291. package/dist/features/lists/checklist/server/index.js.map +1 -1
  292. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  293. package/dist/features/lists/orderedList/server/index.js +3 -0
  294. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  295. package/dist/features/lists/plugin/index.d.ts +0 -9
  296. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  297. package/dist/features/lists/plugin/index.js.map +1 -1
  298. package/dist/features/lists/shared/markdown.d.ts.map +1 -1
  299. package/dist/features/lists/shared/schema.d.ts +18 -0
  300. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  301. package/dist/features/lists/shared/schema.js +62 -0
  302. package/dist/features/lists/shared/schema.js.map +1 -0
  303. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  304. package/dist/features/lists/unorderedList/server/index.js +3 -0
  305. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  306. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  307. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  308. package/dist/features/relationship/client/components/RelationshipComponent.js +2 -2
  309. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  310. package/dist/features/relationship/client/components/index.css +2 -2
  311. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  312. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  313. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  314. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  315. package/dist/features/relationship/client/plugins/index.d.ts +1 -1
  316. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  317. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  318. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  319. package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
  320. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  321. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
  322. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  323. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  324. package/dist/features/relationship/server/index.d.ts +1 -0
  325. package/dist/features/relationship/server/index.d.ts.map +1 -1
  326. package/dist/features/relationship/server/index.js +2 -0
  327. package/dist/features/relationship/server/index.js.map +1 -1
  328. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  329. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  330. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  331. package/dist/features/relationship/server/schema.d.ts +28 -0
  332. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  333. package/dist/features/relationship/server/schema.js +83 -0
  334. package/dist/features/relationship/server/schema.js.map +1 -0
  335. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
  336. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  337. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
  338. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  339. package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
  340. package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
  341. package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
  342. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  343. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  344. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +1 -2
  345. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  346. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +4 -4
  347. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  348. package/dist/features/toolbars/types.d.ts +1 -1
  349. package/dist/features/toolbars/types.d.ts.map +1 -1
  350. package/dist/features/toolbars/types.js.map +1 -1
  351. package/dist/features/typesClient.d.ts +1 -1
  352. package/dist/features/typesClient.d.ts.map +1 -1
  353. package/dist/features/typesClient.js.map +1 -1
  354. package/dist/features/typesServer.d.ts +18 -41
  355. package/dist/features/typesServer.d.ts.map +1 -1
  356. package/dist/features/typesServer.js.map +1 -1
  357. package/dist/features/upload/client/component/index.css +14 -18
  358. package/dist/features/upload/client/component/index.d.ts +1 -1
  359. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  360. package/dist/features/upload/client/component/index.js +4 -4
  361. package/dist/features/upload/client/component/index.js.map +1 -1
  362. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  363. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  364. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  365. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  366. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  367. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  368. package/dist/features/upload/client/plugin/index.js.map +1 -1
  369. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
  370. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  371. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  372. package/dist/features/upload/server/index.d.ts +1 -0
  373. package/dist/features/upload/server/index.d.ts.map +1 -1
  374. package/dist/features/upload/server/index.js +3 -2
  375. package/dist/features/upload/server/index.js.map +1 -1
  376. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  377. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  378. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  379. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  380. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  381. package/dist/features/upload/server/schema.d.ts +52 -0
  382. package/dist/features/upload/server/schema.d.ts.map +1 -0
  383. package/dist/features/upload/server/schema.js +113 -0
  384. package/dist/features/upload/server/schema.js.map +1 -0
  385. package/dist/features/upload/server/validate.d.ts +1 -1
  386. package/dist/features/upload/server/validate.d.ts.map +1 -1
  387. package/dist/features/upload/server/validate.js.map +1 -1
  388. package/dist/field/Diff/converters/link.d.ts +1 -1
  389. package/dist/field/Diff/converters/link.d.ts.map +1 -1
  390. package/dist/field/Diff/converters/link.js.map +1 -1
  391. package/dist/field/Diff/converters/listitem/index.css +44 -8
  392. package/dist/field/Diff/converters/listitem/index.d.ts +1 -1
  393. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  394. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  395. package/dist/field/Diff/converters/relationship/index.css +76 -36
  396. package/dist/field/Diff/converters/relationship/index.d.ts +1 -1
  397. package/dist/field/Diff/converters/relationship/index.d.ts.map +1 -1
  398. package/dist/field/Diff/converters/relationship/index.js +10 -28
  399. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  400. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  401. package/dist/field/Diff/converters/upload/index.css +106 -43
  402. package/dist/field/Diff/converters/upload/index.d.ts +1 -1
  403. package/dist/field/Diff/converters/upload/index.d.ts.map +1 -1
  404. package/dist/field/Diff/converters/upload/index.js +6 -2
  405. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  406. package/dist/field/Diff/index.css +116 -61
  407. package/dist/field/Diff/index.js.map +1 -1
  408. package/dist/field/Field.d.ts +1 -1
  409. package/dist/field/Field.d.ts.map +1 -1
  410. package/dist/field/Field.js +3 -4
  411. package/dist/field/Field.js.map +1 -1
  412. package/dist/field/RenderLexical/index.d.ts +2 -2
  413. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  414. package/dist/field/RenderLexical/index.js.map +1 -1
  415. package/dist/field/RichTextViewProvider.d.ts +1 -1
  416. package/dist/field/RichTextViewProvider.d.ts.map +1 -1
  417. package/dist/field/RichTextViewProvider.js.map +1 -1
  418. package/dist/field/bundled.css +1 -1
  419. package/dist/field/index.d.ts +1 -1
  420. package/dist/field/index.d.ts.map +1 -1
  421. package/dist/field/index.js.map +1 -1
  422. package/dist/field/rscEntry.d.ts +1 -1
  423. package/dist/field/rscEntry.d.ts.map +1 -1
  424. package/dist/field/rscEntry.js.map +1 -1
  425. package/dist/hooks.d.ts +6 -0
  426. package/dist/hooks.d.ts.map +1 -0
  427. package/dist/hooks.js +548 -0
  428. package/dist/hooks.js.map +1 -0
  429. package/dist/index.d.ts +11 -8
  430. package/dist/index.d.ts.map +1 -1
  431. package/dist/index.js +9 -618
  432. package/dist/index.js.map +1 -1
  433. package/dist/lexical/LexicalProvider.d.ts +1 -1
  434. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  435. package/dist/lexical/LexicalProvider.js.map +1 -1
  436. package/dist/lexical/config/client/EditorConfigProvider.d.ts +1 -1
  437. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  438. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  439. package/dist/lexical/config/client/loader.d.ts +1 -1
  440. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  441. package/dist/lexical/config/client/loader.js.map +1 -1
  442. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  443. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  444. package/dist/lexical/config/client/sanitize.js.map +1 -1
  445. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  446. package/dist/lexical/config/server/sanitize.js +9 -11
  447. package/dist/lexical/config/server/sanitize.js.map +1 -1
  448. package/dist/lexical/config/types.d.ts +1 -1
  449. package/dist/lexical/config/types.d.ts.map +1 -1
  450. package/dist/lexical/config/types.js.map +1 -1
  451. package/dist/lexical/nodes/index.d.ts +1 -1
  452. package/dist/lexical/nodes/index.d.ts.map +1 -1
  453. package/dist/lexical/nodes/index.js.map +1 -1
  454. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +1 -1
  455. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  456. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  457. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  458. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  459. package/dist/lexical/theme/EditorTheme.css +4 -4
  460. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  461. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
  462. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  463. package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
  464. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
  465. package/dist/types/builtInNodes.d.ts +14 -0
  466. package/dist/types/builtInNodes.d.ts.map +1 -0
  467. package/dist/types/builtInNodes.js +203 -0
  468. package/dist/types/builtInNodes.js.map +1 -0
  469. package/dist/{types.d.ts → types/index.d.ts} +9 -10
  470. package/dist/types/index.d.ts.map +1 -0
  471. package/dist/types/index.js +2 -0
  472. package/dist/types/index.js.map +1 -0
  473. package/dist/types/jsonSchemaHelpers.d.ts +28 -0
  474. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  475. package/dist/types/jsonSchemaHelpers.js +54 -0
  476. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  477. package/dist/types/nodeTypes.d.ts +86 -0
  478. package/dist/types/nodeTypes.d.ts.map +1 -0
  479. package/dist/types/nodeTypes.js +6 -0
  480. package/dist/types/nodeTypes.js.map +1 -0
  481. package/dist/types/schema.d.ts +6 -0
  482. package/dist/types/schema.d.ts.map +1 -0
  483. package/dist/types/schema.js +73 -0
  484. package/dist/types/schema.js.map +1 -0
  485. package/dist/utilities/buildEditorState.d.ts +1 -1
  486. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  487. package/dist/utilities/buildEditorState.js.map +1 -1
  488. package/dist/utilities/buildInitialState.js.map +1 -1
  489. package/dist/utilities/createClientFeature.d.ts +1 -1
  490. package/dist/utilities/createClientFeature.d.ts.map +1 -1
  491. package/dist/utilities/createClientFeature.js.map +1 -1
  492. package/dist/utilities/editorConfigFactory.d.ts +1 -1
  493. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  494. package/dist/utilities/editorConfigFactory.js.map +1 -1
  495. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  496. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  497. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
  498. package/dist/utilities/generateImportMap.d.ts +1 -1
  499. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  500. package/dist/utilities/generateImportMap.js.map +1 -1
  501. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  502. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  503. package/dist/utilities/initLexicalFeatures.d.ts +1 -1
  504. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  505. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  506. package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
  507. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  508. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  509. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  510. package/dist/validate/index.d.ts.map +1 -1
  511. package/package.json +13 -13
  512. package/dist/exports/client/Field-PJW7KUJG.js.map +0 -7
  513. package/dist/exports/client/RelationshipComponent-5RONAYJM.js.map +0 -7
  514. package/dist/exports/client/chunk-44G3K3W7.js.map +0 -7
  515. package/dist/exports/client/chunk-BZZVLW4U.js.map +0 -7
  516. package/dist/exports/client/chunk-FTT5KJ6W.js.map +0 -7
  517. package/dist/exports/client/component-53Y3RYR5.js +0 -2
  518. package/dist/exports/client/component-53Y3RYR5.js.map +0 -7
  519. package/dist/exports/client/componentInline-PM4PLNUK.js +0 -2
  520. package/dist/features/link/nodes/types.d.ts +0 -27
  521. package/dist/features/link/nodes/types.d.ts.map +0 -1
  522. package/dist/features/link/nodes/types.js +0 -2
  523. package/dist/features/link/nodes/types.js.map +0 -1
  524. package/dist/nodeTypes.d.ts +0 -74
  525. package/dist/nodeTypes.d.ts.map +0 -1
  526. package/dist/nodeTypes.js +0 -5
  527. package/dist/nodeTypes.js.map +0 -1
  528. package/dist/types.d.ts.map +0 -1
  529. package/dist/types.js +0 -2
  530. package/dist/types.js.map +0 -1
  531. /package/dist/exports/client/{chunk-QJ5EETIB.js.map → chunk-6QWQ7JV4.js.map} +0 -0
  532. /package/dist/exports/client/{componentInline-PM4PLNUK.js.map → componentInline-D3A6OW76.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["FieldDiffContainer","getHTMLDiffComponents","formatAdminURL","React","convertLexicalToHTMLAsync","getPayloadPopulateFn","LinkDiffHTMLConverterAsync","ListItemDiffHTMLConverterAsync","RelationshipDiffHTMLConverterAsync","UnknownDiffHTMLConverterAsync","UploadDiffHTMLConverterAsync","baseClass","LexicalDiffComponent","args","comparisonValue","valueFrom","field","i18n","locale","nestingLevel","req","versionValue","valueTo","internalDocToHref","linkNode","populate","fields","doc","relationTo","value","docId","id","collectionSlug","adminRoute","payload","config","routes","admin","path","serverURL","converters","defaultConverters","payloadPopulateFn","currentDepth","depth","fromHTML","data","disableContainer","toHTML","From","To","length","_jsx","className","label"],"sources":["../../../src/field/Diff/index.tsx"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextFieldDiffServerComponent } from 'payload'\n\nimport { FieldDiffContainer, getHTMLDiffComponents } from '@payloadcms/ui/rsc'\n\nimport './index.css'\nimport '../bundled.css'\n\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type {\n HTMLConvertersFunctionAsync,\n HTMLPopulateFn,\n} from '../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedLinkNode } from '../../nodeTypes.js'\n\nimport { convertLexicalToHTMLAsync } from '../../features/converters/lexicalToHtml/async/index.js'\nimport { getPayloadPopulateFn } from '../../features/converters/utilities/payloadPopulateFn.js'\nimport { LinkDiffHTMLConverterAsync } from './converters/link.js'\nimport { ListItemDiffHTMLConverterAsync } from './converters/listitem/index.js'\nimport { RelationshipDiffHTMLConverterAsync } from './converters/relationship/index.js'\nimport { UnknownDiffHTMLConverterAsync } from './converters/unknown/index.js'\nimport { UploadDiffHTMLConverterAsync } from './converters/upload/index.js'\n\nconst baseClass = 'lexical-diff'\n\nexport const LexicalDiffComponent: RichTextFieldDiffServerComponent = async (args) => {\n const {\n comparisonValue: valueFrom,\n field,\n i18n,\n locale,\n nestingLevel,\n req,\n versionValue: valueTo,\n } = args\n\n const internalDocToHref = async ({\n linkNode,\n populate,\n }: {\n linkNode: SerializedLinkNode\n populate?: HTMLPopulateFn\n }) => {\n if (!linkNode.fields.doc) {\n return '#'\n }\n\n const { relationTo, value } = linkNode.fields.doc\n\n let docId: number | string\n\n if (typeof value === 'object' && value !== null) {\n docId = value.id\n } else if (populate && typeof value !== 'object') {\n const doc = await populate({\n id: value,\n collectionSlug: relationTo,\n })\n\n if (!doc || !doc.id) {\n return '#'\n }\n\n docId = doc.id\n } else {\n docId = value\n }\n\n return formatAdminURL({\n adminRoute: req.payload.config.routes.admin,\n path: `/collections/${relationTo}/${docId}`,\n serverURL: req.payload.config.serverURL,\n })\n }\n\n const converters: HTMLConvertersFunctionAsync = ({ defaultConverters }) => ({\n ...defaultConverters,\n ...LinkDiffHTMLConverterAsync({ internalDocToHref }),\n ...ListItemDiffHTMLConverterAsync,\n ...UploadDiffHTMLConverterAsync({ i18n, req }),\n ...RelationshipDiffHTMLConverterAsync({ i18n, req }),\n ...UnknownDiffHTMLConverterAsync({ i18n, req }),\n })\n\n const payloadPopulateFn = await getPayloadPopulateFn({\n currentDepth: 0,\n depth: 1,\n req,\n })\n const fromHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueFrom as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const toHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueTo as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const { From, To } = getHTMLDiffComponents({\n // Ensure empty paragraph is displayed for empty rich text fields - otherwise, toHTML may be displayed in the wrong column\n fromHTML: fromHTML?.length ? fromHTML : '<p></p>',\n toHTML: toHTML?.length ? toHTML : '<p></p>',\n })\n\n return (\n <FieldDiffContainer\n className={baseClass}\n From={From}\n i18n={i18n}\n label={{\n label: field.label,\n locale,\n }}\n nestingLevel={nestingLevel}\n To={To}\n />\n )\n}\n"],"mappings":";AAGA,SAASA,kBAAkB,EAAEC,qBAAqB,QAAQ;AAE1D,OAAO;AACP,OAAO;AAEP,SAASC,cAAc,QA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A,YAAA;IACd+B,EAAA,EAAIA;;AAGV","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["FieldDiffContainer","getHTMLDiffComponents","formatAdminURL","React","convertLexicalToHTMLAsync","getPayloadPopulateFn","LinkDiffHTMLConverterAsync","ListItemDiffHTMLConverterAsync","RelationshipDiffHTMLConverterAsync","UnknownDiffHTMLConverterAsync","UploadDiffHTMLConverterAsync","baseClass","LexicalDiffComponent","args","comparisonValue","valueFrom","field","i18n","locale","nestingLevel","req","versionValue","valueTo","internalDocToHref","linkNode","populate","fields","doc","relationTo","value","docId","id","collectionSlug","adminRoute","payload","config","routes","admin","path","serverURL","converters","defaultConverters","payloadPopulateFn","currentDepth","depth","fromHTML","data","disableContainer","toHTML","From","To","length","_jsx","className","label"],"sources":["../../../src/field/Diff/index.tsx"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextFieldDiffServerComponent } from 'payload'\n\nimport { FieldDiffContainer, getHTMLDiffComponents } from '@payloadcms/ui/rsc'\n\nimport './index.css'\nimport '../bundled.css'\n\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type {\n HTMLConvertersFunctionAsync,\n HTMLPopulateFn,\n} from '../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedLinkNode } from '../../types/nodeTypes.js'\n\nimport { convertLexicalToHTMLAsync } from '../../features/converters/lexicalToHtml/async/index.js'\nimport { getPayloadPopulateFn } from '../../features/converters/utilities/payloadPopulateFn.js'\nimport { LinkDiffHTMLConverterAsync } from './converters/link.js'\nimport { ListItemDiffHTMLConverterAsync } from './converters/listitem/index.js'\nimport { RelationshipDiffHTMLConverterAsync } from './converters/relationship/index.js'\nimport { UnknownDiffHTMLConverterAsync } from './converters/unknown/index.js'\nimport { UploadDiffHTMLConverterAsync } from './converters/upload/index.js'\n\nconst baseClass = 'lexical-diff'\n\nexport const LexicalDiffComponent: RichTextFieldDiffServerComponent = async (args) => {\n const {\n comparisonValue: valueFrom,\n field,\n i18n,\n locale,\n nestingLevel,\n req,\n versionValue: valueTo,\n } = args\n\n const internalDocToHref = async ({\n linkNode,\n populate,\n }: {\n linkNode: SerializedLinkNode\n populate?: HTMLPopulateFn\n }) => {\n if (!linkNode.fields.doc) {\n return '#'\n }\n\n const { relationTo, value } = linkNode.fields.doc\n\n let docId: number | string\n\n if (typeof value === 'object' && value !== null) {\n docId = value.id\n } else if (populate && typeof value !== 'object') {\n const doc = await populate({\n id: value,\n collectionSlug: relationTo,\n })\n\n if (!doc || !doc.id) {\n return '#'\n }\n\n docId = doc.id\n } else {\n docId = value\n }\n\n return formatAdminURL({\n adminRoute: req.payload.config.routes.admin,\n path: `/collections/${relationTo}/${docId}`,\n serverURL: req.payload.config.serverURL,\n })\n }\n\n const converters: HTMLConvertersFunctionAsync = ({ defaultConverters }) => ({\n ...defaultConverters,\n ...LinkDiffHTMLConverterAsync({ internalDocToHref }),\n ...ListItemDiffHTMLConverterAsync,\n ...UploadDiffHTMLConverterAsync({ i18n, req }),\n ...RelationshipDiffHTMLConverterAsync({ i18n, req }),\n ...UnknownDiffHTMLConverterAsync({ i18n, req }),\n })\n\n const payloadPopulateFn = await getPayloadPopulateFn({\n currentDepth: 0,\n depth: 1,\n req,\n })\n const fromHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueFrom as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const toHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueTo as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const { From, To } = getHTMLDiffComponents({\n // Ensure empty paragraph is displayed for empty rich text fields - otherwise, toHTML may be displayed in the wrong column\n fromHTML: fromHTML?.length ? fromHTML : '<p></p>',\n toHTML: toHTML?.length ? toHTML : '<p></p>',\n })\n\n return (\n <FieldDiffContainer\n className={baseClass}\n From={From}\n i18n={i18n}\n label={{\n label: field.label,\n locale,\n }}\n nestingLevel={nestingLevel}\n To={To}\n />\n )\n}\n"],"mappings":";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NqC,KAAA,EAAO;MACLA,KAAA,EAAOtC,KAAA,CAAMsC,KAAK;MAClBpC;IACF;IACAC,YAAA,EAAcA,YAAA;IACd+B,EAAA,EAAIA;;AAGV","ignoreList":[]}
@@ -3,7 +3,7 @@ import type { SanitizedClientEditorConfig } from '../lexical/config/types.js';
3
3
  import '../lexical/theme/EditorTheme.css';
4
4
  import './bundled.css';
5
5
  import './index.css';
6
- import type { LexicalRichTextFieldProps } from '../types.js';
6
+ import type { LexicalRichTextFieldProps } from '../types/index.js';
7
7
  declare const RichTextComponent: React.FC<{
8
8
  readonly editorConfig: SanitizedClientEditorConfig;
9
9
  } & LexicalRichTextFieldProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,kCAAkC,CAAA;AACzC,OAAO,eAAe,CAAA;AACtB,OAAO,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAS5D,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,CAuM9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAqC,CAAA"}
1
+ {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,kCAAkC,CAAA;AACzC,OAAO,eAAe,CAAA;AACtB,OAAO,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AASlE,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,CAuM9B,CAAA;AAWD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAqC,CAAA"}
@@ -68,7 +68,7 @@ const RichTextComponent = props => {
68
68
  AfterInput,
69
69
  BeforeInput,
70
70
  Description,
71
- Error,
71
+ Error: Error1,
72
72
  Label
73
73
  } = {},
74
74
  disabled: disabledFromField,
@@ -153,7 +153,7 @@ const RichTextComponent = props => {
153
153
  }), /*#__PURE__*/_jsxs("div", {
154
154
  className: `${baseClass}__wrap`,
155
155
  children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
156
- CustomComponent: Error,
156
+ CustomComponent: Error1,
157
157
  Fallback: /*#__PURE__*/_jsx(FieldError, {
158
158
  path: path,
159
159
  showError: showError
@@ -190,7 +190,6 @@ const RichTextComponent = props => {
190
190
  function fallbackRender({
191
191
  error
192
192
  }) {
193
- // Call resetErrorBoundary() to reset the error boundary and retry the render.
194
193
  return /*#__PURE__*/_jsxs("div", {
195
194
  className: "errorBoundary",
196
195
  role: "alert",
@@ -200,7 +199,7 @@ function fallbackRender({
200
199
  style: {
201
200
  color: 'red'
202
201
  },
203
- children: error.message
202
+ children: error instanceof Error ? error.message : String(error)
204
203
  })]
205
204
  });
206
205
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","names":["BulkUploadProvider","FieldDescription","FieldError","FieldLabel","isFieldRTL","RenderCustomComponent","useConfig","useEditDepth","useEffectEvent","useField","useLocale","mergeFieldStyles","dequal","React","useCallback","useEffect","useMemo","useState","ErrorBoundary","LexicalProvider","useRunDeprioritized","useRichTextView","ViewSelector","baseClass","RichTextComponent","props","editorConfig","field","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","schemaPath","validate","readOnlyFromProps","locale","config","localization","localizationConfig","rtl","fieldLocalized","undefined","editDepth","isControlledByParent","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","disabledFromField","initialValue","setValue","showError","potentiallyStalePath","isSmallWidthViewport","setIsSmallWidthViewport","rerenderProviderKey","setRerenderProviderKey","prevInitialValueRef","useRef","prevValueRef","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","runDeprioritized","handleChange","editorState","updateFieldValue","newState","toJSON","current","styles","handleInitialValueChange","JSON","parse","stringify","Date","Object","is","_jsxs","view","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","drawerSlugPrefix","composerKey","fieldProps","onChange","error","role","color","message","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\n\nimport {\n BulkUploadProvider,\n FieldDescription,\n FieldError,\n FieldLabel,\n isFieldRTL,\n RenderCustomComponent,\n useConfig,\n useEditDepth,\n useEffectEvent,\n useField,\n useLocale,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport { dequal } from 'dequal/lite'\nimport { type Validate } from 'payload'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\n\nimport '../lexical/theme/EditorTheme.css'\nimport './bundled.css'\nimport './index.css'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport { useRunDeprioritized } from '../utilities/useRunDeprioritized.js'\nimport { useRichTextView } from './RichTextViewProvider.js'\nimport { ViewSelector } from './ViewSelector.js'\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 admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n schemaPath,\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\n const locale = useLocale()\n const {\n config: { localization: localizationConfig },\n } = useConfig()\n\n const rtl = isFieldRTL({\n fieldLocalized: localized,\n locale,\n localizationConfig: localizationConfig || undefined,\n })\n\n const editDepth = useEditDepth()\n const { isControlledByParent } = useRichTextView()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\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 disabled: disabledFromField,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || disabledFromField\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n const [rerenderProviderKey, setRerenderProviderKey] = useState<Date>()\n\n const prevInitialValueRef = React.useRef<SerializedEditorState | undefined>(initialValue)\n const prevValueRef = React.useRef<SerializedEditorState | undefined>(value)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const classes = [\n 'field-type',\n baseClass,\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport\n ? `${baseClass}--show-gutter`\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const runDeprioritized = useRunDeprioritized() // defaults to 500 ms timeout\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n // Capture `editorState` in the closure so we can safely run later.\n const updateFieldValue = () => {\n const newState = editorState.toJSON()\n prevValueRef.current = newState\n setValue(newState)\n }\n\n // Queue the update for the browser’s idle time (or Safari shim)\n // and let the hook handle debouncing/cancellation.\n void runDeprioritized(updateFieldValue)\n },\n [setValue, runDeprioritized], // `runDeprioritized` is stable (useCallback inside hook)\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const handleInitialValueChange = useEffectEvent(\n (initialValue: SerializedEditorState | undefined) => {\n // Object deep equality check here, as re-mounting the editor if\n // the new value is the same as the old one is not necessary.\n // In postgres, the order of keys in JSON objects is not guaranteed to be preserved,\n // so we need to do a deep equality check here that does not care about key order => we use dequal.\n // If we used JSON.stringify, the editor would re-mount every time you save the document, as the order of keys changes => change detected => re-mount.\n if (\n prevValueRef.current !== value &&\n !dequal(\n prevValueRef.current != null\n ? JSON.parse(JSON.stringify(prevValueRef.current))\n : prevValueRef.current,\n value,\n )\n ) {\n prevInitialValueRef.current = initialValue\n prevValueRef.current = value\n setRerenderProviderKey(new Date())\n }\n },\n )\n\n useEffect(() => {\n // Needs to trigger for object reference changes - otherwise,\n // reacting to the same initial value change twice will cause\n // the second change to be ignored, even though the value has changed.\n // That's because initialValue is not kept up-to-date\n if (!Object.is(initialValue, prevInitialValueRef.current)) {\n handleInitialValueChange(initialValue)\n }\n }, [initialValue])\n\n return (\n <div\n className={classes}\n data-field-path={path}\n data-field-schemapath={schemaPath}\n data-lexical-view={editorConfig?.view}\n key={pathWithEditDepth}\n style={styles}\n >\n <div className={`${baseClass}__label-row`}>\n {Label || (\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n )}\n {!isControlledByParent && <ViewSelector />}\n </div>\n <div className={`${baseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n {/* Lexical may be in a drawer. We need to define another BulkUploadProvider to ensure that the bulk upload drawer\n is rendered in the correct depth (not displayed *behind* the current drawer).\n The `lexical-` prefix prevents drawer-slug collisions with non-lexical `BulkUploadProvider`s up the tree. */}\n <BulkUploadProvider drawerSlugPrefix={`lexical-${path}`}>\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n isSmallWidthViewport={isSmallWidthViewport}\n key={JSON.stringify({ path, rerenderProviderKey })} // 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 rtl={rtl}\n value={value}\n />\n </BulkUploadProvider>\n {AfterInput}\n </ErrorBoundary>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\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 = RichTextComponent\n"],"mappings":"AAAA;;;AAGA,SACEA,kBAAkB,EAClBC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,UAAU,EACVC,qBAAqB,EACrBC,SAAS,EACTC,YAAY,EACZC,cAAc,EACdC,QAAQ,EACRC,SAAS,QACJ;AACP,SAASC,gBAAgB,QAAQ;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CAACvG,gBAAA;UAAiB6B,WAAA,EAAaA,WAAA;UAAaM,IAAA,EAAMA;;;;KApC3DiD,iBAAA;AAyCX;AAEA,SAASsB,eAAe;EAAEM;AAAK,CAAoB;EACjD;EAEA,oBACEZ,KAAA,CAAC;IAAIxE,SAAA,EAAU;IAAgBqF,IAAA,EAAK;4BAClCV,IAAA,CAAC;gBAAE;qBACHA,IAAA,CAAC;MAAID,KAAA,EAAO;QAAEY,KAAA,EAAO;MAAM;gBAAIF,KAAA,CAAMG;;;AAG3C;AAEA,OAAO,MAAMC,QAAA,GAAqC7F,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"Field.js","names":["BulkUploadProvider","FieldDescription","FieldError","FieldLabel","isFieldRTL","RenderCustomComponent","useConfig","useEditDepth","useEffectEvent","useField","useLocale","mergeFieldStyles","dequal","React","useCallback","useEffect","useMemo","useState","ErrorBoundary","LexicalProvider","useRunDeprioritized","useRichTextView","ViewSelector","baseClass","RichTextComponent","props","editorConfig","field","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","schemaPath","validate","readOnlyFromProps","locale","config","localization","localizationConfig","rtl","fieldLocalized","undefined","editDepth","isControlledByParent","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Error1","Label","disabled","disabledFromField","initialValue","setValue","showError","potentiallyStalePath","isSmallWidthViewport","setIsSmallWidthViewport","rerenderProviderKey","setRerenderProviderKey","prevInitialValueRef","useRef","prevValueRef","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","runDeprioritized","handleChange","editorState","updateFieldValue","newState","toJSON","current","styles","handleInitialValueChange","JSON","parse","stringify","Date","Object","is","_jsxs","view","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","drawerSlugPrefix","composerKey","fieldProps","onChange","error","role","color","message","String","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\nimport type { FallbackProps } from 'react-error-boundary'\n\nimport {\n BulkUploadProvider,\n FieldDescription,\n FieldError,\n FieldLabel,\n isFieldRTL,\n RenderCustomComponent,\n useConfig,\n useEditDepth,\n useEffectEvent,\n useField,\n useLocale,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport { dequal } from 'dequal/lite'\nimport { type Validate } from 'payload'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\n\nimport '../lexical/theme/EditorTheme.css'\nimport './bundled.css'\nimport './index.css'\n\nimport type { LexicalRichTextFieldProps } from '../types/index.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport { useRunDeprioritized } from '../utilities/useRunDeprioritized.js'\nimport { useRichTextView } from './RichTextViewProvider.js'\nimport { ViewSelector } from './ViewSelector.js'\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 admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n schemaPath,\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\n const locale = useLocale()\n const {\n config: { localization: localizationConfig },\n } = useConfig()\n\n const rtl = isFieldRTL({\n fieldLocalized: localized,\n locale,\n localizationConfig: localizationConfig || undefined,\n })\n\n const editDepth = useEditDepth()\n const { isControlledByParent } = useRichTextView()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\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 disabled: disabledFromField,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || disabledFromField\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n const [rerenderProviderKey, setRerenderProviderKey] = useState<Date>()\n\n const prevInitialValueRef = React.useRef<SerializedEditorState | undefined>(initialValue)\n const prevValueRef = React.useRef<SerializedEditorState | undefined>(value)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const classes = [\n 'field-type',\n baseClass,\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport\n ? `${baseClass}--show-gutter`\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const runDeprioritized = useRunDeprioritized() // defaults to 500 ms timeout\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n // Capture `editorState` in the closure so we can safely run later.\n const updateFieldValue = () => {\n const newState = editorState.toJSON()\n prevValueRef.current = newState\n setValue(newState)\n }\n\n // Queue the update for the browser’s idle time (or Safari shim)\n // and let the hook handle debouncing/cancellation.\n void runDeprioritized(updateFieldValue)\n },\n [setValue, runDeprioritized], // `runDeprioritized` is stable (useCallback inside hook)\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const handleInitialValueChange = useEffectEvent(\n (initialValue: SerializedEditorState | undefined) => {\n // Object deep equality check here, as re-mounting the editor if\n // the new value is the same as the old one is not necessary.\n // In postgres, the order of keys in JSON objects is not guaranteed to be preserved,\n // so we need to do a deep equality check here that does not care about key order => we use dequal.\n // If we used JSON.stringify, the editor would re-mount every time you save the document, as the order of keys changes => change detected => re-mount.\n if (\n prevValueRef.current !== value &&\n !dequal(\n prevValueRef.current != null\n ? JSON.parse(JSON.stringify(prevValueRef.current))\n : prevValueRef.current,\n value,\n )\n ) {\n prevInitialValueRef.current = initialValue\n prevValueRef.current = value\n setRerenderProviderKey(new Date())\n }\n },\n )\n\n useEffect(() => {\n // Needs to trigger for object reference changes - otherwise,\n // reacting to the same initial value change twice will cause\n // the second change to be ignored, even though the value has changed.\n // That's because initialValue is not kept up-to-date\n if (!Object.is(initialValue, prevInitialValueRef.current)) {\n handleInitialValueChange(initialValue)\n }\n }, [initialValue])\n\n return (\n <div\n className={classes}\n data-field-path={path}\n data-field-schemapath={schemaPath}\n data-lexical-view={editorConfig?.view}\n key={pathWithEditDepth}\n style={styles}\n >\n <div className={`${baseClass}__label-row`}>\n {Label || (\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n )}\n {!isControlledByParent && <ViewSelector />}\n </div>\n <div className={`${baseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n {/* Lexical may be in a drawer. We need to define another BulkUploadProvider to ensure that the bulk upload drawer\n is rendered in the correct depth (not displayed *behind* the current drawer).\n The `lexical-` prefix prevents drawer-slug collisions with non-lexical `BulkUploadProvider`s up the tree. */}\n <BulkUploadProvider drawerSlugPrefix={`lexical-${path}`}>\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n isSmallWidthViewport={isSmallWidthViewport}\n key={JSON.stringify({ path, rerenderProviderKey })} // 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 rtl={rtl}\n value={value}\n />\n </BulkUploadProvider>\n {AfterInput}\n </ErrorBoundary>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: FallbackProps) {\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error instanceof Error ? error.message : String(error)}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n"],"mappings":"AAAA;;;AAIA,SACEA,kBAAkB,EAClBC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,UAAU,EACVC,qBAAqB,EACrBC,SAAS,EACTC,YAAY,EACZC,cAAc,EACdC,QAAQ,EACRC,SAAS,QACJ;AACP,SAASC,gBAAgB,QAAQ;AACjC,SAASC,MAAM,QAAQ;AAEvB,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AACjE,SAASC,aAAa,QAAQ;AAI9B,OAAO;AACP,OAAO;AACP,OAAO;AAIP,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAE7B,MAAMC,SAAA,GAAY;AAElB,MAAMC,iBAAA,GAIDC,KAAA;EACH,MAAM;IACJC,YAAY;IACZC,KAAK;IACLA,KAAA,EAAO;MACLC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC,QAAA,EAAUC;MAAiB,CAAE,GAAG,CAAC,CAAC;MACnE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FieldType, type RenderFieldServerFnArgs } from '@payloadcms/ui';
2
2
  import React from 'react';
3
- import type { DefaultTypedEditorState } from '../../nodeTypes.js';
4
- import type { LexicalRichTextField } from '../../types.js';
3
+ import type { LexicalRichTextField } from '../../types/index.js';
4
+ import type { DefaultTypedEditorState } from '../../types/nodeTypes.js';
5
5
  /**
6
6
  * Utility to render a lexical editor on the client.
7
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/field/RenderLexical/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,uBAAuB,EAK7B,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAyC,MAAM,OAAO,CAAA;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE;AAClC;;;GAGG;AACH;IACE;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;IAE5B,QAAQ,CAAC,EAAE,SAAS,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAAC,UAAU,CAAC,CAAA;IACrE,KAAK,CAAC,EAAE,SAAS,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAA;CAChE,GAAG,uBAAuB,CAAC,oBAAoB,CAAC,CA4FlD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/field/RenderLexical/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,uBAAuB,EAK7B,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAyC,MAAM,OAAO,CAAA;AAE7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE;AAClC;;;GAGG;AACH;IACE;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;IAE5B,QAAQ,CAAC,EAAE,SAAS,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAAC,UAAU,CAAC,CAAA;IACrE,KAAK,CAAC,EAAE,SAAS,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAA;CAChE,GAAG,uBAAuB,CAAC,oBAAoB,CAAC,CA4FlD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","FieldContext","FieldPathContext","ServerFunctionsContext","ShimmerEffect","useServerFunctions","React","useCallback","useEffect","useRef","RenderLexical","args","$","field","initialValue","Loading","path","schemaPath","setValue","value","Component","setComponent","useState","serverFunctionContext","_internal_renderField","entityType","entitySlug","split","fieldPath","name","t0","render","Field","type","admin","hidden","undefined","renderLexical","mounted","t1","t2","current","_jsx","adjustedServerFunctionContext","getFormState","getFormStateArgs","collectionSlug","globalSlug","children","fieldValue","disabled","formInitializing","formProcessing","formSubmitted","_temp","showError"],"sources":["../../../src/field/RenderLexical/index.tsx"],"sourcesContent":["'use client'\nimport type { RichTextField } from 'payload'\n\nimport {\n FieldContext,\n FieldPathContext,\n type FieldType,\n type RenderFieldServerFnArgs,\n ServerFunctionsContext,\n type ServerFunctionsContextType,\n ShimmerEffect,\n useServerFunctions,\n} from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useRef } from 'react'\n\nimport type { DefaultTypedEditorState } from '../../nodeTypes.js'\nimport type { LexicalRichTextField } from '../../types.js'\n\n/**\n * Utility to render a lexical editor on the client.\n *\n * @experimental - may break in minor releases\n * @todo - replace this with a general utility that works for all fields. Maybe merge with packages/ui/src/forms/RenderFields/RenderField.tsx\n */\nexport const RenderLexical: React.FC<\n /**\n * If value or setValue, or both, is provided, this component will manage its own value.\n * If neither is passed, it will rely on the parent form to manage the value.\n */\n {\n /**\n * Override the loading state while the field component is being fetched and rendered.\n */\n Loading?: React.ReactElement\n\n setValue?: FieldType<DefaultTypedEditorState | undefined>['setValue']\n value?: FieldType<DefaultTypedEditorState | undefined>['value']\n } & RenderFieldServerFnArgs<LexicalRichTextField>\n> = (args) => {\n const { field, initialValue, Loading, path, schemaPath, setValue, value } = args\n const [Component, setComponent] = React.useState<null | React.ReactNode>(null)\n const serverFunctionContext = useServerFunctions()\n const { _internal_renderField } = serverFunctionContext\n\n const [entityType, entitySlug] = schemaPath.split('.', 2)\n\n const fieldPath = path ?? (field && 'name' in field ? field?.name : '') ?? ''\n\n const renderLexical = useCallback(() => {\n async function render() {\n const { Field } = await _internal_renderField({\n field: {\n ...((field as RichTextField) || {}),\n type: 'richText',\n admin: {\n ...((field as RichTextField)?.admin || {}),\n // When using \"fake\" anchor fields, hidden is often set to true. We need to override that here to ensure the field is rendered.\n hidden: false,\n },\n },\n initialValue: initialValue ?? undefined,\n path,\n schemaPath,\n })\n\n setComponent(Field)\n }\n void render()\n }, [_internal_renderField, schemaPath, path, field, initialValue])\n\n const mounted = useRef(false)\n\n useEffect(() => {\n if (mounted.current) {\n return\n }\n mounted.current = true\n void renderLexical()\n }, [renderLexical])\n\n if (!Component) {\n return typeof Loading !== 'undefined' ? Loading : <ShimmerEffect />\n }\n\n /**\n * By default, the lexical will make form state requests (e.g. to get drawer fields), passing in the arguments\n * of the current field. However, we need to override those arguments to get it to make requests based on the\n * *target* field. The server only knows the schema map of the target field.\n */\n const adjustedServerFunctionContext: ServerFunctionsContextType = {\n ...serverFunctionContext,\n getFormState: async (getFormStateArgs) => {\n return serverFunctionContext.getFormState({\n ...getFormStateArgs,\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n })\n },\n }\n\n if (typeof value === 'undefined' && !setValue) {\n return (\n <ServerFunctionsContext value={{ ...adjustedServerFunctionContext }}>\n <FieldPathContext key={fieldPath} value={fieldPath}>\n {Component}\n </FieldPathContext>\n </ServerFunctionsContext>\n )\n }\n\n const fieldValue: FieldType<DefaultTypedEditorState | undefined> = {\n disabled: false,\n formInitializing: false,\n formProcessing: false,\n formSubmitted: false,\n initialValue: value,\n path: fieldPath,\n setValue: setValue ?? (() => undefined),\n showError: false,\n value,\n }\n\n return (\n <ServerFunctionsContext value={{ ...adjustedServerFunctionContext }}>\n <FieldPathContext key={fieldPath} value={fieldPath}>\n <FieldContext value={fieldValue}>{Component}</FieldContext>\n </FieldPathContext>\n </ServerFunctionsContext>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SACEC,YAAY,EACZC,gBAAgB,EAGhBC,sBAAsB,EAEtBC,aAAa,EACbC,kBAAkB,QACb;AACP,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ;AAKtD;;;;;;AAMA,OAAO,MAAMC,aAAA,GAcTC,IAAA;EAAA,MAAAC,CAAA,GAAAZ,EAAA;EACF;IAAAa,KAAA;IAAAC,YAAA;IAAAC,OAAA;IAAAC,IAAA;IAAAC,UAAA;IAAAC,QAAA;IAAAC;EAAA,IAA4ER,IAAA;EAC5E,OAAAS,SAAA,EAAAC,YAAA,IAAkCf,KAAA,CAAAgB,QAAA,KAAuC;EACzE,MAAAC,qBAAA,GAA8BlB,kBAAA;EAC9B;IAAAmB;EAAA,IAAkCD,qBAAA;EAElC,OAAAE,UAAA,EAAAC,UAAA,IAAiCT,UAAA,CAAAU,KAAA,CAAiB,MAAK;EAEvD,MAAAC,SAAA,GAAkBZ,IAAA,KAASH,KAAA,IAAS,UAAUA,KAAA,GAAQA,KAAA,EAAAgB,IAAA,GAAc,EAAC,KAAM;EAAA,IAAAC,EAAA;EAAA,IAAAlB,CAAA,QAAAY,qBAAA,IAAAZ,CAAA,QAAAC,KAAA,IAAAD,CAAA,QAAAE,YAAA,IA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6BAAA;IAAA,GACKpB,qBAAqB;IAAAqB,YAAA,QAAAC,gBAAA,IAEftB,qBAAA,CAAAqB,YAAA;MAAA,GACFC,gBAAgB;MAAAC,cAAA,EACHrB,UAAA,KAAe,eAAeC,UAAA,GAAAU,SAAa;MAAAW,UAAA,EAC/CtB,UAAA,KAAe,WAAWC,UAAA,GAAAU;IAAa,CACrD;EAAA;EAEJ,IAEI,OAAOjB,KAAA,KAAU,gBAAgBD,QAAA;IAAA,OAEjCwB,IAAA,CAAAvC,sBAAA;MAAAgB,KAAA;QAAA,GAAoCwB;MAA6B;MAAAK,QAAA,EAC/DN,IAAA,CAAAxC,gBAAA;QAAAiB,KAAA,EAAyCS,SAAA;QAAAoB,QAAA,EACtC5B;MAAA,GADoBQ,SAAA;IAAA,C;;EAO7B,MAAAqB,UAAA;IAAAC,QAAA;IAAAC,gBAAA;IAAAC,cAAA;IAAAC,aAAA;IAAAvC,YAAA,EAKgBK,KAAA;IAAAH,IAAA,EACRY,SAAA;IAAAV,QAAA,EACIA,QAAA,IAAAoC,KAA2B;IAAAC,SAAA;IAAApC;EAAA;EAGvC,OAGEuB,IAAA,CAAAvC,sBAAA;IAAAgB,KAAA;MAAA,GAAoCwB;IAA6B;IAAAK,QAAA,EAC/DN,IAAA,CAAAxC,gBAAA;MAAAiB,KAAA,EAAyCS,SAAA;MAAAoB,QAAA,EACvCN,IAAA,CAAAzC,YAAA;QAAAkB,KAAA,EAAqB8B,UAAA;QAAAD,QAAA,EAAa5B;MAAA,C;OADbQ,SAAA;EAAA,C;CAK7B;AA3FI,SAAA0B,MAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","FieldContext","FieldPathContext","ServerFunctionsContext","ShimmerEffect","useServerFunctions","React","useCallback","useEffect","useRef","RenderLexical","args","$","field","initialValue","Loading","path","schemaPath","setValue","value","Component","setComponent","useState","serverFunctionContext","_internal_renderField","entityType","entitySlug","split","fieldPath","name","t0","render","Field","type","admin","hidden","undefined","renderLexical","mounted","t1","t2","current","_jsx","adjustedServerFunctionContext","getFormState","getFormStateArgs","collectionSlug","globalSlug","children","fieldValue","disabled","formInitializing","formProcessing","formSubmitted","_temp","showError"],"sources":["../../../src/field/RenderLexical/index.tsx"],"sourcesContent":["'use client'\nimport type { RichTextField } from 'payload'\n\nimport {\n FieldContext,\n FieldPathContext,\n type FieldType,\n type RenderFieldServerFnArgs,\n ServerFunctionsContext,\n type ServerFunctionsContextType,\n ShimmerEffect,\n useServerFunctions,\n} from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useRef } from 'react'\n\nimport type { LexicalRichTextField } from '../../types/index.js'\nimport type { DefaultTypedEditorState } from '../../types/nodeTypes.js'\n\n/**\n * Utility to render a lexical editor on the client.\n *\n * @experimental - may break in minor releases\n * @todo - replace this with a general utility that works for all fields. Maybe merge with packages/ui/src/forms/RenderFields/RenderField.tsx\n */\nexport const RenderLexical: React.FC<\n /**\n * If value or setValue, or both, is provided, this component will manage its own value.\n * If neither is passed, it will rely on the parent form to manage the value.\n */\n {\n /**\n * Override the loading state while the field component is being fetched and rendered.\n */\n Loading?: React.ReactElement\n\n setValue?: FieldType<DefaultTypedEditorState | undefined>['setValue']\n value?: FieldType<DefaultTypedEditorState | undefined>['value']\n } & RenderFieldServerFnArgs<LexicalRichTextField>\n> = (args) => {\n const { field, initialValue, Loading, path, schemaPath, setValue, value } = args\n const [Component, setComponent] = React.useState<null | React.ReactNode>(null)\n const serverFunctionContext = useServerFunctions()\n const { _internal_renderField } = serverFunctionContext\n\n const [entityType, entitySlug] = schemaPath.split('.', 2)\n\n const fieldPath = path ?? (field && 'name' in field ? field?.name : '') ?? ''\n\n const renderLexical = useCallback(() => {\n async function render() {\n const { Field } = await _internal_renderField({\n field: {\n ...((field as RichTextField) || {}),\n type: 'richText',\n admin: {\n ...((field as RichTextField)?.admin || {}),\n // When using \"fake\" anchor fields, hidden is often set to true. We need to override that here to ensure the field is rendered.\n hidden: false,\n },\n },\n initialValue: initialValue ?? undefined,\n path,\n schemaPath,\n })\n\n setComponent(Field)\n }\n void render()\n }, [_internal_renderField, schemaPath, path, field, initialValue])\n\n const mounted = useRef(false)\n\n useEffect(() => {\n if (mounted.current) {\n return\n }\n mounted.current = true\n void renderLexical()\n }, [renderLexical])\n\n if (!Component) {\n return typeof Loading !== 'undefined' ? Loading : <ShimmerEffect />\n }\n\n /**\n * By default, the lexical will make form state requests (e.g. to get drawer fields), passing in the arguments\n * of the current field. However, we need to override those arguments to get it to make requests based on the\n * *target* field. The server only knows the schema map of the target field.\n */\n const adjustedServerFunctionContext: ServerFunctionsContextType = {\n ...serverFunctionContext,\n getFormState: async (getFormStateArgs) => {\n return serverFunctionContext.getFormState({\n ...getFormStateArgs,\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n })\n },\n }\n\n if (typeof value === 'undefined' && !setValue) {\n return (\n <ServerFunctionsContext value={{ ...adjustedServerFunctionContext }}>\n <FieldPathContext key={fieldPath} value={fieldPath}>\n {Component}\n </FieldPathContext>\n </ServerFunctionsContext>\n )\n }\n\n const fieldValue: FieldType<DefaultTypedEditorState | undefined> = {\n disabled: false,\n formInitializing: false,\n formProcessing: false,\n formSubmitted: false,\n initialValue: value,\n path: fieldPath,\n setValue: setValue ?? (() => undefined),\n showError: false,\n value,\n }\n\n return (\n <ServerFunctionsContext value={{ ...adjustedServerFunctionContext }}>\n <FieldPathContext key={fieldPath} value={fieldPath}>\n <FieldContext value={fieldValue}>{Component}</FieldContext>\n </FieldPathContext>\n </ServerFunctionsContext>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SACEC,YAAY,EACZC,gBAAgB,EAGhBC,sBAAsB,EAEtBC,aAAa,EACbC,kBAAkB,QACb;AACP,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ;AAKtD;;;;;;AAMA,OAAO,MAAMC,aAAA,GAcTC,IAAA;EA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AoC,KAA2B;IAAAC,SAAA;IAAApC;EAAA;EAGvC,OAGEuB,IAAA,CAAAvC,sBAAA;IAAAgB,KAAA;MAAA,GAAoCwB;IAA6B;IAAAK,QAAA,EAC/DN,IAAA,CAAAxC,gBAAA;MAAAiB,KAAA,EAAyCS,SAAA;MAAAoB,QAAA,EACvCN,IAAA,CAAAzC,YAAA;QAAAkB,KAAA,EAAqB8B,UAAA;QAAAD,QAAA,EAAa5B;MAAA,C;OADbQ,SAAA;EAAA,C;CAK7B;AA3FI,SAAA0B,MAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { LexicalEditorNodeMap, LexicalEditorViewMap } from '../types.js';
2
+ import type { LexicalEditorNodeMap, LexicalEditorViewMap } from '../types/index.js';
3
3
  /**
4
4
  * Context for managing richtext editor view state and inheritance.
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextViewProvider.d.ts","sourceRoot":"","sources":["../../src/field/RichTextViewProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAE7E;;GAEG;AACH,KAAK,uBAAuB,GAAG;IAC7B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,oBAAoB,CAAA;IACrC;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;OAEG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC;;;OAGG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAA;CAC7B,CAAA;AAQD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,EAAE,KA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CAEzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextViewProvider.js","names":["useControllableState","React","createContext","use","useMemo","RichTextViewContext","currentView","inheritable","setCurrentView","RichTextViewProvider","args","parentContext","useRichTextView","hasOwnExplicitView","undefined","isControlledByParent","Boolean","views","hasExplicitCurrentView","children","currentViewFromProps","currentViewRaw","value","currentViewMap","_jsx"],"sources":["../../src/field/RichTextViewProvider.tsx"],"sourcesContent":["'use client'\nimport { useControllableState } from '@payloadcms/ui'\nimport React, { createContext, use, useMemo } from 'react'\n\nimport type { LexicalEditorNodeMap, LexicalEditorViewMap } from '../types.js'\n\n/**\n * Context for managing richtext editor view state and inheritance.\n */\ntype RichTextViewContextType = {\n /**\n * The currently active view name (e.g., 'default', 'frontend', 'debug').\n */\n currentView: string\n /**\n * The resolved node map for the current view, containing rendering overrides for each node type.\n */\n currentViewMap?: LexicalEditorNodeMap\n /**\n * True if the current view was explicitly set (via prop) by this provider or an ancestor.\n * Used to distinguish intentional view settings from automatic defaults.\n */\n hasExplicitCurrentView?: boolean\n /**\n * If true, nested richtext editors will inherit this provider's currentView and views.\n */\n inheritable?: boolean\n /**\n * True if this provider's view is controlled by an ancestor provider — either because the\n * ancestor has a views map (view-map inheritance) or an explicit `currentView` prop.\n * When true, the ViewSelector is hidden.\n */\n isControlledByParent?: boolean\n /**\n * Function to programmatically change the current view.\n */\n setCurrentView: (view: string) => void\n /**\n * Map of all available views for this editor. Each key is a view name, each value contains\n * admin config, node overrides, and lexical config for that view.\n */\n views?: LexicalEditorViewMap\n}\n\nconst RichTextViewContext = createContext<RichTextViewContextType>({\n currentView: 'default',\n inheritable: false,\n setCurrentView: () => {},\n})\n\n/**\n * Provider for managing richtext editor view state and its inheritance.\n *\n * Handles two key scenarios:\n * 1. **Explicit view setting**: Wrap with `currentView` and `inheritable={true}` to force nested editors to a specific view\n * 2. **View map inheritance**: Nested editors inherit `views` from parents, allowing view switching across the hierarchy\n *\n * When a nested editor inherits from a parent, its ViewSelector is hidden because the view is controlled by an ancestor.\n *\n * @example\n * Force all nested richtext editors to use \"frontend\" view:\n * ```tsx\n * <RichTextViewProvider currentView=\"frontend\" inheritable={true}>\n * <MyForm /> {/* All richtext fields inside will use \"frontend\" view }\n * </RichTextViewProvider>\n * ```\n */\nexport const RichTextViewProvider: React.FC<{\n children: React.ReactNode\n currentView?: string\n inheritable?: boolean\n views?: LexicalEditorViewMap\n}> = (args) => {\n const parentContext = useRichTextView()\n\n // Track if this provider explicitly sets currentView (not just using the default)\n const hasOwnExplicitView = args.currentView !== undefined\n\n const isControlledByParent =\n parentContext.inheritable &&\n (Boolean(parentContext.views) || Boolean(parentContext.hasExplicitCurrentView))\n\n // This provider has explicit currentView if it sets one OR inherits one from parent\n const hasExplicitCurrentView =\n hasOwnExplicitView ||\n (parentContext.inheritable && Boolean(parentContext.hasExplicitCurrentView))\n\n const {\n children,\n currentView: currentViewFromProps,\n inheritable,\n views,\n } = {\n children: args.children,\n currentView: isControlledByParent ? parentContext.currentView : args.currentView,\n // Propagate inheritable flag through the hierarchy\n inheritable: parentContext.inheritable || args.inheritable,\n // Only inherit views if parent has a views map\n views: isControlledByParent && parentContext.views ? parentContext.views : args.views,\n }\n\n const [currentViewRaw, setCurrentView] = useControllableState(currentViewFromProps, 'default')\n\n // Normalize currentView: if the requested view doesn't exist in this editor's\n // views map, fall back to 'default'. This ensures all consumers of useRichTextView()\n // see a consistent currentView that actually exists\n const currentView =\n views && currentViewRaw !== 'default' && !views[currentViewRaw] ? 'default' : currentViewRaw\n\n const value = useMemo(() => {\n const currentViewMap = views ? views[currentView] : undefined\n return {\n currentView,\n currentViewMap,\n hasExplicitCurrentView,\n inheritable,\n isControlledByParent,\n setCurrentView,\n views,\n }\n }, [\n currentView,\n inheritable,\n hasExplicitCurrentView,\n isControlledByParent,\n setCurrentView,\n views,\n ])\n\n return <RichTextViewContext value={value}>{children}</RichTextViewContext>\n}\n\n/**\n * Access the current richtext editor view context.\n *\n * Returns the active view name, node overrides, inheritance state, and a function to switch views.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { currentView, currentViewMap, isControlledByParent, setCurrentView } = useRichTextView()\n *\n * return (\n * <div>\n * <p>Active view: {currentView}</p>\n * {isControlledByParent && <p>View controlled by parent</p>}\n * {currentViewMap?.heading && <p>Custom heading renderer active</p>}\n * <button onClick={() => setCurrentView('frontend')}>Switch to frontend</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useRichTextView(): RichTextViewContextType {\n return use(RichTextViewContext)\n}\n"],"mappings":"AAAA;;;AACA,SAASA,oBAAoB,QAAQ;AACrC,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,OAAO,QAAQ;AA0CnD,MAAMC,mBAAA,gBAAsBH,aAAA,CAAuC;EACjEI,WAAA,EAAa;EACbC,WAAA,EAAa;EACbC,cAAA,EAAgBA,CAAA,MAAO;AACzB;AAEA;;;;;;;;;;;;;;;;;AAiBA,OAAO,MAAMC,oBAAA,GAKPC,IAAA;EACJ,MAAMC,aAAA,GAAgBC,eAAA;EAEtB;EACA,MAAMC,kBAAA,GAAqBH,IAAA,CAAKJ,WAAW,KAAKQ,SAAA;EAEhD,MAAMC,oBAAA,GACJJ,aAAA,CAAcJ,WAAW,KACxBS,OAAA,CAAQL,aAAA,CAAcM,KAAK,KAAKD,OAAA,CAAQL,aAAA,CAAcO,sBAAsB;EAE/E;EACA,MAAMA,sBAAA,GACJL,kBAAA,IACCF,aAAA,CAAcJ,WAAW,IAAIS,OAAA,CAAQL,aAAA,CAAcO,sBAAsB;EAE5E,MAAM;IACJC,QAAQ;IACRb,WAAA,EAAac,oBAAoB;IACjCb,WAAW;IACXU;EAAK,CACN,GAAG;IACFE,QAAA,EAAUT,IAAA,CAAKS,QAAQ;IACvBb,WAAA,EAAaS,oBAAA,GAAuBJ,aAAA,CAAcL,WAAW,GAAGI,IAAA,CAAKJ,WAAW;IAChF;IACAC,WAAA,EAAaI,aAAA,CAAcJ,WAAW,IAAIG,IAAA,CAAKH,WAAW;IAC1D;IACAU,KAAA,EAAOF,oBAAA,IAAwBJ,aAAA,CAAcM,KAAK,GAAGN,aAAA,CAAcM,KAAK,GAAGP,IAAA,CAAKO;EAClF;EAEA,MAAM,CAACI,cAAA,EAAgBb,cAAA,CAAe,GAAGR,oBAAA,CAAqBoB,oBAAA,EAAsB;EAEpF;EACA;EACA;EACA,MAAMd,WAAA,GACJW,KAAA,IAASI,cAAA,KAAmB,aAAa,CAACJ,KAAK,CAACI,cAAA,CAAe,GAAG,YAAYA,cAAA;EAEhF,MAAMC,KAAA,GAAQlB,OAAA,CAAQ;IACpB,MAAMmB,cAAA,GAAiBN,KAAA,GAAQA,KAAK,CAACX,WAAA,CAAY,GAAGQ,SAAA;IACpD,OAAO;MACLR,WAAA;MACAiB,cAAA;MACAL,sBAAA;MACAX,WAAA;MACAQ,oBAAA;MACAP,cAAA;MACAS;IACF;EACF,GAAG,CACDX,WAAA,EACAC,WAAA,EACAW,sBAAA,EACAH,oBAAA,EACAP,cAAA,EACAS,KAAA,CACD;EAED,oBAAOO,IAAA,CAACnB,mBAAA;IAAoBiB,KAAA,EAAOA,KAAA;cAAQH;;AAC7C;AAEA;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,SAASP,gBAAA;EACd,OAAOT,GAAA,CAAIE,mBAAA;AACb","ignoreList":[]}
1
+ {"version":3,"file":"RichTextViewProvider.js","names":["useControllableState","React","createContext","use","useMemo","RichTextViewContext","currentView","inheritable","setCurrentView","RichTextViewProvider","args","parentContext","useRichTextView","hasOwnExplicitView","undefined","isControlledByParent","Boolean","views","hasExplicitCurrentView","children","currentViewFromProps","currentViewRaw","value","currentViewMap","_jsx"],"sources":["../../src/field/RichTextViewProvider.tsx"],"sourcesContent":["'use client'\nimport { useControllableState } from '@payloadcms/ui'\nimport React, { createContext, use, useMemo } from 'react'\n\nimport type { LexicalEditorNodeMap, LexicalEditorViewMap } from '../types/index.js'\n\n/**\n * Context for managing richtext editor view state and inheritance.\n */\ntype RichTextViewContextType = {\n /**\n * The currently active view name (e.g., 'default', 'frontend', 'debug').\n */\n currentView: string\n /**\n * The resolved node map for the current view, containing rendering overrides for each node type.\n */\n currentViewMap?: LexicalEditorNodeMap\n /**\n * True if the current view was explicitly set (via prop) by this provider or an ancestor.\n * Used to distinguish intentional view settings from automatic defaults.\n */\n hasExplicitCurrentView?: boolean\n /**\n * If true, nested richtext editors will inherit this provider's currentView and views.\n */\n inheritable?: boolean\n /**\n * True if this provider's view is controlled by an ancestor provider — either because the\n * ancestor has a views map (view-map inheritance) or an explicit `currentView` prop.\n * When true, the ViewSelector is hidden.\n */\n isControlledByParent?: boolean\n /**\n * Function to programmatically change the current view.\n */\n setCurrentView: (view: string) => void\n /**\n * Map of all available views for this editor. Each key is a view name, each value contains\n * admin config, node overrides, and lexical config for that view.\n */\n views?: LexicalEditorViewMap\n}\n\nconst RichTextViewContext = createContext<RichTextViewContextType>({\n currentView: 'default',\n inheritable: false,\n setCurrentView: () => {},\n})\n\n/**\n * Provider for managing richtext editor view state and its inheritance.\n *\n * Handles two key scenarios:\n * 1. **Explicit view setting**: Wrap with `currentView` and `inheritable={true}` to force nested editors to a specific view\n * 2. **View map inheritance**: Nested editors inherit `views` from parents, allowing view switching across the hierarchy\n *\n * When a nested editor inherits from a parent, its ViewSelector is hidden because the view is controlled by an ancestor.\n *\n * @example\n * Force all nested richtext editors to use \"frontend\" view:\n * ```tsx\n * <RichTextViewProvider currentView=\"frontend\" inheritable={true}>\n * <MyForm /> {/* All richtext fields inside will use \"frontend\" view }\n * </RichTextViewProvider>\n * ```\n */\nexport const RichTextViewProvider: React.FC<{\n children: React.ReactNode\n currentView?: string\n inheritable?: boolean\n views?: LexicalEditorViewMap\n}> = (args) => {\n const parentContext = useRichTextView()\n\n // Track if this provider explicitly sets currentView (not just using the default)\n const hasOwnExplicitView = args.currentView !== undefined\n\n const isControlledByParent =\n parentContext.inheritable &&\n (Boolean(parentContext.views) || Boolean(parentContext.hasExplicitCurrentView))\n\n // This provider has explicit currentView if it sets one OR inherits one from parent\n const hasExplicitCurrentView =\n hasOwnExplicitView ||\n (parentContext.inheritable && Boolean(parentContext.hasExplicitCurrentView))\n\n const {\n children,\n currentView: currentViewFromProps,\n inheritable,\n views,\n } = {\n children: args.children,\n currentView: isControlledByParent ? parentContext.currentView : args.currentView,\n // Propagate inheritable flag through the hierarchy\n inheritable: parentContext.inheritable || args.inheritable,\n // Only inherit views if parent has a views map\n views: isControlledByParent && parentContext.views ? parentContext.views : args.views,\n }\n\n const [currentViewRaw, setCurrentView] = useControllableState(currentViewFromProps, 'default')\n\n // Normalize currentView: if the requested view doesn't exist in this editor's\n // views map, fall back to 'default'. This ensures all consumers of useRichTextView()\n // see a consistent currentView that actually exists\n const currentView =\n views && currentViewRaw !== 'default' && !views[currentViewRaw] ? 'default' : currentViewRaw\n\n const value = useMemo(() => {\n const currentViewMap = views ? views[currentView] : undefined\n return {\n currentView,\n currentViewMap,\n hasExplicitCurrentView,\n inheritable,\n isControlledByParent,\n setCurrentView,\n views,\n }\n }, [\n currentView,\n inheritable,\n hasExplicitCurrentView,\n isControlledByParent,\n setCurrentView,\n views,\n ])\n\n return <RichTextViewContext value={value}>{children}</RichTextViewContext>\n}\n\n/**\n * Access the current richtext editor view context.\n *\n * Returns the active view name, node overrides, inheritance state, and a function to switch views.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { currentView, currentViewMap, isControlledByParent, setCurrentView } = useRichTextView()\n *\n * return (\n * <div>\n * <p>Active view: {currentView}</p>\n * {isControlledByParent && <p>View controlled by parent</p>}\n * {currentViewMap?.heading && <p>Custom heading renderer active</p>}\n * <button onClick={() => setCurrentView('frontend')}>Switch to frontend</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useRichTextView(): RichTextViewContextType {\n return use(RichTextViewContext)\n}\n"],"mappings":"AAAA;;;AACA,SAASA,oBAAoB,QAAQ;AACrC,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,OAAO,QAAQ;A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