@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
package/dist/hooks.js ADDED
@@ -0,0 +1,548 @@
1
+ import { afterChangeTraverseFields, afterReadTraverseFields, beforeChangeTraverseFields, beforeValidateTraverseFields } from 'payload';
2
+ import { recurseNodeTree } from './utilities/recurseNodeTree.js';
3
+ export const getLexicalHooks = ({
4
+ editorConfig
5
+ }) => {
6
+ return {
7
+ afterChange: [async args => {
8
+ const {
9
+ collection,
10
+ context: _context,
11
+ data,
12
+ field,
13
+ global,
14
+ indexPath,
15
+ operation,
16
+ originalDoc,
17
+ parentIsLocalized,
18
+ path,
19
+ previousDoc,
20
+ previousValue,
21
+ req,
22
+ schemaPath
23
+ } = args;
24
+ let {
25
+ value
26
+ } = args;
27
+ if (editorConfig?.features?.hooks?.afterChange?.length) {
28
+ for (const hook of editorConfig.features.hooks.afterChange) {
29
+ value = await hook(args);
30
+ }
31
+ }
32
+ if (!editorConfig.features.nodeHooks?.afterChange?.size && !editorConfig.features.getSubFields?.size) {
33
+ return value;
34
+ }
35
+ // TO-DO: We should not use context, as it is intended for external use only
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
+ const context = _context;
38
+ const nodeIDMap = {};
39
+ const previousNodeIDMap = {};
40
+ /**
41
+ * Get the originalNodeIDMap from the beforeValidate hook, which is always run before this hook.
42
+ */
43
+ const originalNodeIDMap = context?.internal?.richText?.[path.join('.')]?.originalNodeIDMap;
44
+ if (!originalNodeIDMap || !Object.keys(originalNodeIDMap).length || !value) {
45
+ return value;
46
+ }
47
+ recurseNodeTree({
48
+ nodeIDMap,
49
+ nodes: value?.root?.children ?? []
50
+ });
51
+ recurseNodeTree({
52
+ nodeIDMap: previousNodeIDMap,
53
+ nodes: previousValue?.root?.children ?? []
54
+ });
55
+ // eslint-disable-next-line prefer-const
56
+ for (let [id, node] of Object.entries(nodeIDMap)) {
57
+ const afterChangeHooks = editorConfig.features.nodeHooks?.afterChange;
58
+ const afterChangeHooksForNode = afterChangeHooks?.get(node.type);
59
+ if (afterChangeHooksForNode) {
60
+ for (const hook of afterChangeHooksForNode) {
61
+ if (!originalNodeIDMap[id]) {
62
+ console.warn('(afterChange) No original node found for node with id', id, 'node:', node, 'path', path.join('.'));
63
+ continue;
64
+ }
65
+ node = await hook({
66
+ context,
67
+ node,
68
+ operation,
69
+ originalNode: originalNodeIDMap[id],
70
+ parentRichTextFieldPath: path,
71
+ parentRichTextFieldSchemaPath: schemaPath,
72
+ previousNode: previousNodeIDMap[id],
73
+ req
74
+ });
75
+ }
76
+ }
77
+ const subFieldFn = editorConfig.features.getSubFields?.get(node.type);
78
+ const subFieldDataFn = editorConfig.features.getSubFieldsData?.get(node.type);
79
+ if (subFieldFn && subFieldDataFn) {
80
+ const subFields = subFieldFn({
81
+ node,
82
+ req
83
+ });
84
+ const nodeSiblingData = subFieldDataFn({
85
+ node,
86
+ req
87
+ }) ?? {};
88
+ const nodeSiblingDoc = subFieldDataFn({
89
+ node: originalNodeIDMap[id],
90
+ req
91
+ }) ?? {};
92
+ const nodePreviousSiblingDoc = subFieldDataFn({
93
+ node: previousNodeIDMap[id],
94
+ req
95
+ }) ?? {};
96
+ if (subFields?.length) {
97
+ await afterChangeTraverseFields({
98
+ blockData: nodeSiblingData,
99
+ collection,
100
+ context,
101
+ data: data ?? {},
102
+ doc: originalDoc,
103
+ fields: subFields,
104
+ global,
105
+ operation,
106
+ parentIndexPath: indexPath.join('-'),
107
+ parentIsLocalized: parentIsLocalized || field.localized || false,
108
+ parentPath: path.join('.'),
109
+ parentSchemaPath: schemaPath.join('.'),
110
+ previousDoc,
111
+ previousSiblingDoc: {
112
+ ...nodePreviousSiblingDoc
113
+ },
114
+ req,
115
+ siblingData: nodeSiblingData || {},
116
+ siblingDoc: {
117
+ ...nodeSiblingDoc
118
+ }
119
+ });
120
+ }
121
+ }
122
+ }
123
+ return value;
124
+ }],
125
+ afterRead: [
126
+ /**
127
+ * afterRead hooks do not receive the originalNode. Thus, they can run on all nodes, not just nodes with an ID.
128
+ */
129
+ async args => {
130
+ const {
131
+ collection,
132
+ context: context,
133
+ currentDepth,
134
+ depth,
135
+ draft,
136
+ fallbackLocale,
137
+ field,
138
+ fieldPromises,
139
+ findMany,
140
+ flattenLocales,
141
+ global,
142
+ indexPath,
143
+ locale,
144
+ originalDoc,
145
+ overrideAccess,
146
+ parentIsLocalized,
147
+ path,
148
+ populate,
149
+ populationPromises,
150
+ req,
151
+ schemaPath,
152
+ showHiddenFields,
153
+ triggerAccessControl,
154
+ triggerHooks
155
+ } = args;
156
+ let {
157
+ value
158
+ } = args;
159
+ if (editorConfig?.features?.hooks?.afterRead?.length) {
160
+ for (const hook of editorConfig.features.hooks.afterRead) {
161
+ value = await hook(args);
162
+ }
163
+ }
164
+ if (!editorConfig.features.nodeHooks?.afterRead?.size && !editorConfig.features.getSubFields?.size) {
165
+ return value;
166
+ }
167
+ const flattenedNodes = [];
168
+ recurseNodeTree({
169
+ flattenedNodes,
170
+ nodes: value?.root?.children ?? []
171
+ });
172
+ for (let node of flattenedNodes) {
173
+ const afterReadHooks = editorConfig.features.nodeHooks?.afterRead;
174
+ const afterReadHooksForNode = afterReadHooks?.get(node.type);
175
+ if (afterReadHooksForNode) {
176
+ for (const hook of afterReadHooksForNode) {
177
+ node = await hook({
178
+ context,
179
+ currentDepth: currentDepth,
180
+ depth: depth,
181
+ draft: draft,
182
+ fallbackLocale: fallbackLocale,
183
+ fieldPromises: fieldPromises,
184
+ findMany: findMany,
185
+ flattenLocales: flattenLocales,
186
+ locale: locale,
187
+ node,
188
+ overrideAccess: overrideAccess,
189
+ parentRichTextFieldPath: path,
190
+ parentRichTextFieldSchemaPath: schemaPath,
191
+ populateArg: populate,
192
+ populationPromises: populationPromises,
193
+ req,
194
+ showHiddenFields: showHiddenFields,
195
+ triggerAccessControl: triggerAccessControl,
196
+ triggerHooks: triggerHooks
197
+ });
198
+ }
199
+ }
200
+ const subFieldFn = editorConfig.features.getSubFields?.get(node.type);
201
+ const subFieldDataFn = editorConfig.features.getSubFieldsData?.get(node.type);
202
+ if (subFieldFn && subFieldDataFn) {
203
+ const subFields = subFieldFn({
204
+ node,
205
+ req
206
+ });
207
+ const nodeSiblingData = subFieldDataFn({
208
+ node,
209
+ req
210
+ }) ?? {};
211
+ if (subFields?.length) {
212
+ afterReadTraverseFields({
213
+ blockData: nodeSiblingData,
214
+ collection,
215
+ context,
216
+ currentDepth: currentDepth,
217
+ depth: depth,
218
+ doc: originalDoc,
219
+ draft: draft,
220
+ fallbackLocale: fallbackLocale,
221
+ fieldPromises: fieldPromises,
222
+ fields: subFields,
223
+ findMany: findMany,
224
+ flattenLocales: flattenLocales,
225
+ global,
226
+ locale: locale,
227
+ overrideAccess: overrideAccess,
228
+ parentIndexPath: indexPath.join('-'),
229
+ parentIsLocalized: parentIsLocalized || field.localized || false,
230
+ parentPath: path.join('.'),
231
+ parentSchemaPath: schemaPath.join('.'),
232
+ populate,
233
+ populationPromises: populationPromises,
234
+ req,
235
+ showHiddenFields: showHiddenFields,
236
+ siblingDoc: nodeSiblingData,
237
+ triggerAccessControl,
238
+ triggerHooks
239
+ });
240
+ }
241
+ }
242
+ }
243
+ return value;
244
+ }],
245
+ beforeChange: [async args => {
246
+ const {
247
+ collection,
248
+ context: _context,
249
+ data,
250
+ docWithLocales,
251
+ errors,
252
+ field,
253
+ fieldLabelPath,
254
+ global,
255
+ indexPath,
256
+ mergeLocaleActions,
257
+ operation,
258
+ originalDoc,
259
+ overrideAccess,
260
+ parentIsLocalized,
261
+ path,
262
+ previousValue,
263
+ req,
264
+ schemaPath,
265
+ siblingData,
266
+ siblingDocWithLocales,
267
+ skipValidation
268
+ } = args;
269
+ let {
270
+ value
271
+ } = args;
272
+ if (editorConfig?.features?.hooks?.beforeChange?.length) {
273
+ for (const hook of editorConfig.features.hooks.beforeChange) {
274
+ value = await hook(args);
275
+ }
276
+ }
277
+ if (!editorConfig.features.nodeHooks?.beforeChange?.size && !editorConfig.features.getSubFields?.size) {
278
+ return value;
279
+ }
280
+ // TO-DO: We should not use context, as it is intended for external use only
281
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
282
+ const context = _context;
283
+ const nodeIDMap = {};
284
+ /**
285
+ * Get the originalNodeIDMap from the beforeValidate hook, which is always run before this hook.
286
+ */
287
+ const originalNodeIDMap = context?.internal?.richText?.[path.join('.')]?.originalNodeIDMap;
288
+ if (!originalNodeIDMap || !Object.keys(originalNodeIDMap).length || !value) {
289
+ return value;
290
+ }
291
+ const previousNodeIDMap = {};
292
+ const originalNodeWithLocalesIDMap = {};
293
+ recurseNodeTree({
294
+ nodeIDMap,
295
+ nodes: value?.root?.children ?? []
296
+ });
297
+ recurseNodeTree({
298
+ nodeIDMap: previousNodeIDMap,
299
+ nodes: previousValue?.root?.children ?? []
300
+ });
301
+ if (field.name && siblingDocWithLocales?.[field.name]) {
302
+ recurseNodeTree({
303
+ nodeIDMap: originalNodeWithLocalesIDMap,
304
+ nodes: siblingDocWithLocales[field.name]?.root?.children ?? []
305
+ });
306
+ }
307
+ // eslint-disable-next-line prefer-const
308
+ for (let [id, node] of Object.entries(nodeIDMap)) {
309
+ const beforeChangeHooks = editorConfig.features.nodeHooks?.beforeChange;
310
+ const beforeChangeHooksForNode = beforeChangeHooks?.get(node.type);
311
+ if (beforeChangeHooksForNode) {
312
+ for (const hook of beforeChangeHooksForNode) {
313
+ if (!originalNodeIDMap[id]) {
314
+ console.warn('(beforeChange) No original node found for node with id', id, 'node:', node, 'path', path.join('.'));
315
+ continue;
316
+ }
317
+ node = await hook({
318
+ context,
319
+ errors: errors,
320
+ mergeLocaleActions: mergeLocaleActions,
321
+ node,
322
+ operation: operation,
323
+ originalNode: originalNodeIDMap[id],
324
+ originalNodeWithLocales: originalNodeWithLocalesIDMap[id],
325
+ parentRichTextFieldPath: path,
326
+ parentRichTextFieldSchemaPath: schemaPath,
327
+ previousNode: previousNodeIDMap[id],
328
+ req,
329
+ skipValidation: skipValidation
330
+ });
331
+ }
332
+ }
333
+ const subFieldFn = editorConfig.features.getSubFields?.get(node.type);
334
+ const subFieldDataFn = editorConfig.features.getSubFieldsData?.get(node.type);
335
+ if (subFieldFn && subFieldDataFn) {
336
+ const subFields = subFieldFn({
337
+ node,
338
+ req
339
+ });
340
+ const nodeSiblingData = subFieldDataFn({
341
+ node,
342
+ req
343
+ }) ?? {};
344
+ const nodeSiblingDocWithLocales = subFieldDataFn({
345
+ node: originalNodeWithLocalesIDMap[id],
346
+ req
347
+ }) ?? {};
348
+ const nodePreviousSiblingDoc = subFieldDataFn({
349
+ node: previousNodeIDMap[id],
350
+ req
351
+ }) ?? {};
352
+ if (subFields?.length) {
353
+ await beforeChangeTraverseFields({
354
+ id,
355
+ blockData: nodeSiblingData,
356
+ collection,
357
+ context,
358
+ data: data ?? {},
359
+ doc: originalDoc ?? {},
360
+ docWithLocales: docWithLocales ?? {},
361
+ errors: errors,
362
+ fieldLabelPath,
363
+ fields: subFields,
364
+ global,
365
+ mergeLocaleActions: mergeLocaleActions,
366
+ operation: operation,
367
+ overrideAccess,
368
+ parentIndexPath: indexPath.join('-'),
369
+ parentIsLocalized: parentIsLocalized || field.localized || false,
370
+ parentPath: path.join('.'),
371
+ parentSchemaPath: schemaPath.join('.'),
372
+ req,
373
+ siblingData: nodeSiblingData,
374
+ siblingDoc: nodePreviousSiblingDoc,
375
+ siblingDocWithLocales: nodeSiblingDocWithLocales ?? {},
376
+ skipValidation
377
+ });
378
+ }
379
+ }
380
+ }
381
+ /**
382
+ * within the beforeChange hook, id's may be re-generated.
383
+ * Example:
384
+ * 1. Seed data contains IDs for block feature blocks.
385
+ * 2. Those are used in beforeValidate
386
+ * 3. in beforeChange, those IDs are regenerated, because you cannot provide IDs during document creation. See baseIDField beforeChange hook for reasoning
387
+ * 4. Thus, in order for all post-beforeChange hooks to receive the correct ID, we need to update the originalNodeIDMap with the new ID's, by regenerating the nodeIDMap.
388
+ * The reason this is not generated for every hook, is to save on performance. We know we only really have to generate it in beforeValidate, which is the first hook,
389
+ * and in beforeChange, which is where modifications to the provided IDs can occur.
390
+ */
391
+ const newOriginalNodeIDMap = {};
392
+ const previousOriginalValue = siblingData[field.name];
393
+ recurseNodeTree({
394
+ nodeIDMap: newOriginalNodeIDMap,
395
+ nodes: previousOriginalValue?.root?.children ?? []
396
+ });
397
+ if (!context.internal) {
398
+ // Add to context, for other hooks to use
399
+ context.internal = {};
400
+ }
401
+ if (!context.internal.richText) {
402
+ context.internal.richText = {};
403
+ }
404
+ context.internal.richText[path.join('.')] = {
405
+ originalNodeIDMap: newOriginalNodeIDMap
406
+ };
407
+ return value;
408
+ }],
409
+ beforeValidate: [async args => {
410
+ const {
411
+ collection,
412
+ context,
413
+ data,
414
+ field,
415
+ global,
416
+ indexPath,
417
+ operation,
418
+ originalDoc,
419
+ overrideAccess,
420
+ parentIsLocalized,
421
+ path,
422
+ previousValue,
423
+ req,
424
+ schemaPath
425
+ } = args;
426
+ let {
427
+ value
428
+ } = args;
429
+ if (editorConfig?.features?.hooks?.beforeValidate?.length) {
430
+ for (const hook of editorConfig.features.hooks.beforeValidate) {
431
+ value = await hook(args);
432
+ }
433
+ }
434
+ // return value if there are NO hooks
435
+ if (!editorConfig.features.nodeHooks?.beforeValidate?.size && !editorConfig.features.nodeHooks?.afterChange?.size && !editorConfig.features.nodeHooks?.beforeChange?.size && !editorConfig.features.getSubFields?.size) {
436
+ return value;
437
+ }
438
+ /**
439
+ * beforeValidate is the first field hook which runs. This is where we can create the node map, which can then be used in the other hooks.
440
+ *
441
+ */ /**
442
+ * flattenedNodes contains all nodes in the editor, in the order they appear in the editor. They will be used for the following hooks:
443
+ * - afterRead
444
+ *
445
+ * The other hooks require nodes to have IDs, which is why those are ran only from the nodeIDMap. They require IDs because they have both doc/siblingDoc and data/siblingData, and
446
+ * thus require a reliable way to match new node data to old node data. Given that node positions can change in between hooks, this is only reliably possible for nodes which are saved with
447
+ * an ID.
448
+ */ //const flattenedNodes: SerializedLexicalNode[] = []
449
+ /**
450
+ * Only nodes with id's (so, nodes with hooks added to them) will be added to the nodeIDMap. They will be used for the following hooks:
451
+ * - afterChange
452
+ * - beforeChange
453
+ * - beforeValidate
454
+ *
455
+ * Other hooks are handled by the flattenedNodes. All nodes in the nodeIDMap are part of flattenedNodes.
456
+ */
457
+ const originalNodeIDMap = {};
458
+ recurseNodeTree({
459
+ nodeIDMap: originalNodeIDMap,
460
+ nodes: previousValue?.root?.children ?? []
461
+ });
462
+ if (!context.internal) {
463
+ // Add to context, for other hooks to use
464
+ context.internal = {};
465
+ }
466
+ if (!context.internal.richText) {
467
+ context.internal.richText = {};
468
+ }
469
+ context.internal.richText[path.join('.')] = {
470
+ originalNodeIDMap
471
+ };
472
+ /**
473
+ * Now that the maps for all hooks are set up, we can run the validate hook
474
+ */
475
+ if (!editorConfig.features.nodeHooks?.beforeValidate?.size) {
476
+ return value;
477
+ }
478
+ const nodeIDMap = {};
479
+ recurseNodeTree({
480
+ //flattenedNodes,
481
+ nodeIDMap,
482
+ nodes: value?.root?.children ?? []
483
+ });
484
+ // eslint-disable-next-line prefer-const
485
+ for (let [id, node] of Object.entries(nodeIDMap)) {
486
+ const beforeValidateHooks = editorConfig.features.nodeHooks.beforeValidate;
487
+ const beforeValidateHooksForNode = beforeValidateHooks?.get(node.type);
488
+ if (beforeValidateHooksForNode) {
489
+ for (const hook of beforeValidateHooksForNode) {
490
+ if (!originalNodeIDMap[id]) {
491
+ console.warn('(beforeValidate) No original node found for node with id', id, 'node:', node, 'path', path.join('.'));
492
+ continue;
493
+ }
494
+ node = await hook({
495
+ context,
496
+ node,
497
+ operation,
498
+ originalNode: originalNodeIDMap[id],
499
+ overrideAccess: overrideAccess,
500
+ parentRichTextFieldPath: path,
501
+ parentRichTextFieldSchemaPath: schemaPath,
502
+ req
503
+ });
504
+ }
505
+ }
506
+ const subFieldFn = editorConfig.features.getSubFields?.get(node.type);
507
+ const subFieldDataFn = editorConfig.features.getSubFieldsData?.get(node.type);
508
+ if (subFieldFn && subFieldDataFn) {
509
+ const subFields = subFieldFn({
510
+ node,
511
+ req
512
+ });
513
+ const nodeSiblingData = subFieldDataFn({
514
+ node,
515
+ req
516
+ }) ?? {};
517
+ const nodeSiblingDoc = subFieldDataFn({
518
+ node: originalNodeIDMap[id],
519
+ req
520
+ }) ?? {};
521
+ if (subFields?.length) {
522
+ await beforeValidateTraverseFields({
523
+ id,
524
+ blockData: nodeSiblingData,
525
+ collection,
526
+ context,
527
+ data,
528
+ doc: originalDoc,
529
+ fields: subFields,
530
+ global,
531
+ operation,
532
+ overrideAccess: overrideAccess,
533
+ parentIndexPath: indexPath.join('-'),
534
+ parentIsLocalized: parentIsLocalized || field.localized || false,
535
+ parentPath: path.join('.'),
536
+ parentSchemaPath: schemaPath.join('.'),
537
+ req,
538
+ siblingData: nodeSiblingData,
539
+ siblingDoc: nodeSiblingDoc
540
+ });
541
+ }
542
+ }
543
+ }
544
+ return value;
545
+ }]
546
+ };
547
+ };
548
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","names":["afterChangeTraverseFields","afterReadTraverseFields","beforeChangeTraverseFields","beforeValidateTraverseFields","recurseNodeTree","getLexicalHooks","editorConfig","afterChange","args","collection","context","_context","data","field","global","indexPath","operation","originalDoc","parentIsLocalized","path","previousDoc","previousValue","req","schemaPath","value","features","hooks","length","hook","nodeHooks","size","getSubFields","nodeIDMap","previousNodeIDMap","originalNodeIDMap","internal","richText","join","Object","keys","nodes","root","children","id","node","entries","afterChangeHooks","afterChangeHooksForNode","get","type","console","warn","originalNode","parentRichTextFieldPath","parentRichTextFieldSchemaPath","previousNode","subFieldFn","subFieldDataFn","getSubFieldsData","subFields","nodeSiblingData","nodeSiblingDoc","nodePreviousSiblingDoc","blockData","doc","fields","parentIndexPath","localized","parentPath","parentSchemaPath","previousSiblingDoc","siblingData","siblingDoc","afterRead","currentDepth","depth","draft","fallbackLocale","fieldPromises","findMany","flattenLocales","locale","overrideAccess","populate","populationPromises","showHiddenFields","triggerAccessControl","triggerHooks","flattenedNodes","afterReadHooks","afterReadHooksForNode","populateArg","beforeChange","docWithLocales","errors","fieldLabelPath","mergeLocaleActions","siblingDocWithLocales","skipValidation","originalNodeWithLocalesIDMap","name","beforeChangeHooks","beforeChangeHooksForNode","originalNodeWithLocales","nodeSiblingDocWithLocales","newOriginalNodeIDMap","previousOriginalValue","beforeValidate","beforeValidateHooks","beforeValidateHooksForNode"],"sources":["../src/hooks.ts"],"sourcesContent":["import type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\n\nimport {\n afterChangeTraverseFields,\n afterReadTraverseFields,\n beforeChangeTraverseFields,\n beforeValidateTraverseFields,\n type RichTextHooks,\n} from 'payload'\n\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\n\nimport { recurseNodeTree } from './utilities/recurseNodeTree.js'\n\nexport const getLexicalHooks: (args: {\n editorConfig: SanitizedServerEditorConfig\n}) => RichTextHooks = ({ editorConfig }) => {\n return {\n afterChange: [\n async (args) => {\n const {\n collection,\n context: _context,\n data,\n field,\n global,\n indexPath,\n operation,\n originalDoc,\n parentIsLocalized,\n path,\n previousDoc,\n previousValue,\n req,\n schemaPath,\n } = args\n\n let { value } = args\n if (editorConfig?.features?.hooks?.afterChange?.length) {\n for (const hook of editorConfig.features.hooks.afterChange) {\n value = await hook(args)\n }\n }\n if (\n !editorConfig.features.nodeHooks?.afterChange?.size &&\n !editorConfig.features.getSubFields?.size\n ) {\n return value\n }\n // TO-DO: We should not use context, as it is intended for external use only\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const context: any = _context\n const nodeIDMap: {\n [key: string]: SerializedLexicalNode\n } = {}\n\n const previousNodeIDMap: {\n [key: string]: SerializedLexicalNode\n } = {}\n\n /**\n * Get the originalNodeIDMap from the beforeValidate hook, which is always run before this hook.\n */\n const originalNodeIDMap: {\n [key: string]: SerializedLexicalNode\n } = context?.internal?.richText?.[path.join('.')]?.originalNodeIDMap\n\n if (!originalNodeIDMap || !Object.keys(originalNodeIDMap).length || !value) {\n return value\n }\n\n recurseNodeTree({\n nodeIDMap,\n nodes: (value as SerializedEditorState)?.root?.children ?? [],\n })\n\n recurseNodeTree({\n nodeIDMap: previousNodeIDMap,\n nodes: (previousValue as SerializedEditorState)?.root?.children ?? [],\n })\n\n // eslint-disable-next-line prefer-const\n for (let [id, node] of Object.entries(nodeIDMap)) {\n const afterChangeHooks = editorConfig.features.nodeHooks?.afterChange\n const afterChangeHooksForNode = afterChangeHooks?.get(node.type)\n if (afterChangeHooksForNode) {\n for (const hook of afterChangeHooksForNode) {\n if (!originalNodeIDMap[id]) {\n console.warn(\n '(afterChange) No original node found for node with id',\n id,\n 'node:',\n node,\n 'path',\n path.join('.'),\n )\n continue\n }\n node = await hook({\n context,\n node,\n operation,\n originalNode: originalNodeIDMap[id],\n parentRichTextFieldPath: path,\n parentRichTextFieldSchemaPath: schemaPath,\n\n previousNode: previousNodeIDMap[id]!,\n req,\n })\n }\n }\n const subFieldFn = editorConfig.features.getSubFields?.get(node.type)\n const subFieldDataFn = editorConfig.features.getSubFieldsData?.get(node.type)\n\n if (subFieldFn && subFieldDataFn) {\n const subFields = subFieldFn({ node, req })\n const nodeSiblingData = subFieldDataFn({ node, req }) ?? {}\n\n const nodeSiblingDoc = subFieldDataFn({ node: originalNodeIDMap[id]!, req }) ?? {}\n const nodePreviousSiblingDoc =\n subFieldDataFn({ node: previousNodeIDMap[id]!, req }) ?? {}\n\n if (subFields?.length) {\n await afterChangeTraverseFields({\n blockData: nodeSiblingData,\n collection,\n context,\n data: data ?? {},\n doc: originalDoc,\n fields: subFields,\n global,\n operation,\n parentIndexPath: indexPath.join('-'),\n parentIsLocalized: parentIsLocalized || field.localized || false,\n parentPath: path.join('.'),\n parentSchemaPath: schemaPath.join('.'),\n previousDoc,\n previousSiblingDoc: { ...nodePreviousSiblingDoc },\n req,\n siblingData: nodeSiblingData || {},\n siblingDoc: { ...nodeSiblingDoc },\n })\n }\n }\n }\n return value\n },\n ],\n afterRead: [\n /**\n * afterRead hooks do not receive the originalNode. Thus, they can run on all nodes, not just nodes with an ID.\n */\n async (args) => {\n const {\n collection,\n context: context,\n currentDepth,\n depth,\n draft,\n fallbackLocale,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n global,\n indexPath,\n locale,\n originalDoc,\n overrideAccess,\n parentIsLocalized,\n path,\n populate,\n populationPromises,\n req,\n schemaPath,\n showHiddenFields,\n triggerAccessControl,\n triggerHooks,\n } = args\n\n let { value } = args\n\n if (editorConfig?.features?.hooks?.afterRead?.length) {\n for (const hook of editorConfig.features.hooks.afterRead) {\n value = await hook(args)\n }\n }\n\n if (\n !editorConfig.features.nodeHooks?.afterRead?.size &&\n !editorConfig.features.getSubFields?.size\n ) {\n return value\n }\n const flattenedNodes: SerializedLexicalNode[] = []\n\n recurseNodeTree({\n flattenedNodes,\n nodes: (value as SerializedEditorState)?.root?.children ?? [],\n })\n\n for (let node of flattenedNodes) {\n const afterReadHooks = editorConfig.features.nodeHooks?.afterRead\n const afterReadHooksForNode = afterReadHooks?.get(node.type)\n if (afterReadHooksForNode) {\n for (const hook of afterReadHooksForNode) {\n node = await hook({\n context,\n currentDepth: currentDepth!,\n depth: depth!,\n draft: draft!,\n fallbackLocale: fallbackLocale!,\n fieldPromises: fieldPromises!,\n findMany: findMany!,\n flattenLocales: flattenLocales!,\n locale: locale!,\n node,\n overrideAccess: overrideAccess!,\n parentRichTextFieldPath: path,\n parentRichTextFieldSchemaPath: schemaPath,\n populateArg: populate,\n populationPromises: populationPromises!,\n req,\n showHiddenFields: showHiddenFields!,\n triggerAccessControl: triggerAccessControl!,\n triggerHooks: triggerHooks!,\n })\n }\n }\n const subFieldFn = editorConfig.features.getSubFields?.get(node.type)\n const subFieldDataFn = editorConfig.features.getSubFieldsData?.get(node.type)\n\n if (subFieldFn && subFieldDataFn) {\n const subFields = subFieldFn({ node, req })\n const nodeSiblingData = subFieldDataFn({ node, req }) ?? {}\n\n if (subFields?.length) {\n afterReadTraverseFields({\n blockData: nodeSiblingData,\n collection,\n context,\n currentDepth: currentDepth!,\n depth: depth!,\n doc: originalDoc,\n draft: draft!,\n fallbackLocale: fallbackLocale!,\n fieldPromises: fieldPromises!,\n fields: subFields,\n findMany: findMany!,\n flattenLocales: flattenLocales!,\n global,\n locale: locale!,\n overrideAccess: overrideAccess!,\n parentIndexPath: indexPath.join('-'),\n parentIsLocalized: parentIsLocalized || field.localized || false,\n parentPath: path.join('.'),\n parentSchemaPath: schemaPath.join('.'),\n populate,\n populationPromises: populationPromises!,\n req,\n showHiddenFields: showHiddenFields!,\n siblingDoc: nodeSiblingData,\n triggerAccessControl,\n triggerHooks,\n })\n }\n }\n }\n\n return value\n },\n ],\n beforeChange: [\n async (args) => {\n const {\n collection,\n context: _context,\n data,\n docWithLocales,\n errors,\n field,\n fieldLabelPath,\n global,\n indexPath,\n mergeLocaleActions,\n operation,\n originalDoc,\n overrideAccess,\n parentIsLocalized,\n path,\n previousValue,\n req,\n schemaPath,\n siblingData,\n siblingDocWithLocales,\n skipValidation,\n } = args\n\n let { value } = args\n\n if (editorConfig?.features?.hooks?.beforeChange?.length) {\n for (const hook of editorConfig.features.hooks.beforeChange) {\n value = await hook(args)\n }\n }\n\n if (\n !editorConfig.features.nodeHooks?.beforeChange?.size &&\n !editorConfig.features.getSubFields?.size\n ) {\n return value\n }\n\n // TO-DO: We should not use context, as it is intended for external use only\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const context: any = _context\n const nodeIDMap: {\n [key: string]: SerializedLexicalNode\n } = {}\n\n /**\n * Get the originalNodeIDMap from the beforeValidate hook, which is always run before this hook.\n */\n const originalNodeIDMap: {\n [key: string]: SerializedLexicalNode\n } = context?.internal?.richText?.[path.join('.')]?.originalNodeIDMap\n\n if (!originalNodeIDMap || !Object.keys(originalNodeIDMap).length || !value) {\n return value\n }\n\n const previousNodeIDMap: {\n [key: string]: SerializedLexicalNode\n } = {}\n\n const originalNodeWithLocalesIDMap: {\n [key: string]: SerializedLexicalNode\n } = {}\n\n recurseNodeTree({\n nodeIDMap,\n nodes: (value as SerializedEditorState)?.root?.children ?? [],\n })\n\n recurseNodeTree({\n nodeIDMap: previousNodeIDMap,\n nodes: (previousValue as SerializedEditorState)?.root?.children ?? [],\n })\n if (field.name && siblingDocWithLocales?.[field.name]) {\n recurseNodeTree({\n nodeIDMap: originalNodeWithLocalesIDMap,\n nodes:\n (siblingDocWithLocales[field.name] as SerializedEditorState)?.root?.children ?? [],\n })\n }\n\n // eslint-disable-next-line prefer-const\n for (let [id, node] of Object.entries(nodeIDMap)) {\n const beforeChangeHooks = editorConfig.features.nodeHooks?.beforeChange\n const beforeChangeHooksForNode = beforeChangeHooks?.get(node.type)\n if (beforeChangeHooksForNode) {\n for (const hook of beforeChangeHooksForNode) {\n if (!originalNodeIDMap[id]) {\n console.warn(\n '(beforeChange) No original node found for node with id',\n id,\n 'node:',\n node,\n 'path',\n path.join('.'),\n )\n continue\n }\n node = await hook({\n context,\n errors: errors!,\n mergeLocaleActions: mergeLocaleActions!,\n node,\n operation: operation!,\n originalNode: originalNodeIDMap[id],\n originalNodeWithLocales: originalNodeWithLocalesIDMap[id],\n parentRichTextFieldPath: path,\n parentRichTextFieldSchemaPath: schemaPath,\n previousNode: previousNodeIDMap[id]!,\n req,\n skipValidation: skipValidation!,\n })\n }\n }\n\n const subFieldFn = editorConfig.features.getSubFields?.get(node.type)\n const subFieldDataFn = editorConfig.features.getSubFieldsData?.get(node.type)\n\n if (subFieldFn && subFieldDataFn) {\n const subFields = subFieldFn({ node, req })\n const nodeSiblingData = subFieldDataFn({ node, req }) ?? {}\n const nodeSiblingDocWithLocales =\n subFieldDataFn({\n node: originalNodeWithLocalesIDMap[id]!,\n req,\n }) ?? {}\n const nodePreviousSiblingDoc =\n subFieldDataFn({ node: previousNodeIDMap[id]!, req }) ?? {}\n\n if (subFields?.length) {\n await beforeChangeTraverseFields({\n id,\n blockData: nodeSiblingData,\n collection,\n context,\n data: data ?? {},\n doc: originalDoc ?? {},\n docWithLocales: docWithLocales ?? {},\n errors: errors!,\n fieldLabelPath,\n fields: subFields,\n global,\n mergeLocaleActions: mergeLocaleActions!,\n operation: operation!,\n overrideAccess,\n parentIndexPath: indexPath.join('-'),\n parentIsLocalized: parentIsLocalized || field.localized || false,\n parentPath: path.join('.'),\n parentSchemaPath: schemaPath.join('.'),\n req,\n siblingData: nodeSiblingData,\n siblingDoc: nodePreviousSiblingDoc,\n siblingDocWithLocales: nodeSiblingDocWithLocales ?? {},\n skipValidation,\n })\n }\n }\n }\n\n /**\n * within the beforeChange hook, id's may be re-generated.\n * Example:\n * 1. Seed data contains IDs for block feature blocks.\n * 2. Those are used in beforeValidate\n * 3. in beforeChange, those IDs are regenerated, because you cannot provide IDs during document creation. See baseIDField beforeChange hook for reasoning\n * 4. Thus, in order for all post-beforeChange hooks to receive the correct ID, we need to update the originalNodeIDMap with the new ID's, by regenerating the nodeIDMap.\n * The reason this is not generated for every hook, is to save on performance. We know we only really have to generate it in beforeValidate, which is the first hook,\n * and in beforeChange, which is where modifications to the provided IDs can occur.\n */\n const newOriginalNodeIDMap: {\n [key: string]: SerializedLexicalNode\n } = {}\n\n const previousOriginalValue = siblingData[field.name!]\n\n recurseNodeTree({\n nodeIDMap: newOriginalNodeIDMap,\n nodes: (previousOriginalValue as SerializedEditorState)?.root?.children ?? [],\n })\n\n if (!context.internal) {\n // Add to context, for other hooks to use\n context.internal = {}\n }\n if (!context.internal.richText) {\n context.internal.richText = {}\n }\n context.internal.richText[path.join('.')] = {\n originalNodeIDMap: newOriginalNodeIDMap,\n }\n\n return value\n },\n ],\n beforeValidate: [\n async (args) => {\n const {\n collection,\n context,\n data,\n field,\n global,\n indexPath,\n operation,\n originalDoc,\n overrideAccess,\n parentIsLocalized,\n path,\n previousValue,\n req,\n schemaPath,\n } = args\n\n let { value } = args\n if (editorConfig?.features?.hooks?.beforeValidate?.length) {\n for (const hook of editorConfig.features.hooks.beforeValidate) {\n value = await hook(args)\n }\n }\n\n // return value if there are NO hooks\n if (\n !editorConfig.features.nodeHooks?.beforeValidate?.size &&\n !editorConfig.features.nodeHooks?.afterChange?.size &&\n !editorConfig.features.nodeHooks?.beforeChange?.size &&\n !editorConfig.features.getSubFields?.size\n ) {\n return value\n }\n\n /**\n * beforeValidate is the first field hook which runs. This is where we can create the node map, which can then be used in the other hooks.\n *\n */\n\n /**\n * flattenedNodes contains all nodes in the editor, in the order they appear in the editor. They will be used for the following hooks:\n * - afterRead\n *\n * The other hooks require nodes to have IDs, which is why those are ran only from the nodeIDMap. They require IDs because they have both doc/siblingDoc and data/siblingData, and\n * thus require a reliable way to match new node data to old node data. Given that node positions can change in between hooks, this is only reliably possible for nodes which are saved with\n * an ID.\n */\n //const flattenedNodes: SerializedLexicalNode[] = []\n\n /**\n * Only nodes with id's (so, nodes with hooks added to them) will be added to the nodeIDMap. They will be used for the following hooks:\n * - afterChange\n * - beforeChange\n * - beforeValidate\n *\n * Other hooks are handled by the flattenedNodes. All nodes in the nodeIDMap are part of flattenedNodes.\n */\n\n const originalNodeIDMap: {\n [key: string]: SerializedLexicalNode\n } = {}\n\n recurseNodeTree({\n nodeIDMap: originalNodeIDMap,\n nodes: (previousValue as SerializedEditorState)?.root?.children ?? [],\n })\n\n if (!context.internal) {\n // Add to context, for other hooks to use\n context.internal = {}\n }\n if (!(context as any).internal.richText) {\n ;(context as any).internal.richText = {}\n }\n ;(context as any).internal.richText[path.join('.')] = {\n originalNodeIDMap,\n }\n\n /**\n * Now that the maps for all hooks are set up, we can run the validate hook\n */\n if (!editorConfig.features.nodeHooks?.beforeValidate?.size) {\n return value\n }\n const nodeIDMap: {\n [key: string]: SerializedLexicalNode\n } = {}\n recurseNodeTree({\n //flattenedNodes,\n nodeIDMap,\n nodes: (value as SerializedEditorState)?.root?.children ?? [],\n })\n\n // eslint-disable-next-line prefer-const\n for (let [id, node] of Object.entries(nodeIDMap)) {\n const beforeValidateHooks = editorConfig.features.nodeHooks.beforeValidate\n const beforeValidateHooksForNode = beforeValidateHooks?.get(node.type)\n if (beforeValidateHooksForNode) {\n for (const hook of beforeValidateHooksForNode) {\n if (!originalNodeIDMap[id]) {\n console.warn(\n '(beforeValidate) No original node found for node with id',\n id,\n 'node:',\n node,\n 'path',\n path.join('.'),\n )\n continue\n }\n node = await hook({\n context,\n node,\n operation,\n originalNode: originalNodeIDMap[id],\n overrideAccess: overrideAccess!,\n parentRichTextFieldPath: path,\n parentRichTextFieldSchemaPath: schemaPath,\n req,\n })\n }\n }\n const subFieldFn = editorConfig.features.getSubFields?.get(node.type)\n const subFieldDataFn = editorConfig.features.getSubFieldsData?.get(node.type)\n\n if (subFieldFn && subFieldDataFn) {\n const subFields = subFieldFn({ node, req })\n const nodeSiblingData = subFieldDataFn({ node, req }) ?? {}\n\n const nodeSiblingDoc = subFieldDataFn({ node: originalNodeIDMap[id]!, req }) ?? {}\n\n if (subFields?.length) {\n await beforeValidateTraverseFields({\n id,\n blockData: nodeSiblingData,\n collection,\n context,\n data,\n doc: originalDoc,\n fields: subFields,\n global,\n operation,\n overrideAccess: overrideAccess!,\n parentIndexPath: indexPath.join('-'),\n parentIsLocalized: parentIsLocalized || field.localized || false,\n parentPath: path.join('.'),\n parentSchemaPath: schemaPath.join('.'),\n req,\n siblingData: nodeSiblingData,\n siblingDoc: nodeSiblingDoc,\n })\n }\n }\n }\n\n return value\n },\n ],\n }\n}\n"],"mappings":"AAEA,SACEA,yBAAyB,EACzBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,4BAA4B,QAEvB;AAIP,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,eAAA,GAESA,CAAC;EAAEC;AAAY,CAAE;EACrC,OAAO;IACLC,WAAA,EAAa,CACX,MAAOC,IAAA;MACL,MAAM;QACJC,UAAU;QACVC,OAAA,EAASC,QAAQ;QACjBC,IAAI;QACJC,KAAK;QACLC,MAAM;QACNC,SAAS;QACTC,SAAS;QACTC,WAAW;QACXC,iBAAiB;QACjBC,IAAI;QACJC,WAAW;QACXC,aAAa;QACbC,GAAG;QACHC;MAAU,CACX,GAAGf,IAAA;MAEJ,IAAI;QAAEgB;MAAK,CAAE,GAAGhB,IAAA;MAChB,IAAIF,YAAA,EAAcmB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