@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/index.js CHANGED
@@ -1,12 +1,13 @@
1
- import { afterChangeTraverseFields, afterReadTraverseFields, beforeChangeTraverseFields, beforeValidateTraverseFields, checkDependencies, deepMergeSimple, withNullableJSONSchemaType } from 'payload';
1
+ import { checkDependencies, deepMergeSimple } from 'payload';
2
+ import { getLexicalHooks } from './hooks.js';
2
3
  import { i18n } from './i18n.js';
3
4
  import { defaultEditorFeatures } from './lexical/config/server/default.js';
4
5
  import { populateLexicalPopulationPromises } from './populateGraphQL/populateLexicalPopulationPromises.js';
6
+ import { getFieldToJSONSchema } from './types/schema.js';
5
7
  import { featuresInputToEditorConfig } from './utilities/editorConfigFactory.js';
6
8
  import { getGenerateImportMap } from './utilities/generateImportMap.js';
7
9
  import { getGenerateSchemaMap } from './utilities/generateSchemaMap.js';
8
10
  import { getDefaultSanitizedEditorConfig } from './utilities/getDefaultSanitizedEditorConfig.js';
9
- import { recurseNodeTree } from './utilities/recurseNodeTree.js';
10
11
  import { richTextValidateHOC } from './validate/index.js';
11
12
  let checkedDependencies = false;
12
13
  export const lexicalTargetVersion = '0.41.0';
@@ -121,622 +122,12 @@ export function lexicalEditor(args) {
121
122
  });
122
123
  }
123
124
  },
124
- hooks: {
125
- afterChange: [async args => {
126
- const {
127
- collection,
128
- context: _context,
129
- data,
130
- field,
131
- global,
132
- indexPath,
133
- operation,
134
- originalDoc,
135
- parentIsLocalized,
136
- path,
137
- previousDoc,
138
- previousValue,
139
- req,
140
- schemaPath
141
- } = args;
142
- let {
143
- value
144
- } = args;
145
- if (finalSanitizedEditorConfig?.features?.hooks?.afterChange?.length) {
146
- for (const hook of finalSanitizedEditorConfig.features.hooks.afterChange) {
147
- value = await hook(args);
148
- }
149
- }
150
- if (!finalSanitizedEditorConfig.features.nodeHooks?.afterChange?.size && !finalSanitizedEditorConfig.features.getSubFields?.size) {
151
- return value;
152
- }
153
- // TO-DO: We should not use context, as it is intended for external use only
154
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
155
- const context = _context;
156
- const nodeIDMap = {};
157
- const previousNodeIDMap = {};
158
- /**
159
- * Get the originalNodeIDMap from the beforeValidate hook, which is always run before this hook.
160
- */
161
- const originalNodeIDMap = context?.internal?.richText?.[path.join('.')]?.originalNodeIDMap;
162
- if (!originalNodeIDMap || !Object.keys(originalNodeIDMap).length || !value) {
163
- return value;
164
- }
165
- recurseNodeTree({
166
- nodeIDMap,
167
- nodes: value?.root?.children ?? []
168
- });
169
- recurseNodeTree({
170
- nodeIDMap: previousNodeIDMap,
171
- nodes: previousValue?.root?.children ?? []
172
- });
173
- // eslint-disable-next-line prefer-const
174
- for (let [id, node] of Object.entries(nodeIDMap)) {
175
- const afterChangeHooks = finalSanitizedEditorConfig.features.nodeHooks?.afterChange;
176
- const afterChangeHooksForNode = afterChangeHooks?.get(node.type);
177
- if (afterChangeHooksForNode) {
178
- for (const hook of afterChangeHooksForNode) {
179
- if (!originalNodeIDMap[id]) {
180
- console.warn('(afterChange) No original node found for node with id', id, 'node:', node, 'path', path.join('.'));
181
- continue;
182
- }
183
- node = await hook({
184
- context,
185
- node,
186
- operation,
187
- originalNode: originalNodeIDMap[id],
188
- parentRichTextFieldPath: path,
189
- parentRichTextFieldSchemaPath: schemaPath,
190
- previousNode: previousNodeIDMap[id],
191
- req
192
- });
193
- }
194
- }
195
- const subFieldFn = finalSanitizedEditorConfig.features.getSubFields?.get(node.type);
196
- const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData?.get(node.type);
197
- if (subFieldFn && subFieldDataFn) {
198
- const subFields = subFieldFn({
199
- node,
200
- req
201
- });
202
- const nodeSiblingData = subFieldDataFn({
203
- node,
204
- req
205
- }) ?? {};
206
- const nodeSiblingDoc = subFieldDataFn({
207
- node: originalNodeIDMap[id],
208
- req
209
- }) ?? {};
210
- const nodePreviousSiblingDoc = subFieldDataFn({
211
- node: previousNodeIDMap[id],
212
- req
213
- }) ?? {};
214
- if (subFields?.length) {
215
- await afterChangeTraverseFields({
216
- blockData: nodeSiblingData,
217
- collection,
218
- context,
219
- data: data ?? {},
220
- doc: originalDoc,
221
- fields: subFields,
222
- global,
223
- operation,
224
- parentIndexPath: indexPath.join('-'),
225
- parentIsLocalized: parentIsLocalized || field.localized || false,
226
- parentPath: path.join('.'),
227
- parentSchemaPath: schemaPath.join('.'),
228
- previousDoc,
229
- previousSiblingDoc: {
230
- ...nodePreviousSiblingDoc
231
- },
232
- req,
233
- siblingData: nodeSiblingData || {},
234
- siblingDoc: {
235
- ...nodeSiblingDoc
236
- }
237
- });
238
- }
239
- }
240
- }
241
- return value;
242
- }],
243
- afterRead: [
244
- /**
245
- * afterRead hooks do not receive the originalNode. Thus, they can run on all nodes, not just nodes with an ID.
246
- */
247
- async args => {
248
- const {
249
- collection,
250
- context: context,
251
- currentDepth,
252
- depth,
253
- draft,
254
- fallbackLocale,
255
- field,
256
- fieldPromises,
257
- findMany,
258
- flattenLocales,
259
- global,
260
- indexPath,
261
- locale,
262
- originalDoc,
263
- overrideAccess,
264
- parentIsLocalized,
265
- path,
266
- populate,
267
- populationPromises,
268
- req,
269
- schemaPath,
270
- showHiddenFields,
271
- triggerAccessControl,
272
- triggerHooks
273
- } = args;
274
- let {
275
- value
276
- } = args;
277
- if (finalSanitizedEditorConfig?.features?.hooks?.afterRead?.length) {
278
- for (const hook of finalSanitizedEditorConfig.features.hooks.afterRead) {
279
- value = await hook(args);
280
- }
281
- }
282
- if (!finalSanitizedEditorConfig.features.nodeHooks?.afterRead?.size && !finalSanitizedEditorConfig.features.getSubFields?.size) {
283
- return value;
284
- }
285
- const flattenedNodes = [];
286
- recurseNodeTree({
287
- flattenedNodes,
288
- nodes: value?.root?.children ?? []
289
- });
290
- for (let node of flattenedNodes) {
291
- const afterReadHooks = finalSanitizedEditorConfig.features.nodeHooks?.afterRead;
292
- const afterReadHooksForNode = afterReadHooks?.get(node.type);
293
- if (afterReadHooksForNode) {
294
- for (const hook of afterReadHooksForNode) {
295
- node = await hook({
296
- context,
297
- currentDepth: currentDepth,
298
- depth: depth,
299
- draft: draft,
300
- fallbackLocale: fallbackLocale,
301
- fieldPromises: fieldPromises,
302
- findMany: findMany,
303
- flattenLocales: flattenLocales,
304
- locale: locale,
305
- node,
306
- overrideAccess: overrideAccess,
307
- parentRichTextFieldPath: path,
308
- parentRichTextFieldSchemaPath: schemaPath,
309
- populateArg: populate,
310
- populationPromises: populationPromises,
311
- req,
312
- showHiddenFields: showHiddenFields,
313
- triggerAccessControl: triggerAccessControl,
314
- triggerHooks: triggerHooks
315
- });
316
- }
317
- }
318
- const subFieldFn = finalSanitizedEditorConfig.features.getSubFields?.get(node.type);
319
- const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData?.get(node.type);
320
- if (subFieldFn && subFieldDataFn) {
321
- const subFields = subFieldFn({
322
- node,
323
- req
324
- });
325
- const nodeSiblingData = subFieldDataFn({
326
- node,
327
- req
328
- }) ?? {};
329
- if (subFields?.length) {
330
- afterReadTraverseFields({
331
- blockData: nodeSiblingData,
332
- collection,
333
- context,
334
- currentDepth: currentDepth,
335
- depth: depth,
336
- doc: originalDoc,
337
- draft: draft,
338
- fallbackLocale: fallbackLocale,
339
- fieldPromises: fieldPromises,
340
- fields: subFields,
341
- findMany: findMany,
342
- flattenLocales: flattenLocales,
343
- global,
344
- locale: locale,
345
- overrideAccess: overrideAccess,
346
- parentIndexPath: indexPath.join('-'),
347
- parentIsLocalized: parentIsLocalized || field.localized || false,
348
- parentPath: path.join('.'),
349
- parentSchemaPath: schemaPath.join('.'),
350
- populate,
351
- populationPromises: populationPromises,
352
- req,
353
- showHiddenFields: showHiddenFields,
354
- siblingDoc: nodeSiblingData,
355
- triggerAccessControl,
356
- triggerHooks
357
- });
358
- }
359
- }
360
- }
361
- return value;
362
- }],
363
- beforeChange: [async args => {
364
- const {
365
- collection,
366
- context: _context,
367
- data,
368
- docWithLocales,
369
- errors,
370
- field,
371
- fieldLabelPath,
372
- global,
373
- indexPath,
374
- mergeLocaleActions,
375
- operation,
376
- originalDoc,
377
- overrideAccess,
378
- parentIsLocalized,
379
- path,
380
- previousValue,
381
- req,
382
- schemaPath,
383
- siblingData,
384
- siblingDocWithLocales,
385
- skipValidation
386
- } = args;
387
- let {
388
- value
389
- } = args;
390
- if (finalSanitizedEditorConfig?.features?.hooks?.beforeChange?.length) {
391
- for (const hook of finalSanitizedEditorConfig.features.hooks.beforeChange) {
392
- value = await hook(args);
393
- }
394
- }
395
- if (!finalSanitizedEditorConfig.features.nodeHooks?.beforeChange?.size && !finalSanitizedEditorConfig.features.getSubFields?.size) {
396
- return value;
397
- }
398
- // TO-DO: We should not use context, as it is intended for external use only
399
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
400
- const context = _context;
401
- const nodeIDMap = {};
402
- /**
403
- * Get the originalNodeIDMap from the beforeValidate hook, which is always run before this hook.
404
- */
405
- const originalNodeIDMap = context?.internal?.richText?.[path.join('.')]?.originalNodeIDMap;
406
- if (!originalNodeIDMap || !Object.keys(originalNodeIDMap).length || !value) {
407
- return value;
408
- }
409
- const previousNodeIDMap = {};
410
- const originalNodeWithLocalesIDMap = {};
411
- recurseNodeTree({
412
- nodeIDMap,
413
- nodes: value?.root?.children ?? []
414
- });
415
- recurseNodeTree({
416
- nodeIDMap: previousNodeIDMap,
417
- nodes: previousValue?.root?.children ?? []
418
- });
419
- if (field.name && siblingDocWithLocales?.[field.name]) {
420
- recurseNodeTree({
421
- nodeIDMap: originalNodeWithLocalesIDMap,
422
- nodes: siblingDocWithLocales[field.name]?.root?.children ?? []
423
- });
424
- }
425
- // eslint-disable-next-line prefer-const
426
- for (let [id, node] of Object.entries(nodeIDMap)) {
427
- const beforeChangeHooks = finalSanitizedEditorConfig.features.nodeHooks?.beforeChange;
428
- const beforeChangeHooksForNode = beforeChangeHooks?.get(node.type);
429
- if (beforeChangeHooksForNode) {
430
- for (const hook of beforeChangeHooksForNode) {
431
- if (!originalNodeIDMap[id]) {
432
- console.warn('(beforeChange) No original node found for node with id', id, 'node:', node, 'path', path.join('.'));
433
- continue;
434
- }
435
- node = await hook({
436
- context,
437
- errors: errors,
438
- mergeLocaleActions: mergeLocaleActions,
439
- node,
440
- operation: operation,
441
- originalNode: originalNodeIDMap[id],
442
- originalNodeWithLocales: originalNodeWithLocalesIDMap[id],
443
- parentRichTextFieldPath: path,
444
- parentRichTextFieldSchemaPath: schemaPath,
445
- previousNode: previousNodeIDMap[id],
446
- req,
447
- skipValidation: skipValidation
448
- });
449
- }
450
- }
451
- const subFieldFn = finalSanitizedEditorConfig.features.getSubFields?.get(node.type);
452
- const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData?.get(node.type);
453
- if (subFieldFn && subFieldDataFn) {
454
- const subFields = subFieldFn({
455
- node,
456
- req
457
- });
458
- const nodeSiblingData = subFieldDataFn({
459
- node,
460
- req
461
- }) ?? {};
462
- const nodeSiblingDocWithLocales = subFieldDataFn({
463
- node: originalNodeWithLocalesIDMap[id],
464
- req
465
- }) ?? {};
466
- const nodePreviousSiblingDoc = subFieldDataFn({
467
- node: previousNodeIDMap[id],
468
- req
469
- }) ?? {};
470
- if (subFields?.length) {
471
- await beforeChangeTraverseFields({
472
- id,
473
- blockData: nodeSiblingData,
474
- collection,
475
- context,
476
- data: data ?? {},
477
- doc: originalDoc ?? {},
478
- docWithLocales: docWithLocales ?? {},
479
- errors: errors,
480
- fieldLabelPath,
481
- fields: subFields,
482
- global,
483
- mergeLocaleActions: mergeLocaleActions,
484
- operation: operation,
485
- overrideAccess,
486
- parentIndexPath: indexPath.join('-'),
487
- parentIsLocalized: parentIsLocalized || field.localized || false,
488
- parentPath: path.join('.'),
489
- parentSchemaPath: schemaPath.join('.'),
490
- req,
491
- siblingData: nodeSiblingData,
492
- siblingDoc: nodePreviousSiblingDoc,
493
- siblingDocWithLocales: nodeSiblingDocWithLocales ?? {},
494
- skipValidation
495
- });
496
- }
497
- }
498
- }
499
- /**
500
- * within the beforeChange hook, id's may be re-generated.
501
- * Example:
502
- * 1. Seed data contains IDs for block feature blocks.
503
- * 2. Those are used in beforeValidate
504
- * 3. in beforeChange, those IDs are regenerated, because you cannot provide IDs during document creation. See baseIDField beforeChange hook for reasoning
505
- * 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.
506
- * 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,
507
- * and in beforeChange, which is where modifications to the provided IDs can occur.
508
- */
509
- const newOriginalNodeIDMap = {};
510
- const previousOriginalValue = siblingData[field.name];
511
- recurseNodeTree({
512
- nodeIDMap: newOriginalNodeIDMap,
513
- nodes: previousOriginalValue?.root?.children ?? []
514
- });
515
- if (!context.internal) {
516
- // Add to context, for other hooks to use
517
- context.internal = {};
518
- }
519
- if (!context.internal.richText) {
520
- context.internal.richText = {};
521
- }
522
- context.internal.richText[path.join('.')] = {
523
- originalNodeIDMap: newOriginalNodeIDMap
524
- };
525
- return value;
526
- }],
527
- beforeValidate: [async args => {
528
- const {
529
- collection,
530
- context,
531
- data,
532
- field,
533
- global,
534
- indexPath,
535
- operation,
536
- originalDoc,
537
- overrideAccess,
538
- parentIsLocalized,
539
- path,
540
- previousValue,
541
- req,
542
- schemaPath
543
- } = args;
544
- let {
545
- value
546
- } = args;
547
- if (finalSanitizedEditorConfig?.features?.hooks?.beforeValidate?.length) {
548
- for (const hook of finalSanitizedEditorConfig.features.hooks.beforeValidate) {
549
- value = await hook(args);
550
- }
551
- }
552
- // return value if there are NO hooks
553
- if (!finalSanitizedEditorConfig.features.nodeHooks?.beforeValidate?.size && !finalSanitizedEditorConfig.features.nodeHooks?.afterChange?.size && !finalSanitizedEditorConfig.features.nodeHooks?.beforeChange?.size && !finalSanitizedEditorConfig.features.getSubFields?.size) {
554
- return value;
555
- }
556
- /**
557
- * 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.
558
- *
559
- */ /**
560
- * flattenedNodes contains all nodes in the editor, in the order they appear in the editor. They will be used for the following hooks:
561
- * - afterRead
562
- *
563
- * 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
564
- * 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
565
- * an ID.
566
- */ //const flattenedNodes: SerializedLexicalNode[] = []
567
- /**
568
- * 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:
569
- * - afterChange
570
- * - beforeChange
571
- * - beforeValidate
572
- *
573
- * Other hooks are handled by the flattenedNodes. All nodes in the nodeIDMap are part of flattenedNodes.
574
- */
575
- const originalNodeIDMap = {};
576
- recurseNodeTree({
577
- nodeIDMap: originalNodeIDMap,
578
- nodes: previousValue?.root?.children ?? []
579
- });
580
- if (!context.internal) {
581
- // Add to context, for other hooks to use
582
- context.internal = {};
583
- }
584
- if (!context.internal.richText) {
585
- context.internal.richText = {};
586
- }
587
- context.internal.richText[path.join('.')] = {
588
- originalNodeIDMap
589
- };
590
- /**
591
- * Now that the maps for all hooks are set up, we can run the validate hook
592
- */
593
- if (!finalSanitizedEditorConfig.features.nodeHooks?.beforeValidate?.size) {
594
- return value;
595
- }
596
- const nodeIDMap = {};
597
- recurseNodeTree({
598
- //flattenedNodes,
599
- nodeIDMap,
600
- nodes: value?.root?.children ?? []
601
- });
602
- // eslint-disable-next-line prefer-const
603
- for (let [id, node] of Object.entries(nodeIDMap)) {
604
- const beforeValidateHooks = finalSanitizedEditorConfig.features.nodeHooks.beforeValidate;
605
- const beforeValidateHooksForNode = beforeValidateHooks?.get(node.type);
606
- if (beforeValidateHooksForNode) {
607
- for (const hook of beforeValidateHooksForNode) {
608
- if (!originalNodeIDMap[id]) {
609
- console.warn('(beforeValidate) No original node found for node with id', id, 'node:', node, 'path', path.join('.'));
610
- continue;
611
- }
612
- node = await hook({
613
- context,
614
- node,
615
- operation,
616
- originalNode: originalNodeIDMap[id],
617
- overrideAccess: overrideAccess,
618
- parentRichTextFieldPath: path,
619
- parentRichTextFieldSchemaPath: schemaPath,
620
- req
621
- });
622
- }
623
- }
624
- const subFieldFn = finalSanitizedEditorConfig.features.getSubFields?.get(node.type);
625
- const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData?.get(node.type);
626
- if (subFieldFn && subFieldDataFn) {
627
- const subFields = subFieldFn({
628
- node,
629
- req
630
- });
631
- const nodeSiblingData = subFieldDataFn({
632
- node,
633
- req
634
- }) ?? {};
635
- const nodeSiblingDoc = subFieldDataFn({
636
- node: originalNodeIDMap[id],
637
- req
638
- }) ?? {};
639
- if (subFields?.length) {
640
- await beforeValidateTraverseFields({
641
- id,
642
- blockData: nodeSiblingData,
643
- collection,
644
- context,
645
- data,
646
- doc: originalDoc,
647
- fields: subFields,
648
- global,
649
- operation,
650
- overrideAccess: overrideAccess,
651
- parentIndexPath: indexPath.join('-'),
652
- parentIsLocalized: parentIsLocalized || field.localized || false,
653
- parentPath: path.join('.'),
654
- parentSchemaPath: schemaPath.join('.'),
655
- req,
656
- siblingData: nodeSiblingData,
657
- siblingDoc: nodeSiblingDoc
658
- });
659
- }
660
- }
661
- }
662
- return value;
663
- }]
664
- },
665
- outputSchema: ({
666
- collectionIDFieldTypes,
667
- config,
668
- field,
669
- i18n,
670
- interfaceNameDefinitions,
671
- isRequired
672
- }) => {
673
- let outputSchema = {
674
- // This schema matches the SerializedEditorState type so far, that it's possible to cast SerializedEditorState to this schema without any errors.
675
- // In the future, we should
676
- // 1) allow recursive children
677
- // 2) Pass in all the different types for every node added to the editorconfig. This can be done with refs in the schema.
678
- type: withNullableJSONSchemaType('object', isRequired),
679
- properties: {
680
- root: {
681
- type: 'object',
682
- additionalProperties: false,
683
- properties: {
684
- type: {
685
- type: 'string'
686
- },
687
- children: {
688
- type: 'array',
689
- items: {
690
- type: 'object',
691
- additionalProperties: true,
692
- properties: {
693
- type: {
694
- type: 'string',
695
- tsType: 'any'
696
- },
697
- version: {
698
- type: 'integer'
699
- }
700
- },
701
- required: ['type', 'version']
702
- }
703
- },
704
- direction: {
705
- oneOf: [{
706
- enum: ['ltr', 'rtl']
707
- }, {
708
- type: 'null'
709
- }]
710
- },
711
- format: {
712
- type: 'string',
713
- enum: ['left', 'start', 'center', 'right', 'end', 'justify', '']
714
- },
715
- indent: {
716
- type: 'integer'
717
- },
718
- version: {
719
- type: 'integer'
720
- }
721
- },
722
- required: ['children', 'direction', 'format', 'indent', 'type', 'version']
723
- }
724
- },
725
- required: ['root']
726
- };
727
- for (const modifyOutputSchema of finalSanitizedEditorConfig.features.generatedTypes.modifyOutputSchemas) {
728
- outputSchema = modifyOutputSchema({
729
- collectionIDFieldTypes,
730
- config,
731
- currentSchema: outputSchema,
732
- field,
733
- i18n,
734
- interfaceNameDefinitions,
735
- isRequired
736
- });
737
- }
738
- return outputSchema;
739
- },
125
+ hooks: getLexicalHooks({
126
+ editorConfig: finalSanitizedEditorConfig
127
+ }),
128
+ jsonSchema: getFieldToJSONSchema({
129
+ editorConfig: finalSanitizedEditorConfig
130
+ }),
740
131
  validate: richTextValidateHOC({
741
132
  editorConfig: finalSanitizedEditorConfig
742
133
  })