@payloadcms/richtext-lexical 3.0.0-canary.220bb7c → 3.0.0-canary.4704e79

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 (403) hide show
  1. package/README.md +1 -1
  2. package/dist/cell/index.d.ts +1 -1
  3. package/dist/cell/index.d.ts.map +1 -1
  4. package/dist/cell/index.js +1 -2
  5. package/dist/cell/index.js.map +1 -1
  6. package/dist/exports/client/Component-6AVANNNR.js +2 -0
  7. package/dist/exports/client/Component-6AVANNNR.js.map +7 -0
  8. package/dist/exports/client/Component-SZVAYRJX.js +2 -0
  9. package/dist/exports/client/Component-SZVAYRJX.js.map +7 -0
  10. package/dist/exports/client/Field-U5PHZTST.js +2 -0
  11. package/dist/exports/client/Field-U5PHZTST.js.map +7 -0
  12. package/dist/exports/client/RelationshipComponent-FGUPLCD2.js +2 -0
  13. package/dist/exports/client/RelationshipComponent-FGUPLCD2.js.map +7 -0
  14. package/dist/exports/client/bundled.css +1 -0
  15. package/dist/exports/client/chunk-35NZOHAF.js +2 -0
  16. package/dist/exports/client/chunk-35NZOHAF.js.map +7 -0
  17. package/dist/exports/client/chunk-3PZ2ZFQG.js +3 -0
  18. package/dist/exports/client/chunk-3PZ2ZFQG.js.map +7 -0
  19. package/dist/exports/client/chunk-FSTRW2TI.js +2 -0
  20. package/dist/exports/client/chunk-FSTRW2TI.js.map +7 -0
  21. package/dist/exports/client/chunk-M6MN4CA5.js +2 -0
  22. package/dist/exports/client/chunk-M6MN4CA5.js.map +7 -0
  23. package/dist/exports/client/chunk-Y5455JF3.js +2 -0
  24. package/dist/exports/client/chunk-Y5455JF3.js.map +7 -0
  25. package/dist/exports/client/component-FFLILIUZ.js +2 -0
  26. package/dist/exports/client/component-FFLILIUZ.js.map +7 -0
  27. package/dist/exports/client/component-RAVN56DE.js +2 -0
  28. package/dist/exports/client/component-RAVN56DE.js.map +7 -0
  29. package/dist/exports/client/component-Z34HXRX3.js +2 -0
  30. package/dist/exports/client/component-Z34HXRX3.js.map +7 -0
  31. package/dist/exports/client/index.d.ts +52 -0
  32. package/dist/exports/client/index.d.ts.map +1 -0
  33. package/dist/exports/client/index.js +36 -0
  34. package/dist/exports/client/index.js.map +7 -0
  35. package/dist/field/Field.d.ts +1 -0
  36. package/dist/field/Field.d.ts.map +1 -1
  37. package/dist/field/Field.js +3 -8
  38. package/dist/field/Field.js.map +1 -1
  39. package/dist/field/bundled.css +0 -0
  40. package/dist/field/features/align/feature.server.d.ts.map +1 -1
  41. package/dist/field/features/align/feature.server.js +2 -1
  42. package/dist/field/features/align/feature.server.js.map +1 -1
  43. package/dist/field/features/blockquote/feature.server.d.ts.map +1 -1
  44. package/dist/field/features/blockquote/feature.server.js +2 -1
  45. package/dist/field/features/blockquote/feature.server.js.map +1 -1
  46. package/dist/field/features/blocks/component/BlockContent.d.ts.map +1 -1
  47. package/dist/field/features/blocks/component/BlockContent.js +13 -18
  48. package/dist/field/features/blocks/component/BlockContent.js.map +1 -1
  49. package/dist/field/features/blocks/component/FormSavePlugin.d.ts +1 -2
  50. package/dist/field/features/blocks/component/FormSavePlugin.d.ts.map +1 -1
  51. package/dist/field/features/blocks/component/FormSavePlugin.js +2 -2
  52. package/dist/field/features/blocks/component/FormSavePlugin.js.map +1 -1
  53. package/dist/field/features/blocks/component/index.d.ts +0 -1
  54. package/dist/field/features/blocks/component/index.d.ts.map +1 -1
  55. package/dist/field/features/blocks/component/index.js +5 -18
  56. package/dist/field/features/blocks/component/index.js.map +1 -1
  57. package/dist/field/features/blocks/component/removeEmptyArrayValues.d.ts +1 -1
  58. package/dist/field/features/blocks/component/removeEmptyArrayValues.d.ts.map +1 -1
  59. package/dist/field/features/blocks/component/removeEmptyArrayValues.js.map +1 -1
  60. package/dist/field/features/blocks/drawer/index.d.ts.map +1 -1
  61. package/dist/field/features/blocks/drawer/index.js +1 -6
  62. package/dist/field/features/blocks/drawer/index.js.map +1 -1
  63. package/dist/field/features/blocks/feature.server.d.ts +1 -1
  64. package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
  65. package/dist/field/features/blocks/feature.server.js +14 -68
  66. package/dist/field/features/blocks/feature.server.js.map +1 -1
  67. package/dist/field/features/blocks/{populationPromise.d.ts → graphQLPopulationPromise.d.ts} +1 -1
  68. package/dist/field/features/blocks/graphQLPopulationPromise.d.ts.map +1 -0
  69. package/dist/field/features/blocks/{populationPromise.js → graphQLPopulationPromise.js} +6 -7
  70. package/dist/field/features/blocks/graphQLPopulationPromise.js.map +1 -0
  71. package/dist/field/features/converters/html/field/index.d.ts +7 -1
  72. package/dist/field/features/converters/html/field/index.d.ts.map +1 -1
  73. package/dist/field/features/converters/html/field/index.js +62 -53
  74. package/dist/field/features/converters/html/field/index.js.map +1 -1
  75. package/dist/field/features/createFeaturePropComponent.d.ts.map +1 -1
  76. package/dist/field/features/createFeaturePropComponent.js +1 -3
  77. package/dist/field/features/createFeaturePropComponent.js.map +1 -1
  78. package/dist/field/features/debug/testRecorder/feature.server.d.ts.map +1 -1
  79. package/dist/field/features/debug/testRecorder/feature.server.js +2 -1
  80. package/dist/field/features/debug/testRecorder/feature.server.js.map +1 -1
  81. package/dist/field/features/debug/testRecorder/plugin/index.js +1 -2
  82. package/dist/field/features/debug/testRecorder/plugin/index.js.map +1 -1
  83. package/dist/field/features/debug/treeView/feature.server.d.ts.map +1 -1
  84. package/dist/field/features/debug/treeView/feature.server.js +2 -1
  85. package/dist/field/features/debug/treeView/feature.server.js.map +1 -1
  86. package/dist/field/features/debug/treeView/plugin/index.js +0 -1
  87. package/dist/field/features/debug/treeView/plugin/index.js.map +1 -1
  88. package/dist/field/features/format/bold/feature.server.d.ts.map +1 -1
  89. package/dist/field/features/format/bold/feature.server.js +2 -1
  90. package/dist/field/features/format/bold/feature.server.js.map +1 -1
  91. package/dist/field/features/format/inlineCode/feature.server.d.ts.map +1 -1
  92. package/dist/field/features/format/inlineCode/feature.server.js +2 -1
  93. package/dist/field/features/format/inlineCode/feature.server.js.map +1 -1
  94. package/dist/field/features/format/italic/feature.server.d.ts.map +1 -1
  95. package/dist/field/features/format/italic/feature.server.js +2 -1
  96. package/dist/field/features/format/italic/feature.server.js.map +1 -1
  97. package/dist/field/features/format/strikethrough/feature.server.d.ts.map +1 -1
  98. package/dist/field/features/format/strikethrough/feature.server.js +2 -1
  99. package/dist/field/features/format/strikethrough/feature.server.js.map +1 -1
  100. package/dist/field/features/format/subscript/feature.server.d.ts.map +1 -1
  101. package/dist/field/features/format/subscript/feature.server.js +2 -1
  102. package/dist/field/features/format/subscript/feature.server.js.map +1 -1
  103. package/dist/field/features/format/superscript/feature.server.d.ts.map +1 -1
  104. package/dist/field/features/format/superscript/feature.server.js +2 -1
  105. package/dist/field/features/format/superscript/feature.server.js.map +1 -1
  106. package/dist/field/features/format/underline/feature.server.d.ts.map +1 -1
  107. package/dist/field/features/format/underline/feature.server.js +2 -1
  108. package/dist/field/features/format/underline/feature.server.js.map +1 -1
  109. package/dist/field/features/heading/feature.client.d.ts.map +1 -1
  110. package/dist/field/features/heading/feature.client.js +1 -2
  111. package/dist/field/features/heading/feature.client.js.map +1 -1
  112. package/dist/field/features/heading/feature.server.d.ts.map +1 -1
  113. package/dist/field/features/heading/feature.server.js +2 -1
  114. package/dist/field/features/heading/feature.server.js.map +1 -1
  115. package/dist/field/features/horizontalRule/component/index.d.ts.map +1 -1
  116. package/dist/field/features/horizontalRule/component/index.js +7 -2
  117. package/dist/field/features/horizontalRule/component/index.js.map +1 -1
  118. package/dist/field/features/horizontalRule/feature.server.d.ts.map +1 -1
  119. package/dist/field/features/horizontalRule/feature.server.js +2 -1
  120. package/dist/field/features/horizontalRule/feature.server.js.map +1 -1
  121. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.d.ts +2 -2
  122. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.d.ts.map +1 -1
  123. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.js +5 -2
  124. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.js.map +1 -1
  125. package/dist/field/features/horizontalRule/plugin/index.js +0 -1
  126. package/dist/field/features/horizontalRule/plugin/index.js.map +1 -1
  127. package/dist/field/features/indent/feature.server.d.ts.map +1 -1
  128. package/dist/field/features/indent/feature.server.js +2 -1
  129. package/dist/field/features/indent/feature.server.js.map +1 -1
  130. package/dist/field/features/link/drawer/baseFields.d.ts +2 -3
  131. package/dist/field/features/link/drawer/baseFields.d.ts.map +1 -1
  132. package/dist/field/features/link/drawer/baseFields.js.map +1 -1
  133. package/dist/field/features/link/drawer/index.d.ts.map +1 -1
  134. package/dist/field/features/link/drawer/index.js +2 -10
  135. package/dist/field/features/link/drawer/index.js.map +1 -1
  136. package/dist/field/features/link/drawer/types.d.ts +1 -1
  137. package/dist/field/features/link/drawer/types.d.ts.map +1 -1
  138. package/dist/field/features/link/drawer/types.js.map +1 -1
  139. package/dist/field/features/link/feature.server.d.ts +3 -4
  140. package/dist/field/features/link/feature.server.d.ts.map +1 -1
  141. package/dist/field/features/link/feature.server.js +20 -18
  142. package/dist/field/features/link/feature.server.js.map +1 -1
  143. package/dist/field/features/link/{populationPromise.d.ts → graphQLPopulationPromise.d.ts} +1 -1
  144. package/dist/field/features/link/graphQLPopulationPromise.d.ts.map +1 -0
  145. package/dist/field/features/link/{populationPromise.js → graphQLPopulationPromise.js} +4 -4
  146. package/dist/field/features/link/graphQLPopulationPromise.js.map +1 -0
  147. package/dist/field/features/link/nodes/AutoLinkNode.js +2 -0
  148. package/dist/field/features/link/nodes/AutoLinkNode.js.map +1 -1
  149. package/dist/field/features/link/nodes/LinkNode.d.ts +7 -6
  150. package/dist/field/features/link/nodes/LinkNode.d.ts.map +1 -1
  151. package/dist/field/features/link/nodes/LinkNode.js +23 -5
  152. package/dist/field/features/link/nodes/LinkNode.js.map +1 -1
  153. package/dist/field/features/link/nodes/types.d.ts +2 -1
  154. package/dist/field/features/link/nodes/types.d.ts.map +1 -1
  155. package/dist/field/features/link/nodes/types.js.map +1 -1
  156. package/dist/field/features/link/plugins/autoLink/index.js.map +1 -1
  157. package/dist/field/features/link/plugins/clickableLink/index.d.ts.map +1 -1
  158. package/dist/field/features/link/plugins/clickableLink/index.js +2 -4
  159. package/dist/field/features/link/plugins/clickableLink/index.js.map +1 -1
  160. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  161. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +4 -10
  162. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  163. package/dist/field/features/link/plugins/floatingLinkEditor/index.js +0 -1
  164. package/dist/field/features/link/plugins/floatingLinkEditor/index.js.map +1 -1
  165. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts +2 -3
  166. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
  167. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js.map +1 -1
  168. package/dist/field/features/link/plugins/link/index.js +2 -2
  169. package/dist/field/features/link/plugins/link/index.js.map +1 -1
  170. package/dist/field/features/link/validate.d.ts +2 -1
  171. package/dist/field/features/link/validate.d.ts.map +1 -1
  172. package/dist/field/features/link/validate.js +5 -9
  173. package/dist/field/features/link/validate.js.map +1 -1
  174. package/dist/field/features/lists/checklist/feature.server.d.ts.map +1 -1
  175. package/dist/field/features/lists/checklist/feature.server.js +2 -1
  176. package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
  177. package/dist/field/features/lists/orderedList/feature.server.d.ts.map +1 -1
  178. package/dist/field/features/lists/orderedList/feature.server.js +2 -1
  179. package/dist/field/features/lists/orderedList/feature.server.js.map +1 -1
  180. package/dist/field/features/lists/unorderedList/feature.server.d.ts.map +1 -1
  181. package/dist/field/features/lists/unorderedList/feature.server.js +2 -1
  182. package/dist/field/features/lists/unorderedList/feature.server.js.map +1 -1
  183. package/dist/field/features/migrations/lexicalPluginToLexical/feature.server.d.ts.map +1 -1
  184. package/dist/field/features/migrations/lexicalPluginToLexical/feature.server.js +2 -1
  185. package/dist/field/features/migrations/lexicalPluginToLexical/feature.server.js.map +1 -1
  186. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +0 -1
  187. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  188. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -2
  189. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  190. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  191. package/dist/field/features/migrations/slateToLexical/feature.server.d.ts.map +1 -1
  192. package/dist/field/features/migrations/slateToLexical/feature.server.js +2 -1
  193. package/dist/field/features/migrations/slateToLexical/feature.server.js.map +1 -1
  194. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +0 -1
  195. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  196. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -2
  197. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  198. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  199. package/dist/field/features/paragraph/feature.server.d.ts.map +1 -1
  200. package/dist/field/features/paragraph/feature.server.js +2 -1
  201. package/dist/field/features/paragraph/feature.server.js.map +1 -1
  202. package/dist/field/features/relationship/drawer/index.js +1 -1
  203. package/dist/field/features/relationship/drawer/index.js.map +1 -1
  204. package/dist/field/features/relationship/feature.server.d.ts.map +1 -1
  205. package/dist/field/features/relationship/feature.server.js +37 -5
  206. package/dist/field/features/relationship/feature.server.js.map +1 -1
  207. package/dist/field/features/relationship/{populationPromise.d.ts → graphQLPopulationPromise.d.ts} +1 -1
  208. package/dist/field/features/relationship/graphQLPopulationPromise.d.ts.map +1 -0
  209. package/dist/field/features/relationship/{populationPromise.js → graphQLPopulationPromise.js} +3 -4
  210. package/dist/field/features/relationship/graphQLPopulationPromise.js.map +1 -0
  211. package/dist/field/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
  212. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +2 -8
  213. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
  214. package/dist/field/features/relationship/plugins/index.d.ts.map +1 -1
  215. package/dist/field/features/relationship/plugins/index.js +2 -3
  216. package/dist/field/features/relationship/plugins/index.js.map +1 -1
  217. package/dist/field/features/relationship/utils/EnabledRelationshipsCondition.d.ts.map +1 -1
  218. package/dist/field/features/relationship/utils/EnabledRelationshipsCondition.js +1 -3
  219. package/dist/field/features/relationship/utils/EnabledRelationshipsCondition.js.map +1 -1
  220. package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -1
  221. package/dist/field/features/toolbars/fixed/Toolbar/index.js +1 -5
  222. package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -1
  223. package/dist/field/features/toolbars/fixed/feature.server.d.ts.map +1 -1
  224. package/dist/field/features/toolbars/fixed/feature.server.js +2 -1
  225. package/dist/field/features/toolbars/fixed/feature.server.js.map +1 -1
  226. package/dist/field/features/toolbars/inline/Toolbar/index.js +0 -1
  227. package/dist/field/features/toolbars/inline/Toolbar/index.js.map +1 -1
  228. package/dist/field/features/toolbars/inline/feature.server.d.ts.map +1 -1
  229. package/dist/field/features/toolbars/inline/feature.server.js +2 -1
  230. package/dist/field/features/toolbars/inline/feature.server.js.map +1 -1
  231. package/dist/field/features/toolbars/shared/ToolbarButton/index.js +0 -1
  232. package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  233. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +1 -2
  234. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  235. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js +1 -2
  236. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  237. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js +1 -2
  238. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  239. package/dist/field/features/types.d.ts +115 -34
  240. package/dist/field/features/types.d.ts.map +1 -1
  241. package/dist/field/features/types.js.map +1 -1
  242. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.d.ts +1 -1
  243. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.d.ts.map +1 -1
  244. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js +3 -12
  245. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js.map +1 -1
  246. package/dist/field/features/upload/component/index.d.ts.map +1 -1
  247. package/dist/field/features/upload/component/index.js +1 -9
  248. package/dist/field/features/upload/component/index.js.map +1 -1
  249. package/dist/field/features/upload/drawer/index.d.ts.map +1 -1
  250. package/dist/field/features/upload/drawer/index.js +1 -2
  251. package/dist/field/features/upload/drawer/index.js.map +1 -1
  252. package/dist/field/features/upload/feature.server.d.ts +1 -1
  253. package/dist/field/features/upload/feature.server.d.ts.map +1 -1
  254. package/dist/field/features/upload/feature.server.js +53 -5
  255. package/dist/field/features/upload/feature.server.js.map +1 -1
  256. package/dist/field/features/upload/{populationPromise.d.ts → graphQLPopulationPromise.d.ts} +1 -1
  257. package/dist/field/features/upload/graphQLPopulationPromise.d.ts.map +1 -0
  258. package/dist/field/features/upload/graphQLPopulationPromise.js +52 -0
  259. package/dist/field/features/upload/graphQLPopulationPromise.js.map +1 -0
  260. package/dist/field/features/upload/nodes/UploadNode.d.ts +4 -4
  261. package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
  262. package/dist/field/features/upload/nodes/UploadNode.js +18 -2
  263. package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
  264. package/dist/field/features/upload/plugin/index.d.ts +1 -1
  265. package/dist/field/features/upload/plugin/index.d.ts.map +1 -1
  266. package/dist/field/features/upload/plugin/index.js +2 -1
  267. package/dist/field/features/upload/plugin/index.js.map +1 -1
  268. package/dist/field/features/upload/validate.js +1 -1
  269. package/dist/field/features/upload/validate.js.map +1 -1
  270. package/dist/field/index.d.ts.map +1 -1
  271. package/dist/field/index.js +35 -99
  272. package/dist/field/index.js.map +1 -1
  273. package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
  274. package/dist/field/lexical/LexicalEditor.js +3 -6
  275. package/dist/field/lexical/LexicalEditor.js.map +1 -1
  276. package/dist/field/lexical/LexicalProvider.d.ts +1 -2
  277. package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
  278. package/dist/field/lexical/LexicalProvider.js +1 -1
  279. package/dist/field/lexical/LexicalProvider.js.map +1 -1
  280. package/dist/field/lexical/config/server/loader.d.ts +1 -1
  281. package/dist/field/lexical/config/server/loader.d.ts.map +1 -1
  282. package/dist/field/lexical/config/server/loader.js.map +1 -1
  283. package/dist/field/lexical/config/server/sanitize.d.ts +1 -1
  284. package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
  285. package/dist/field/lexical/config/server/sanitize.js +11 -7
  286. package/dist/field/lexical/config/server/sanitize.js.map +1 -1
  287. package/dist/field/lexical/nodes/index.d.ts +1 -2
  288. package/dist/field/lexical/nodes/index.d.ts.map +1 -1
  289. package/dist/field/lexical/nodes/index.js.map +1 -1
  290. package/dist/field/lexical/plugins/SlashMenu/index.js +2 -3
  291. package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
  292. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js +0 -1
  293. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  294. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js +0 -1
  295. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  296. package/dist/field/lexical/theme/EditorTheme.d.ts.map +1 -1
  297. package/dist/field/lexical/theme/EditorTheme.js +1 -1
  298. package/dist/field/lexical/theme/EditorTheme.js.map +1 -1
  299. package/dist/field/lexical/ui/ContentEditable.js +0 -1
  300. package/dist/field/lexical/ui/ContentEditable.js.map +1 -1
  301. package/dist/field/lexical/utils/nodeFormat.d.ts +1 -2
  302. package/dist/field/lexical/utils/nodeFormat.d.ts.map +1 -1
  303. package/dist/field/lexical/utils/nodeFormat.js +1 -1
  304. package/dist/field/lexical/utils/nodeFormat.js.map +1 -1
  305. package/dist/generateComponentMap.d.ts +1 -1
  306. package/dist/generateComponentMap.d.ts.map +1 -1
  307. package/dist/generateComponentMap.js.map +1 -1
  308. package/dist/generateSchemaMap.d.ts +1 -1
  309. package/dist/generateSchemaMap.d.ts.map +1 -1
  310. package/dist/generateSchemaMap.js.map +1 -1
  311. package/dist/index.d.ts +2 -21
  312. package/dist/index.d.ts.map +1 -1
  313. package/dist/index.js +418 -140
  314. package/dist/index.js.map +1 -1
  315. package/dist/populateGraphQL/defaultValue.d.ts.map +1 -0
  316. package/dist/populateGraphQL/defaultValue.js.map +1 -0
  317. package/dist/populateGraphQL/populate.d.ts +17 -0
  318. package/dist/populateGraphQL/populate.d.ts.map +1 -0
  319. package/dist/{populate → populateGraphQL}/populate.js +7 -2
  320. package/dist/populateGraphQL/populate.js.map +1 -0
  321. package/dist/{populate → populateGraphQL}/populateLexicalPopulationPromises.d.ts +2 -2
  322. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -0
  323. package/dist/{populate → populateGraphQL}/populateLexicalPopulationPromises.js +2 -1
  324. package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -0
  325. package/dist/{populate/recurseNestedFields.d.ts → populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts} +3 -4
  326. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -0
  327. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js +28 -0
  328. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js.map +1 -0
  329. package/dist/recurseNodeTree.d.ts +9 -0
  330. package/dist/recurseNodeTree.d.ts.map +1 -0
  331. package/dist/recurseNodeTree.js +27 -0
  332. package/dist/recurseNodeTree.js.map +1 -0
  333. package/dist/types.d.ts +1 -3
  334. package/dist/types.d.ts.map +1 -1
  335. package/dist/types.js.map +1 -1
  336. package/dist/useLexicalFeature.d.ts.map +1 -1
  337. package/dist/useLexicalFeature.js +1 -3
  338. package/dist/useLexicalFeature.js.map +1 -1
  339. package/dist/validate/index.d.ts +1 -1
  340. package/dist/validate/index.d.ts.map +1 -1
  341. package/dist/validate/index.js.map +1 -1
  342. package/dist/validate/validateNodes.d.ts +1 -1
  343. package/dist/validate/validateNodes.d.ts.map +1 -1
  344. package/dist/validate/validateNodes.js.map +1 -1
  345. package/package.json +45 -47
  346. package/components.d.ts +0 -6
  347. package/components.js +0 -7
  348. package/dist/exports/components.d.ts +0 -11
  349. package/dist/exports/components.d.ts.map +0 -1
  350. package/dist/exports/components.js +0 -12
  351. package/dist/exports/components.js.map +0 -1
  352. package/dist/field/features/blocks/component/index.scss +0 -149
  353. package/dist/field/features/blocks/populationPromise.d.ts.map +0 -1
  354. package/dist/field/features/blocks/populationPromise.js.map +0 -1
  355. package/dist/field/features/debug/testRecorder/plugin/index.scss +0 -49
  356. package/dist/field/features/debug/treeView/plugin/index.scss +0 -78
  357. package/dist/field/features/horizontalRule/plugin/index.scss +0 -20
  358. package/dist/field/features/link/drawer/index.scss +0 -50
  359. package/dist/field/features/link/plugins/floatingLinkEditor/index.scss +0 -86
  360. package/dist/field/features/link/populationPromise.d.ts.map +0 -1
  361. package/dist/field/features/link/populationPromise.js.map +0 -1
  362. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.scss +0 -14
  363. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.scss +0 -14
  364. package/dist/field/features/relationship/nodes/components/index.scss +0 -97
  365. package/dist/field/features/relationship/populationPromise.d.ts.map +0 -1
  366. package/dist/field/features/relationship/populationPromise.js.map +0 -1
  367. package/dist/field/features/toolbars/fixed/Toolbar/index.scss +0 -119
  368. package/dist/field/features/toolbars/inline/Toolbar/index.scss +0 -53
  369. package/dist/field/features/toolbars/shared/ToolbarButton/index.scss +0 -39
  370. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.scss +0 -112
  371. package/dist/field/features/upload/component/index.scss +0 -152
  372. package/dist/field/features/upload/populationPromise.d.ts.map +0 -1
  373. package/dist/field/features/upload/populationPromise.js +0 -52
  374. package/dist/field/features/upload/populationPromise.js.map +0 -1
  375. package/dist/field/index.scss +0 -25
  376. package/dist/field/lexical/LexicalEditor.scss +0 -49
  377. package/dist/field/lexical/plugins/SlashMenu/index.scss +0 -61
  378. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.scss +0 -31
  379. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.scss +0 -72
  380. package/dist/field/lexical/theme/EditorTheme.scss +0 -509
  381. package/dist/field/lexical/ui/ContentEditable.scss +0 -76
  382. package/dist/populate/defaultValue.d.ts.map +0 -1
  383. package/dist/populate/defaultValue.js.map +0 -1
  384. package/dist/populate/populate.d.ts +0 -22
  385. package/dist/populate/populate.d.ts.map +0 -1
  386. package/dist/populate/populate.js.map +0 -1
  387. package/dist/populate/populateLexicalPopulationPromises.d.ts.map +0 -1
  388. package/dist/populate/populateLexicalPopulationPromises.js.map +0 -1
  389. package/dist/populate/recurseNestedFields.d.ts.map +0 -1
  390. package/dist/populate/recurseNestedFields.js +0 -25
  391. package/dist/populate/recurseNestedFields.js.map +0 -1
  392. package/dist/scss/app.scss +0 -208
  393. package/dist/scss/colors.scss +0 -269
  394. package/dist/scss/queries.scss +0 -27
  395. package/dist/scss/resets.scss +0 -17
  396. package/dist/scss/styles.scss +0 -11
  397. package/dist/scss/svg.scss +0 -10
  398. package/dist/scss/toastify.scss +0 -58
  399. package/dist/scss/type.scss +0 -117
  400. package/dist/scss/vars.scss +0 -213
  401. package/dist/scss/z-index.scss +0 -9
  402. /package/dist/{populate → populateGraphQL}/defaultValue.d.ts +0 -0
  403. /package/dist/{populate → populateGraphQL}/defaultValue.js +0 -0
@@ -1,11 +1,11 @@
1
1
  import { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields';
2
- import { baseBlockFields, sanitizeFields } from 'payload/config';
3
- import { fieldsToJSONSchema, formatLabels } from 'payload/utilities';
2
+ import { baseBlockFields, fieldsToJSONSchema, formatLabels, sanitizeFields } from 'payload';
3
+ // eslint-disable-next-line payload/no-imports-from-exports-dir
4
+ import { BlocksFeatureClientComponent } from '../../../exports/client/index.js';
4
5
  import { createNode } from '../typeUtilities.js';
5
- import { BlocksFeatureClientComponent } from './feature.client.js';
6
+ import { blockPopulationPromiseHOC } from './graphQLPopulationPromise.js';
6
7
  import { i18n } from './i18n.js';
7
8
  import { BlockNode } from './nodes/BlocksNode.js';
8
- import { blockPopulationPromiseHOC } from './populationPromise.js';
9
9
  import { blockValidationHOC } from './validate.js';
10
10
  export const BlocksFeature = (props)=>{
11
11
  return {
@@ -79,72 +79,18 @@ export const BlocksFeature = (props)=>{
79
79
  i18n,
80
80
  nodes: [
81
81
  createNode({
82
- /* // TODO: Implement these hooks once docWithLocales / originalSiblingDoc => node matching has been figured out
83
- hooks: {
84
- beforeChange: [
85
- async ({ context, findMany, node, operation, overrideAccess, req }) => {
86
- const blockType = node.fields.blockType
87
-
88
- const block = deepCopyObject(
89
- props.blocks.find((block) => block.slug === blockType),
90
- )
91
-
92
-
93
- await beforeChangeTraverseFields({
94
- id: null,
95
- collection: null,
96
- context,
97
- data: node.fields,
98
- doc: node.fields,
99
- fields: sanitizedBlock.fields,
100
- global: null,
101
- mergeLocaleActions: [],
102
- operation:
103
- operation === 'create' || operation === 'update' ? operation : 'update',
104
- overrideAccess,
105
- path: '',
106
- req,
107
- siblingData: node.fields,
108
- siblingDoc: node.fields,
109
- })
110
-
111
-
112
- return node
113
- },
114
- ],
115
- beforeValidate: [
116
- async ({ context, findMany, node, operation, overrideAccess, req }) => {
117
- const blockType = node.fields.blockType
118
-
119
- const block = deepCopyObject(
120
- props.blocks.find((block) => block.slug === blockType),
121
- )
122
-
123
-
124
-
125
- await beforeValidateTraverseFields({
126
- id: null,
127
- collection: null,
128
- context,
129
- data: node.fields,
130
- doc: node.fields,
131
- fields: sanitizedBlock.fields,
132
- global: null,
133
- operation:
134
- operation === 'create' || operation === 'update' ? operation : 'update',
135
- overrideAccess,
136
- req,
137
- siblingData: node.fields,
138
- siblingDoc: node.fields,
139
- })
140
-
141
- return node
142
- },
143
- ],
144
- },*/ node: BlockNode,
145
- populationPromises: [
82
+ getSubFields: ({ node, req })=>{
83
+ const blockType = node.fields.blockType;
84
+ const block = props.blocks.find((block)=>block.slug === blockType);
85
+ return block?.fields;
86
+ },
87
+ getSubFieldsData: ({ node })=>{
88
+ return node?.fields;
89
+ },
90
+ graphQLPopulationPromises: [
146
91
  blockPopulationPromiseHOC(props)
147
92
  ],
93
+ node: BlockNode,
148
94
  validations: [
149
95
  blockValidationHOC(props)
150
96
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Config } from 'payload/config'\nimport type { Block, BlockField, Field } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields'\nimport { baseBlockFields, sanitizeFields } from 'payload/config'\nimport { fieldsToJSONSchema, formatLabels } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { BlocksFeatureClientProps } from './feature.client.js'\n\nimport { createNode } from '../typeUtilities.js'\nimport { BlocksFeatureClientComponent } from './feature.client.js'\nimport { i18n } from './i18n.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockPopulationPromiseHOC } from './populationPromise.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type BlocksFeatureProps = {\n blocks: Block[]\n}\n\nexport const BlocksFeature: FeatureProviderProviderServer<\n BlocksFeatureProps,\n BlocksFeatureClientProps\n> = (props) => {\n return {\n feature: async ({ config: _config, isRoot }) => {\n if (props?.blocks?.length) {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const block of props.blocks) {\n block.fields = block.fields.concat(baseBlockFields)\n block.labels = !block.labels ? formatLabels(block.slug) : block.labels\n\n block.fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: block.fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n // Build clientProps\n const clientProps: BlocksFeatureClientProps = {\n reducedBlocks: [],\n }\n for (const block of props.blocks) {\n clientProps.reducedBlocks.push({\n slug: block.slug,\n fieldMap: [],\n imageAltText: block.imageAltText,\n imageURL: block.imageURL,\n labels: block.labels,\n })\n }\n\n return {\n ClientComponent: BlocksFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n /**\n * Add sub-fields to the schemaMap. E.g. if you have an array field as part of the block, and it runs addRow, it will request these\n * sub-fields from the component map. Thus, we need to put them in the component map here.\n */\n const schemaMap = new Map<string, Field[]>()\n\n for (const block of props.blocks) {\n schemaMap.set(block.slug, block.fields || [])\n\n traverseFields({\n config,\n fields: block.fields,\n i18n,\n schemaMap,\n schemaPath: block.slug,\n validRelationships,\n })\n }\n\n return schemaMap\n },\n generatedTypes: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n }) => {\n if (!props?.blocks?.length) {\n return currentSchema\n }\n\n const blocksField: BlockField = {\n name: field?.name + '_lexical_blocks',\n type: 'blocks',\n blocks: props.blocks,\n }\n // This is only done so that interfaceNameDefinitions sets those block's interfaceNames.\n // we don't actually use the JSON Schema itself in the generated types yet.\n fieldsToJSONSchema(\n collectionIDFieldTypes,\n [blocksField],\n interfaceNameDefinitions,\n config,\n )\n\n return currentSchema\n },\n },\n i18n,\n nodes: [\n createNode({\n /* // TODO: Implement these hooks once docWithLocales / originalSiblingDoc => node matching has been figured out\n hooks: {\n beforeChange: [\n async ({ context, findMany, node, operation, overrideAccess, req }) => {\n const blockType = node.fields.blockType\n\n const block = deepCopyObject(\n props.blocks.find((block) => block.slug === blockType),\n )\n\n\n await beforeChangeTraverseFields({\n id: null,\n collection: null,\n context,\n data: node.fields,\n doc: node.fields,\n fields: sanitizedBlock.fields,\n global: null,\n mergeLocaleActions: [],\n operation:\n operation === 'create' || operation === 'update' ? operation : 'update',\n overrideAccess,\n path: '',\n req,\n siblingData: node.fields,\n siblingDoc: node.fields,\n })\n\n\n return node\n },\n ],\n beforeValidate: [\n async ({ context, findMany, node, operation, overrideAccess, req }) => {\n const blockType = node.fields.blockType\n\n const block = deepCopyObject(\n props.blocks.find((block) => block.slug === blockType),\n )\n\n\n\n await beforeValidateTraverseFields({\n id: null,\n collection: null,\n context,\n data: node.fields,\n doc: node.fields,\n fields: sanitizedBlock.fields,\n global: null,\n operation:\n operation === 'create' || operation === 'update' ? operation : 'update',\n overrideAccess,\n req,\n siblingData: node.fields,\n siblingDoc: node.fields,\n })\n\n return node\n },\n ],\n },*/\n node: BlockNode,\n populationPromises: [blockPopulationPromiseHOC(props)],\n validations: [blockValidationHOC(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blocks',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","baseBlockFields","sanitizeFields","fieldsToJSONSchema","formatLabels","createNode","BlocksFeatureClientComponent","i18n","BlockNode","blockPopulationPromiseHOC","blockValidationHOC","BlocksFeature","props","feature","config","_config","isRoot","blocks","length","validRelationships","collections","map","c","slug","block","fields","concat","labels","requireFieldLevelRichTextEditor","clientProps","reducedBlocks","push","fieldMap","imageAltText","imageURL","ClientComponent","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","schemaPath","generatedTypes","modifyOutputSchema","collectionIDFieldTypes","currentSchema","field","interfaceNameDefinitions","blocksField","name","type","nodes","node","populationPromises","validations","serverFeatureProps","key"],"rang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wBACN6C,oBAAoB;4BAAC5C,0BAA0BG;yBAAO;wBACtD0C,aAAa;4BAAC5C,mBAAmBE;yBAAO;oBAC1C;iBACD;gBACD2C,oBAAoB3C;YACtB;QACF;QACA4C,KAAK;QACLD,oBAAoB3C;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Block, BlockField, Config, Field } from 'payload'\n\nimport { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields'\nimport { baseBlockFields, fieldsToJSONSchema, formatLabels, sanitizeFields } from 'payload'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { BlocksFeatureClientProps } from './feature.client.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { BlocksFeatureClientComponent } from '../../../exports/client/index.js'\nimport { createNode } from '../typeUtilities.js'\nimport { blockPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type BlocksFeatureProps = {\n blocks: Block[]\n}\n\nexport const BlocksFeature: FeatureProviderProviderServer<\n BlocksFeatureProps,\n BlocksFeatureClientProps\n> = (props) => {\n return {\n feature: async ({ config: _config, isRoot }) => {\n if (props?.blocks?.length) {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const block of props.blocks) {\n block.fields = block.fields.concat(baseBlockFields)\n block.labels = !block.labels ? formatLabels(block.slug) : block.labels\n\n block.fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: block.fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n // Build clientProps\n const clientProps: BlocksFeatureClientProps = {\n reducedBlocks: [],\n }\n for (const block of props.blocks) {\n clientProps.reducedBlocks.push({\n slug: block.slug,\n fieldMap: [],\n imageAltText: block.imageAltText,\n imageURL: block.imageURL,\n labels: block.labels,\n })\n }\n\n return {\n ClientComponent: BlocksFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n /**\n * Add sub-fields to the schemaMap. E.g. if you have an array field as part of the block, and it runs addRow, it will request these\n * sub-fields from the component map. Thus, we need to put them in the component map here.\n */\n const schemaMap = new Map<string, Field[]>()\n\n for (const block of props.blocks) {\n schemaMap.set(block.slug, block.fields || [])\n\n traverseFields({\n config,\n fields: block.fields,\n i18n,\n schemaMap,\n schemaPath: block.slug,\n validRelationships,\n })\n }\n\n return schemaMap\n },\n generatedTypes: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n }) => {\n if (!props?.blocks?.length) {\n return currentSchema\n }\n\n const blocksField: BlockField = {\n name: field?.name + '_lexical_blocks',\n type: 'blocks',\n blocks: props.blocks,\n }\n // This is only done so that interfaceNameDefinitions sets those block's interfaceNames.\n // we don't actually use the JSON Schema itself in the generated types yet.\n fieldsToJSONSchema(\n collectionIDFieldTypes,\n [blocksField],\n interfaceNameDefinitions,\n config,\n )\n\n return currentSchema\n },\n },\n i18n,\n nodes: [\n createNode({\n getSubFields: ({ node, req }) => {\n const blockType = node.fields.blockType\n\n const block = props.blocks.find((block) => block.slug === blockType)\n return block?.fields\n },\n getSubFieldsData: ({ node }) => {\n return node?.fields\n },\n graphQLPopulationPromises: [blockPopulationPromiseHOC(props)],\n node: BlockNode,\n validations: [blockValidationHOC(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blocks',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","baseBlockFields","fieldsToJSONSchema","formatLabels","sanitizeFields","BlocksFeatureClientComponent","createNode","blockPopulationPromiseHOC","i18n","BlockNode","blockValidationHOC","BlocksFeature","props","feature","config","_config","isRoot","blocks","length","validRelationships","collections","map","c","slug","block","fields","concat","labels","requireFieldLevelRichTextEditor","clientProps","reducedBlocks","push","fieldMap","imageAltText","imageURL","ClientComponent","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","schemaPath","generatedTypes","modifyOutputSchema","collectionIDFieldTypes","currentSchema","field","interfaceNameDefinitions","blocksField","name","type","nodes","getSubFields","node","req","blockType","find","getSubFieldsData","graphQLPopulationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,cAAc,QAAQ,8DAA6D;AAC5F,SAASC,eAAe,EAAEC,kBAAkB,EAAEC,YAAY,EAAEC,cAAc,QAAQ,UAAS;AAK3F,+DAA+D;AAC/D,SAASC,4BAA4B,QAAQ,mCAAkC;AAC/E,SAASC,UAAU,QAAQ,sBAAqB;AAChD,SAASC,yBAAyB,QAAQ,gCAA+B;AACzE,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,kBAAkB,QAAQ,gBAAe;AAMlD,OAAO,MAAMC,gBAGT,CAACC;IACH,OAAO;QACLC,SAAS,OAAO,EAAEC,QAAQC,OAAO,EAAEC,MAAM,EAAE;YACzC,IAAIJ,OAAOK,QAAQC,QAAQ;gBACzB,MAAMC,qBAAqBJ,QAAQK,WAAW,CAACC,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAK,EAAE;gBAEvE,KAAK,MAAMC,SAASZ,MAAMK,MAAM,CAAE;oBAChCO,MAAMC,MAAM,GAAGD,MAAMC,MAAM,CAACC,MAAM,CAACzB;oBACnCuB,MAAMG,MAAM,GAAG,CAACH,MAAMG,MAAM,GAAGxB,aAAaqB,MAAMD,IAAI,IAAIC,MAAMG,MAAM;oBAEtEH,MAAMC,MAAM,GAAG,MAAMrB,eAAe;wBAClCU,QAAQC;wBACRU,QAAQD,MAAMC,MAAM;wBACpBG,iCAAiCZ;wBACjCG;oBAC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BACA2C,OAAO;oBACL7C,WAAW;wBACT8C,cAAc,CAAC,EAAEC,IAAI,EAAEC,GAAG,EAAE;4BAC1B,MAAMC,YAAYF,KAAK5B,MAAM,CAAC8B,SAAS;4BAEvC,MAAM/B,QAAQZ,MAAMK,MAAM,CAACuC,IAAI,CAAC,CAAChC,QAAUA,MAAMD,IAAI,KAAKgC;4BAC1D,OAAO/B,OAAOC;wBAChB;wBACAgC,kBAAkB,CAAC,EAAEJ,IAAI,EAAE;4BACzB,OAAOA,MAAM5B;wBACf;wBACAiC,2BAA2B;4BAACnD,0BAA0BK;yBAAO;wBAC7DyC,MAAM5C;wBACNkD,aAAa;4BAACjD,mBAAmBE;yBAAO;oBAC1C;iBACD;gBACDgD,oBAAoBhD;YACtB;QACF;QACAiD,KAAK;QACLD,oBAAoBhD;IACtB;AACF,EAAC"}
@@ -2,4 +2,4 @@ import type { PopulationPromise } from '../types.js';
2
2
  import type { BlocksFeatureProps } from './feature.server.js';
3
3
  import type { SerializedBlockNode } from './nodes/BlocksNode.js';
4
4
  export declare const blockPopulationPromiseHOC: (props: BlocksFeatureProps) => PopulationPromise<SerializedBlockNode>;
5
- //# sourceMappingURL=populationPromise.d.ts.map
5
+ //# sourceMappingURL=graphQLPopulationPromise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphQLPopulationPromise.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/graphQLPopulationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAIhE,eAAO,MAAM,yBAAyB,UAC7B,kBAAkB,KACxB,kBAAkB,mBAAmB,CA4CvC,CAAA"}
@@ -1,32 +1,31 @@
1
- import { recurseNestedFields } from '../../../populate/recurseNestedFields.js';
1
+ import { recursivelyPopulateFieldsForGraphQL } from '../../../populateGraphQL/recursivelyPopulateFieldsForGraphQL.js';
2
2
  export const blockPopulationPromiseHOC = (props)=>{
3
- const blockPopulationPromise = ({ context, currentDepth, depth, draft, editorPopulationPromises, fieldPromises, findMany, flattenLocales, node, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc })=>{
3
+ const blockPopulationPromise = ({ context, currentDepth, depth, draft, editorPopulationPromises, fieldPromises, findMany, flattenLocales, node, overrideAccess, populationPromises, req, showHiddenFields })=>{
4
4
  const blockFieldData = node.fields;
5
5
  // find block used in this node
6
6
  const block = props.blocks.find((block)=>block.slug === blockFieldData.blockType);
7
7
  if (!block || !block?.fields?.length || !blockFieldData) {
8
8
  return;
9
9
  }
10
- recurseNestedFields({
10
+ recursivelyPopulateFieldsForGraphQL({
11
11
  context,
12
12
  currentDepth,
13
13
  data: blockFieldData,
14
14
  depth,
15
+ draft,
15
16
  editorPopulationPromises,
16
17
  fieldPromises,
17
18
  fields: block.fields,
18
19
  findMany,
19
- flattenLocales: false,
20
+ flattenLocales,
20
21
  overrideAccess,
21
22
  populationPromises,
22
23
  req,
23
24
  showHiddenFields,
24
- // The afterReadPromise gets its data from looking for field.name inside the siblingDoc. Thus, here we cannot pass the whole document's siblingDoc, but only the siblingDoc (sibling fields) of the current field.
25
- draft,
26
25
  siblingDoc: blockFieldData
27
26
  });
28
27
  };
29
28
  return blockPopulationPromise;
30
29
  };
31
30
 
32
- //# sourceMappingURL=populationPromise.js.map
31
+ //# sourceMappingURL=graphQLPopulationPromise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/field/features/blocks/graphQLPopulationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../types.js'\nimport type { BlocksFeatureProps } from './feature.server.js'\nimport type { SerializedBlockNode } from './nodes/BlocksNode.js'\n\nimport { recursivelyPopulateFieldsForGraphQL } from '../../../populateGraphQL/recursivelyPopulateFieldsForGraphQL.js'\n\nexport const blockPopulationPromiseHOC = (\n props: BlocksFeatureProps,\n): PopulationPromise<SerializedBlockNode> => {\n const blockPopulationPromise: PopulationPromise<SerializedBlockNode> = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n const blockFieldData = node.fields\n\n // find block used in this node\n const block = props.blocks.find((block) => block.slug === blockFieldData.blockType)\n if (!block || !block?.fields?.length || !blockFieldData) {\n return\n }\n\n recursivelyPopulateFieldsForGraphQL({\n context,\n currentDepth,\n data: blockFieldData,\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n fields: block.fields,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc: blockFieldData,\n })\n }\n\n return blockPopulationPromise\n}\n"],"names":["recursivelyPopulateFieldsForGraphQL","blockPopulationPromiseHOC","props","blockPopulationPromise","context","currentDepth","depth","draft","editorPopulationPromises","fieldPromises","findMany","flattenLocales","node","overrideAccess","populationPromises","req","showHiddenFields","blockFieldData","fields","block","blocks","find","slug","blockType","length","data","siblingDoc"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,mCAAmC,QAAQ,kEAAiE;AAErH,OAAO,MAAMC,4BAA4B,CACvCC;IAEA,MAAMC,yBAAiE,CAAC,EACtEC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,KAAK,EACLC,wBAAwB,EACxBC,aAAa,EACbC,QAAQ,EACRC,cAAc,EACdC,IAAI,EACJC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EACjB;QACC,MAAMC,iBAAiBL,KAAKM,MAAM;QAElC,+BAA+B;QAC/B,MAAMC,QAAQjB,MAAMkB,MAAM,CAACC,IAAI,CAAC,CAACF,QAAUA,MAAMG,IAAI,KAAKL,eAAeM,SAAS;QAClF,IAAI,CAACJ,SAAS,CAACA,OAAOD,QAAQM,UAAU,CAACP,gBAAgB;YACvD;QACF;QAEAjB,oCAAoC;YAClCI;YACAC;YACAoB,MAAMR;YACNX;YACAC;YACAC;YACAC;YACAS,QAAQC,MAAMD,MAAM;YACpBR;YACAC;YACAE;YACAC;YACAC;YACAC;YACAU,YAAYT;QACd;IACF;IAEA,OAAOd;AACT,EAAC"}
@@ -1,4 +1,4 @@
1
- import type { Field } from 'payload/types';
1
+ import type { Field } from 'payload';
2
2
  import type { SanitizedServerEditorConfig } from '../../../../lexical/config/types.js';
3
3
  import type { HTMLConverter } from '../converter/types.js';
4
4
  type Props = {
@@ -9,6 +9,12 @@ type Props = {
9
9
  */
10
10
  hidden?: boolean;
11
11
  name: string;
12
+ /**
13
+ * Whether the HTML should be stored in the database
14
+ *
15
+ * @default false
16
+ */
17
+ storeInDB?: boolean;
12
18
  };
13
19
  /**
14
20
  * Combines the default HTML converters with HTML converters found in the features, and with HTML converters configured in the htmlConverter feature.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/converters/html/field/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,eAAe,CAAA;AAGzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAM1D,KAAK,KAAK,GAAG;IACX;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,sBAEnC;IACD,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAG,aAAa,EA+ChB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE;AACxB;;;;IAII;AACJ,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,KAAK,KACT,KAyHJ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/converters/html/field/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAqC,MAAM,SAAS,CAAA;AAGvE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAM1D,KAAK,KAAK,GAAG;IACX;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,sBAEnC;IACD,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAG,aAAa,EA+ChB,CAAA;AA0DD,eAAO,MAAM,WAAW,EAAE;AACxB;;;;IAII;AACJ,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,KAAK,KACT,KA6EJ,CAAA"}
@@ -44,8 +44,59 @@ import { convertLexicalToHTML } from '../converter/index.js';
44
44
  }
45
45
  return filteredConverters;
46
46
  };
47
+ // find the path of this field, as well as its sibling fields, by looking for this `field` in fields and traversing it recursively
48
+ function findFieldPathAndSiblingFields(fields, path, field) {
49
+ for (const curField of fields){
50
+ if (curField === field) {
51
+ return {
52
+ path: [
53
+ ...path,
54
+ curField.name
55
+ ],
56
+ siblingFields: fields
57
+ };
58
+ }
59
+ if ('fields' in curField) {
60
+ const result = findFieldPathAndSiblingFields(curField.fields, 'name' in curField ? [
61
+ ...path,
62
+ curField.name
63
+ ] : [
64
+ ...path
65
+ ], field);
66
+ if (result) {
67
+ return result;
68
+ }
69
+ } else if ('tabs' in curField) {
70
+ for (const tab of curField.tabs){
71
+ const result = findFieldPathAndSiblingFields(tab.fields, 'name' in tab ? [
72
+ ...path,
73
+ tab.name
74
+ ] : [
75
+ ...path
76
+ ], field);
77
+ if (result) {
78
+ return result;
79
+ }
80
+ }
81
+ } else if ('blocks' in curField) {
82
+ for (const block of curField.blocks){
83
+ if (block?.fields?.length) {
84
+ const result = findFieldPathAndSiblingFields(block.fields, [
85
+ ...path,
86
+ curField.name,
87
+ block.slug
88
+ ], field);
89
+ if (result) {
90
+ return result;
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ return null;
97
+ }
47
98
  export const lexicalHTML = (lexicalFieldName, props)=>{
48
- const { name = 'lexicalHTML', hidden = true } = props;
99
+ const { name = 'lexicalHTML', hidden = true, storeInDB = false } = props;
49
100
  return {
50
101
  name,
51
102
  type: 'code',
@@ -59,58 +110,7 @@ export const lexicalHTML = (lexicalFieldName, props)=>{
59
110
  afterRead: [
60
111
  async ({ collection, field, global, req, siblingData })=>{
61
112
  const fields = collection ? collection.fields : global.fields;
62
- // find the path of this field, as well as its sibling fields, by looking for this `field` in fields and traversing it recursively
63
- function findFieldPathAndSiblingFields(fields, path) {
64
- for (const curField of fields){
65
- if (curField === field) {
66
- return {
67
- path: [
68
- ...path,
69
- curField.name
70
- ],
71
- siblingFields: fields
72
- };
73
- }
74
- if ('fields' in curField) {
75
- const result = findFieldPathAndSiblingFields(curField.fields, 'name' in curField ? [
76
- ...path,
77
- curField.name
78
- ] : [
79
- ...path
80
- ]);
81
- if (result) {
82
- return result;
83
- }
84
- } else if ('tabs' in curField) {
85
- for (const tab of curField.tabs){
86
- const result = findFieldPathAndSiblingFields(tab.fields, 'name' in tab ? [
87
- ...path,
88
- tab.name
89
- ] : [
90
- ...path
91
- ]);
92
- if (result) {
93
- return result;
94
- }
95
- }
96
- } else if ('blocks' in curField) {
97
- for (const block of curField.blocks){
98
- if (block?.fields?.length) {
99
- const result = findFieldPathAndSiblingFields(block.fields, [
100
- ...path,
101
- curField.name,
102
- block.slug
103
- ]);
104
- if (result) {
105
- return result;
106
- }
107
- }
108
- }
109
- }
110
- }
111
- return null;
112
- }
113
- const foundSiblingFields = findFieldPathAndSiblingFields(fields, []);
113
+ const foundSiblingFields = findFieldPathAndSiblingFields(fields, [], field);
114
114
  if (!foundSiblingFields) throw new Error(`Could not find sibling fields of current lexicalHTML field with name ${field?.name}`);
115
115
  const { siblingFields } = foundSiblingFields;
116
116
  const lexicalField = siblingFields.find((field)=>'name' in field && field.name === lexicalFieldName);
@@ -137,6 +137,15 @@ export const lexicalHTML = (lexicalFieldName, props)=>{
137
137
  payload: req.payload
138
138
  });
139
139
  }
140
+ ],
141
+ beforeChange: [
142
+ ({ siblingData, value })=>{
143
+ if (storeInDB) {
144
+ return value;
145
+ }
146
+ delete siblingData[name];
147
+ return null;
148
+ }
140
149
  ]
141
150
  }
142
151
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/field/features/converters/html/field/index.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field, RichTextField } from 'payload/types'\n\nimport type { AdapterProps, LexicalRichTextAdapter } from '../../../../../types.js'\nimport type { SanitizedServerEditorConfig } from '../../../../lexical/config/types.js'\nimport type { HTMLConverter } from '../converter/types.js'\nimport type { HTMLConverterFeatureProps } from '../feature.server.js'\n\nimport { defaultHTMLConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToHTML } from '../converter/index.js'\n\ntype Props = {\n /**\n * Whether the lexicalHTML field should be hidden in the admin panel\n *\n * @default true\n */\n hidden?: boolean\n name: string\n}\n\n/**\n * Combines the default HTML converters with HTML converters found in the features, and with HTML converters configured in the htmlConverter feature.\n *\n * @param editorConfig\n */\nexport const consolidateHTMLConverters = ({\n editorConfig,\n}: {\n editorConfig: SanitizedServerEditorConfig\n}): HTMLConverter[] => {\n const htmlConverterFeature = editorConfig.resolvedFeatureMap.get('htmlConverter')\n const htmlConverterFeatureProps: HTMLConverterFeatureProps =\n htmlConverterFeature?.serverFeatureProps\n\n const defaultConvertersWithConvertersFromFeatures = [...defaultHTMLConverters]\n\n for (const converter of editorConfig.features.converters.html) {\n defaultConvertersWithConvertersFromFeatures.push(converter)\n }\n\n const finalConverters =\n htmlConverterFeatureProps?.converters &&\n typeof htmlConverterFeatureProps?.converters === 'function'\n ? htmlConverterFeatureProps.converters({\n defaultConverters: defaultConvertersWithConvertersFromFeatures,\n })\n : (htmlConverterFeatureProps?.converters as HTMLConverter[]) ||\n defaultConvertersWithConvertersFromFeatures\n\n // filter converters by nodeTypes. The last converter in the list wins. If there are multiple converters for the same nodeType, the last one will be used and the node types will be removed from\n // previous converters. If previous converters do not have any nodeTypes left, they will be removed from the list.\n // This guarantees that user-added converters which are added after the default ones will always have precedence\n const foundNodeTypes: string[] = []\n const filteredConverters: HTMLConverter[] = []\n for (const converter of finalConverters.reverse()) {\n if (!converter.nodeTypes?.length) {\n continue\n }\n const newConverter: HTMLConverter = {\n converter: converter.converter,\n nodeTypes: [...converter.nodeTypes],\n }\n newConverter.nodeTypes = newConverter.nodeTypes.filter((nodeType) => {\n if (foundNodeTypes.includes(nodeType)) {\n return false\n }\n foundNodeTypes.push(nodeType)\n return true\n })\n\n if (newConverter.nodeTypes.length) {\n filteredConverters.push(newConverter)\n }\n }\n\n return filteredConverters\n}\n\nexport const lexicalHTML: (\n /**\n * A string which matches the lexical field name you want to convert to HTML.\n *\n * This has to be a SIBLING field of this lexicalHTML field - otherwise, it won't be able to find the lexical field.\n **/\n lexicalFieldName: string,\n props: Props,\n) => Field = (lexicalFieldName, props) => {\n const { name = 'lexicalHTML', hidden = true } = props\n return {\n name,\n type: 'code',\n admin: {\n editorOptions: {\n language: 'html',\n },\n hidden,\n },\n hooks: {\n afterRead: [\n async ({ collection, field, global, req, siblingData }) => {\n const fields = collection ? collection.fields : global.fields\n\n // find the path of this field, as well as its sibling fields, by looking for this `field` in fields and traversing it recursively\n function findFieldPathAndSiblingFields(\n fields: Field[],\n path: string[],\n ): {\n path: string[]\n siblingFields: Field[]\n } {\n for (const curField of fields) {\n if (curField === field) {\n return {\n path: [...path, curField.name],\n siblingFields: fields,\n }\n }\n\n if ('fields' in curField) {\n const result = findFieldPathAndSiblingFields(\n curField.fields,\n 'name' in curField ? [...path, curField.name] : [...path],\n )\n if (result) {\n return result\n }\n } else if ('tabs' in curField) {\n for (const tab of curField.tabs) {\n const result = findFieldPathAndSiblingFields(\n tab.fields,\n 'name' in tab ? [...path, tab.name] : [...path],\n )\n if (result) {\n return result\n }\n }\n } else if ('blocks' in curField) {\n for (const block of curField.blocks) {\n if (block?.fields?.length) {\n const result = findFieldPathAndSiblingFields(block.fields, [\n ...path,\n curField.name,\n block.slug,\n ])\n if (result) {\n return result\n }\n }\n }\n }\n }\n\n return null\n }\n\n const foundSiblingFields = findFieldPathAndSiblingFields(fields, [])\n\n if (!foundSiblingFields)\n throw new Error(\n `Could not find sibling fields of current lexicalHTML field with name ${field?.name}`,\n )\n\n const { siblingFields } = foundSiblingFields\n const lexicalField: RichTextField<SerializedEditorState, AdapterProps> =\n siblingFields.find(\n (field) => 'name' in field && field.name === lexicalFieldName,\n ) as RichTextField<SerializedEditorState, AdapterProps>\n\n const lexicalFieldData: SerializedEditorState = siblingData[lexicalFieldName]\n\n if (!lexicalFieldData) {\n return ''\n }\n\n if (!lexicalField) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the referenced lexical field was not found',\n )\n }\n\n const config = (lexicalField?.editor as LexicalRichTextAdapter)?.editorConfig\n\n if (!config) {\n throw new Error(\n 'The linked lexical field does not have an editorConfig. This is needed for the lexicalHTML field.',\n )\n }\n\n if (!config?.resolvedFeatureMap?.has('htmlConverter')) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the linked lexical field does not have a HTMLConverterFeature',\n )\n }\n\n const finalConverters = consolidateHTMLConverters({\n editorConfig: config,\n })\n\n return await convertLexicalToHTML({\n converters: finalConverters,\n data: lexicalFieldData,\n payload: req.payload,\n })\n },\n ],\n },\n }\n}\n"],"names":["defaultHTMLConverters","convertLexicalToHTML","consolidateHTMLConverters","editorConfig","htmlConverterFeature","resolvedFeatureMap","get","htmlConverterFeatureProps","serverFeatureProps","defaultConvertersWithConvertersFromFeatures","converter","features","converters","html","push","finalConverters","defaultConverters","foundNodeTypes","filteredConverters","reverse","nodeTypes","length","newConverter","filter","nodeType","includes","lexicalHTML","lexicalFieldName","props","name","hidden","type","admin","editorOptions","language","hooks","afterRead","collection","field","global","req","siblingData","fields","findFieldPathAndSiblingFields","path","curField","siblingFields","result","tab","tabs","block","blocks","slug","foundSiblingFields","Error","lexicalField","find","lexicalFieldData","config","editor","has","data","payload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAQA,SAASA,qBAAqB,QAAQ,oCAAmC;AACzE,SAASC,oBAAoB,QAAQ,wBAAuB;AAY5D;;;;CAIC,GACD,OAAO,MAAMC,4BAA4B,CAAC,EACxCC,YAAY,EAGb;IACC,MAAMC,uBAAuBD,aAAaE,kBAAkB,CAACC,GAAG,CAAC;IACjE,MAAMC,4BACJH,sBAAsBI;IAExB,MAAMC,8CAA8C;WAAIT;KAAsB;IAE9E,KAAK,MAAMU,aAAaP,aAAaQ,QAAQ,CAACC,UAAU,CAACC,IAAI,CAAE;QAC7DJ,4CAA4CK,IAAI,CAACJ;IACnD;IAEA,MAAMK,kBACJR,2BAA2BK,cAC3B,OAAOL,2BAA2BK,eAAe,aAC7CL,0BAA0BK,UAAU,CAAC;QACnCI,mBAAmBP;IACrB,KACA,AAACF,2BAA2BK,cAC5BH;IAEN,iMAAiM;IACjM,kHAAkH;IAClH,gHAAgH;IAChH,MAAMQ,iBAA2B,EAAE;IACnC,MAAMC,qBAAsC,EAAE;IAC9C,KAAK,MAAMR,aAAaK,gBAAgBI,OAAO,GAAI;QACjD,IAAI,CAACT,UAAUU,SAAS,EAAEC,QAAQ;YAChC;QACF;QACA,MAAMC,eAA8B;YAClCZ,WAAWA,UAAUA,SAAS;YAC9BU,WAAW;mBAAIV,UAAUU,SAAS;aAA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CAAIe;qCAAK;oCAEjD,IAAIG,QAAQ;wCACV,OAAOA;oCACT;gCACF;4BACF,OAAO,IAAI,YAAYF,UAAU;gCAC/B,KAAK,MAAMK,SAASL,SAASM,MAAM,CAAE;oCACnC,IAAID,OAAOR,QAAQrB,QAAQ;wCACzB,MAAM0B,SAASJ,8BAA8BO,MAAMR,MAAM,EAAE;+CACtDE;4CACHC,SAAShB,IAAI;4CACbqB,MAAME,IAAI;yCACX;wCACD,IAAIL,QAAQ;4CACV,OAAOA;wCACT;oCACF;gCACF;4BACF;wBACF;wBAEA,OAAO;oBACT;oBAEA,MAAMM,qBAAqBV,8BAA8BD,QAAQ,EAAE;oBAEnE,IAAI,CAACW,oBACH,MAAM,IAAIC,MACR,CAAC,qEAAqE,EAAEhB,OAAOT,KAAK,CAAC;oBAGzF,MAAM,EAAEiB,aAAa,EAAE,GAAGO;oBAC1B,MAAME,eACJT,cAAcU,IAAI,CAChB,CAAClB,QAAU,UAAUA,SAASA,MAAMT,IAAI,KAAKF;oBAGjD,MAAM8B,mBAA0ChB,WAAW,CAACd,iBAAiB;oBAE7E,IAAI,CAAC8B,kBAAkB;wBACrB,OAAO;oBACT;oBAEA,IAAI,CAACF,cAAc;wBACjB,MAAM,IAAID,MACR;oBAEJ;oBAEA,MAAMI,SAAUH,cAAcI,QAAmCxD;oBAEjE,IAAI,CAACuD,QAAQ;wBACX,MAAM,IAAIJ,MACR;oBAEJ;oBAEA,IAAI,CAACI,QAAQrD,oBAAoBuD,IAAI,kBAAkB;wBACrD,MAAM,IAAIN,MACR;oBAEJ;oBAEA,MAAMvC,kBAAkBb,0BAA0B;wBAChDC,cAAcuD;oBAChB;oBAEA,OAAO,MAAMzD,qBAAqB;wBAChCW,YAAYG;wBACZ8C,MAAMJ;wBACNK,SAAStB,IAAIsB,OAAO;oBACtB;gBACF;aACD;QACH;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/field/features/converters/html/field/index.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field, FieldAffectingData, RichTextField } from 'payload'\n\nimport type { AdapterProps, LexicalRichTextAdapter } from '../../../../../types.js'\nimport type { SanitizedServerEditorConfig } from '../../../../lexical/config/types.js'\nimport type { HTMLConverter } from '../converter/types.js'\nimport type { HTMLConverterFeatureProps } from '../feature.server.js'\n\nimport { defaultHTMLConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToHTML } from '../converter/index.js'\n\ntype Props = {\n /**\n * Whether the lexicalHTML field should be hidden in the admin panel\n *\n * @default true\n */\n hidden?: boolean\n name: string\n /**\n * Whether the HTML should be stored in the database\n *\n * @default false\n */\n storeInDB?: boolean\n}\n\n/**\n * Combines the default HTML converters with HTML converters found in the features, and with HTML converters configured in the htmlConverter feature.\n *\n * @param editorConfig\n */\nexport const consolidateHTMLConverters = ({\n editorConfig,\n}: {\n editorConfig: SanitizedServerEditorConfig\n}): HTMLConverter[] => {\n const htmlConverterFeature = editorConfig.resolvedFeatureMap.get('htmlConverter')\n const htmlConverterFeatureProps: HTMLConverterFeatureProps =\n htmlConverterFeature?.serverFeatureProps\n\n const defaultConvertersWithConvertersFromFeatures = [...defaultHTMLConverters]\n\n for (const converter of editorConfig.features.converters.html) {\n defaultConvertersWithConvertersFromFeatures.push(converter)\n }\n\n const finalConverters =\n htmlConverterFeatureProps?.converters &&\n typeof htmlConverterFeatureProps?.converters === 'function'\n ? htmlConverterFeatureProps.converters({\n defaultConverters: defaultConvertersWithConvertersFromFeatures,\n })\n : (htmlConverterFeatureProps?.converters as HTMLConverter[]) ||\n defaultConvertersWithConvertersFromFeatures\n\n // filter converters by nodeTypes. The last converter in the list wins. If there are multiple converters for the same nodeType, the last one will be used and the node types will be removed from\n // previous converters. If previous converters do not have any nodeTypes left, they will be removed from the list.\n // This guarantees that user-added converters which are added after the default ones will always have precedence\n const foundNodeTypes: string[] = []\n const filteredConverters: HTMLConverter[] = []\n for (const converter of finalConverters.reverse()) {\n if (!converter.nodeTypes?.length) {\n continue\n }\n const newConverter: HTMLConverter = {\n converter: converter.converter,\n nodeTypes: [...converter.nodeTypes],\n }\n newConverter.nodeTypes = newConverter.nodeTypes.filter((nodeType) => {\n if (foundNodeTypes.includes(nodeType)) {\n return false\n }\n foundNodeTypes.push(nodeType)\n return true\n })\n\n if (newConverter.nodeTypes.length) {\n filteredConverters.push(newConverter)\n }\n }\n\n return filteredConverters\n}\n\n// find the path of this field, as well as its sibling fields, by looking for this `field` in fields and traversing it recursively\nfunction findFieldPathAndSiblingFields(\n fields: Field[],\n path: string[],\n field: FieldAffectingData,\n): {\n path: string[]\n siblingFields: Field[]\n} {\n for (const curField of fields) {\n if (curField === field) {\n return {\n path: [...path, curField.name],\n siblingFields: fields,\n }\n }\n\n if ('fields' in curField) {\n const result = findFieldPathAndSiblingFields(\n curField.fields,\n 'name' in curField ? [...path, curField.name] : [...path],\n field,\n )\n if (result) {\n return result\n }\n } else if ('tabs' in curField) {\n for (const tab of curField.tabs) {\n const result = findFieldPathAndSiblingFields(\n tab.fields,\n 'name' in tab ? [...path, tab.name] : [...path],\n field,\n )\n if (result) {\n return result\n }\n }\n } else if ('blocks' in curField) {\n for (const block of curField.blocks) {\n if (block?.fields?.length) {\n const result = findFieldPathAndSiblingFields(\n block.fields,\n [...path, curField.name, block.slug],\n field,\n )\n if (result) {\n return result\n }\n }\n }\n }\n }\n\n return null\n}\n\nexport const lexicalHTML: (\n /**\n * A string which matches the lexical field name you want to convert to HTML.\n *\n * This has to be a SIBLING field of this lexicalHTML field - otherwise, it won't be able to find the lexical field.\n **/\n lexicalFieldName: string,\n props: Props,\n) => Field = (lexicalFieldName, props) => {\n const { name = 'lexicalHTML', hidden = true, storeInDB = false } = props\n return {\n name,\n type: 'code',\n admin: {\n editorOptions: {\n language: 'html',\n },\n hidden,\n },\n hooks: {\n afterRead: [\n async ({ collection, field, global, req, siblingData }) => {\n const fields = collection ? collection.fields : global.fields\n\n const foundSiblingFields = findFieldPathAndSiblingFields(fields, [], field)\n\n if (!foundSiblingFields)\n throw new Error(\n `Could not find sibling fields of current lexicalHTML field with name ${field?.name}`,\n )\n\n const { siblingFields } = foundSiblingFields\n const lexicalField: RichTextField<SerializedEditorState, AdapterProps> =\n siblingFields.find(\n (field) => 'name' in field && field.name === lexicalFieldName,\n ) as RichTextField<SerializedEditorState, AdapterProps>\n\n const lexicalFieldData: SerializedEditorState = siblingData[lexicalFieldName]\n\n if (!lexicalFieldData) {\n return ''\n }\n\n if (!lexicalField) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the referenced lexical field was not found',\n )\n }\n\n const config = (lexicalField?.editor as LexicalRichTextAdapter)?.editorConfig\n\n if (!config) {\n throw new Error(\n 'The linked lexical field does not have an editorConfig. This is needed for the lexicalHTML field.',\n )\n }\n\n if (!config?.resolvedFeatureMap?.has('htmlConverter')) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the linked lexical field does not have a HTMLConverterFeature',\n )\n }\n\n const finalConverters = consolidateHTMLConverters({\n editorConfig: config,\n })\n\n return await convertLexicalToHTML({\n converters: finalConverters,\n data: lexicalFieldData,\n payload: req.payload,\n })\n },\n ],\n beforeChange: [\n ({ siblingData, value }) => {\n if (storeInDB) {\n return value\n }\n delete siblingData[name]\n return null\n },\n ],\n },\n }\n}\n"],"names":["defaultHTMLConverters","convertLexicalToHTML","consolidateHTMLConverters","editorConfig","htmlConverterFeature","resolvedFeatureMap","get","htmlConverterFeatureProps","serverFeatureProps","defaultConvertersWithConvertersFromFeatures","converter","features","converters","html","push","finalConverters","defaultConverters","foundNodeTypes","filteredConverters","reverse","nodeTypes","length","newConverter","filter","nodeType","includes","findFieldPathAndSiblingFields","fields","path","field","curField","name","siblingFields","result","tab","tabs","block","blocks","slug","lexicalHTML","lexicalFieldName","props","hidden","storeInDB","type","admin","editorOptions","language","hooks","afterRead","collection","global","req","siblingData","foundSiblingFields","Error","lexicalField","find","lexicalFieldData","config","editor","has","data","payload","beforeChange","value"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;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B,KAAK,EAAEsB,MAAM,EAAEC,GAAG,EAAEC,WAAW,EAAE;oBACpD,MAAM1B,SAASuB,aAAaA,WAAWvB,MAAM,GAAGwB,OAAOxB,MAAM;oBAE7D,MAAM2B,qBAAqB5B,8BAA8BC,QAAQ,EAAE,EAAEE;oBAErE,IAAI,CAACyB,oBACH,MAAM,IAAIC,MACR,CAAC,qEAAqE,EAAE1B,OAAOE,KAAK,CAAC;oBAGzF,MAAM,EAAEC,aAAa,EAAE,GAAGsB;oBAC1B,MAAME,eACJxB,cAAcyB,IAAI,CAChB,CAAC5B,QAAU,UAAUA,SAASA,MAAME,IAAI,KAAKS;oBAGjD,MAAMkB,mBAA0CL,WAAW,CAACb,iBAAiB;oBAE7E,IAAI,CAACkB,kBAAkB;wBACrB,OAAO;oBACT;oBAEA,IAAI,CAACF,cAAc;wBACjB,MAAM,IAAID,MACR;oBAEJ;oBAEA,MAAMI,SAAUH,cAAcI,QAAmCzD;oBAEjE,IAAI,CAACwD,QAAQ;wBACX,MAAM,IAAIJ,MACR;oBAEJ;oBAEA,IAAI,CAACI,QAAQtD,oBAAoBwD,IAAI,kBAAkB;wBACrD,MAAM,IAAIN,MACR;oBAEJ;oBAEA,MAAMxC,kBAAkBb,0BAA0B;wBAChDC,cAAcwD;oBAChB;oBAEA,OAAO,MAAM1D,qBAAqB;wBAChCW,YAAYG;wBACZ+C,MAAMJ;wBACNK,SAASX,IAAIW,OAAO;oBACtB;gBACF;aACD;YACDC,cAAc;gBACZ,CAAC,EAAEX,WAAW,EAAEY,KAAK,EAAE;oBACrB,IAAItB,WAAW;wBACb,OAAOsB;oBACT;oBACA,OAAOZ,WAAW,CAACtB,KAAK;oBACxB,OAAO;gBACT;aACD;QACH;IACF;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createFeaturePropComponent.d.ts","sourceRoot":"","sources":["../../../src/field/features/createFeaturePropComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAoB9B,eAAO,MAAM,0BAA0B,sBAC/B,CAAC,KACN,MAAM,EAAE,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAKvD,CAAA"}
1
+ {"version":3,"file":"createFeaturePropComponent.d.ts","sourceRoot":"","sources":["../../../src/field/features/createFeaturePropComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAkB9B,eAAO,MAAM,0BAA0B,sBAC/B,CAAC,KACN,MAAM,EAAE,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAKvD,CAAA"}
@@ -1,7 +1,5 @@
1
1
  'use client';
2
- import { useTableCell } from '@payloadcms/ui/elements/Table';
3
- import { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider';
4
- import { useAddClientFunction } from '@payloadcms/ui/providers/ClientFunction';
2
+ import { useAddClientFunction, useFieldProps, useTableCell } from '@payloadcms/ui/client';
5
3
  const useLexicalFeatureProp = (featureKey, componentKey, prop)=>{
6
4
  const { schemaPath: schemaPathFromFieldProps } = useFieldProps();
7
5
  const tableCell = useTableCell();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/features/createFeaturePropComponent.tsx"],"sourcesContent":["'use client'\n\nimport type React from 'react'\n\nimport { useTableCell } from '@payloadcms/ui/elements/Table'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useAddClientFunction } from '@payloadcms/ui/providers/ClientFunction'\n\nconst useLexicalFeatureProp = <T,>(featureKey: string, componentKey: string, prop: T) => {\n const { schemaPath: schemaPathFromFieldProps } = useFieldProps()\n const tableCell = useTableCell()\n\n const schemaPathFromCellProps = tableCell?.cellProps?.schemaPath\n\n const schemaPath = schemaPathFromCellProps || schemaPathFromFieldProps // schemaPathFromCellProps needs to have priority, as there can be cells within fields (e.g. list drawers) and the cell schemaPath needs to be used there - not the parent field schemaPath. There cannot be fields within cells.\n\n useAddClientFunction(\n `lexicalFeature.${schemaPath}.${featureKey}.components.${componentKey}`,\n prop,\n )\n}\n\nexport const createFeaturePropComponent = <T = unknown,>(\n prop: T,\n): React.FC<{ componentKey: string; featureKey: string }> => {\n return (props) => {\n useLexicalFeatureProp(props.featureKey, props.componentKey, prop)\n return null\n }\n}\n"],"names":["useTableCell","useFieldProps","useAddClientFunction","useLexicalFeatureProp","featureKey","componentKey","prop","schemaPath","schemaPathFromFieldProps","tableCell","schemaPathFromCellProps","cellProps","createFeaturePropComponent","props"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,YAAY,QAAQ,gCAA+B;AAC5D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,oBAAoB,QAAQ,0CAAyC;AAE9E,MAAMC,wBAAwB,CAAKC,YAAoBC,cAAsBC;IAC3E,MAAM,EAAEC,YAAYC,wBAAwB,EAAE,GAAGP;IACjD,MAAMQ,YAAYT;IAElB,MAAMU,0BAA0BD,WAAWE,WAAWJ;IAEtD,MAAMA,aAAaG,2BAA2BF,yBAAyB,iOAAiO;;IAExSN,qBACE,CAAC,eAAe,EAAEK,WAAW,CAAC,EAAEH,WAAW,YAAY,EAAEC,aAAa,CAAC,EACvEC;AAEJ;AAEA,OAAO,MAAMM,6BAA6B,CACxCN;IAEA,OAAO,CAACO;QACNV,sBAAsBU,MAAMT,UAAU,EAAES,MAAMR,YAAY,EAAEC;QAC5D,OAAO;IACT;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/features/createFeaturePropComponent.tsx"],"sourcesContent":["'use client'\n\nimport type React from 'react'\n\nimport { useAddClientFunction, useFieldProps, useTableCell } from '@payloadcms/ui/client'\n\nconst useLexicalFeatureProp = <T,>(featureKey: string, componentKey: string, prop: T) => {\n const { schemaPath: schemaPathFromFieldProps } = useFieldProps()\n const tableCell = useTableCell()\n\n const schemaPathFromCellProps = tableCell?.cellProps?.schemaPath\n\n const schemaPath = schemaPathFromCellProps || schemaPathFromFieldProps // schemaPathFromCellProps needs to have priority, as there can be cells within fields (e.g. list drawers) and the cell schemaPath needs to be used there - not the parent field schemaPath. There cannot be fields within cells.\n\n useAddClientFunction(\n `lexicalFeature.${schemaPath}.${featureKey}.components.${componentKey}`,\n prop,\n )\n}\n\nexport const createFeaturePropComponent = <T = unknown,>(\n prop: T,\n): React.FC<{ componentKey: string; featureKey: string }> => {\n return (props) => {\n useLexicalFeatureProp(props.featureKey, props.componentKey, prop)\n return null\n }\n}\n"],"names":["useAddClientFunction","useFieldProps","useTableCell","useLexicalFeatureProp","featureKey","componentKey","prop","schemaPath","schemaPathFromFieldProps","tableCell","schemaPathFromCellProps","cellProps","createFeaturePropComponent","props"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,oBAAoB,EAAEC,aAAa,EAAEC,YAAY,QAAQ,wBAAuB;AAEzF,MAAMC,wBAAwB,CAAKC,YAAoBC,cAAsBC;IAC3E,MAAM,EAAEC,YAAYC,wBAAwB,EAAE,GAAGP;IACjD,MAAMQ,YAAYP;IAElB,MAAMQ,0BAA0BD,WAAWE,WAAWJ;IAEtD,MAAMA,aAAaG,2BAA2BF,yBAAyB,iOAAiO;;IAExSR,qBACE,CAAC,eAAe,EAAEO,WAAW,CAAC,EAAEH,WAAW,YAAY,EAAEC,aAAa,CAAC,EACvEC;AAEJ;AAEA,OAAO,MAAMM,6BAA6B,CACxCN;IAEA,OAAO,CAACO;QACNV,sBAAsBU,MAAMT,UAAU,EAAES,MAAMR,YAAY,EAAEC;QAC5D,OAAO;IACT;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/testRecorder/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAInE,eAAO,MAAM,mBAAmB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAWnF,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/testRecorder/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAKnE,eAAO,MAAM,mBAAmB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAWnF,CAAA"}
@@ -1,4 +1,5 @@
1
- import { TestRecorderFeatureClientComponent } from './feature.client.js';
1
+ // eslint-disable-next-line payload/no-imports-from-exports-dir
2
+ import { TestRecorderFeatureClientComponent } from '../../../../exports/client/index.js';
2
3
  export const TestRecorderFeature = (props)=>{
3
4
  return {
4
5
  feature: ()=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/debug/testRecorder/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { TestRecorderFeatureClientComponent } from './feature.client.js'\n\nexport const TestRecorderFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: TestRecorderFeatureClientComponent,\n serverFeatureProps: props,\n }\n },\n key: 'testRecorder',\n serverFeatureProps: props,\n }\n}\n"],"names":["TestRecorderFeatureClientComponent","TestRecorderFeature","props","feature","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAEA,SAASA,kCAAkC,QAAQ,sBAAqB;AAExE,OAAO,MAAMC,sBAA2E,CAACC;IACvF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoBH;YACtB;QACF;QACAI,KAAK;QACLD,oBAAoBH;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/debug/testRecorder/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { TestRecorderFeatureClientComponent } from '../../../../exports/client/index.js'\n\nexport const TestRecorderFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: TestRecorderFeatureClientComponent,\n serverFeatureProps: props,\n }\n },\n key: 'testRecorder',\n serverFeatureProps: props,\n }\n}\n"],"names":["TestRecorderFeatureClientComponent","TestRecorderFeature","props","feature","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAEA,+DAA+D;AAC/D,SAASA,kCAAkC,QAAQ,sCAAqC;AAExF,OAAO,MAAMC,sBAA2E,CAACC;IACvF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoBH;YACtB;QACF;QACAI,KAAK;QACLD,oBAAoBH;IACtB;AACF,EAAC"}
@@ -5,7 +5,6 @@ import { $createParagraphNode, $createTextNode, $getRoot } from 'lexical';
5
5
  import * as React from 'react';
6
6
  import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
7
7
  import { IS_APPLE } from '../../../../lexical/utils/environment.js';
8
- import './index.scss';
9
8
  const copy = (text)=>{
10
9
  const textArea = document.createElement('textarea');
11
10
  textArea.value = text || '';
@@ -90,7 +89,7 @@ const formatStep = (step)=>{
90
89
  }
91
90
  };
92
91
  export function isSelectAll(event) {
93
- return event.code === 'KeyA' && (IS_APPLE ? event.metaKey : event.ctrlKey);
92
+ return event.key.toLowerCase() === 'a' && (IS_APPLE ? event.metaKey : event.ctrlKey);
94
93
  }
95
94
  // stolen from LexicalSelection-test
96
95
  function sanitizeSelection(selection) {