@payloadcms/richtext-lexical 3.0.0-beta.133 → 3.0.0-beta.135

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 (406) hide show
  1. package/dist/exports/client/Field-KKSJXHR7.js +2 -0
  2. package/dist/exports/client/Field-KKSJXHR7.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-2CYU43GM.js +2 -0
  5. package/dist/exports/client/chunk-2CYU43GM.js.map +7 -0
  6. package/dist/exports/client/chunk-C7S3V4EB.js +2 -0
  7. package/dist/exports/client/chunk-C7S3V4EB.js.map +7 -0
  8. package/dist/exports/client/chunk-QPPOQTHD.js +2 -0
  9. package/dist/exports/client/{chunk-OOBB5GCO.js.map → chunk-QPPOQTHD.js.map} +3 -3
  10. package/dist/exports/client/chunk-U7O7EYCP.js +2 -0
  11. package/dist/exports/client/chunk-U7O7EYCP.js.map +7 -0
  12. package/dist/exports/client/component-H3EYQ5KG.js +2 -0
  13. package/dist/exports/client/{component-YICNYPTU.js.map → component-H3EYQ5KG.js.map} +1 -1
  14. package/dist/exports/client/componentInline-ZGO3K4TA.js +2 -0
  15. package/dist/exports/client/componentInline-ZGO3K4TA.js.map +7 -0
  16. package/dist/exports/client/index.d.ts +7 -0
  17. package/dist/exports/client/index.d.ts.map +1 -1
  18. package/dist/exports/client/index.js +15 -13
  19. package/dist/exports/client/index.js.map +4 -4
  20. package/dist/exports/server/ast/mdx.d.ts +7 -0
  21. package/dist/exports/server/ast/mdx.d.ts.map +1 -0
  22. package/dist/exports/server/ast/mdx.js +37 -0
  23. package/dist/exports/server/ast/mdx.js.map +1 -0
  24. package/dist/exports/shared.d.ts +4 -0
  25. package/dist/exports/shared.d.ts.map +1 -0
  26. package/dist/exports/shared.js +4 -0
  27. package/dist/exports/shared.js.map +1 -0
  28. package/dist/features/blocks/client/component/BlockContent.d.ts +34 -9
  29. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  30. package/dist/features/blocks/client/component/BlockContent.js +63 -158
  31. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  32. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts +11 -0
  33. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts.map +1 -0
  34. package/dist/features/blocks/client/component/components/BlockCollapsible.js +37 -0
  35. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -0
  36. package/dist/features/blocks/client/component/components/BlockEditButton.d.ts +3 -0
  37. package/dist/features/blocks/client/component/components/BlockEditButton.d.ts.map +1 -0
  38. package/dist/features/blocks/client/component/components/BlockEditButton.js +22 -0
  39. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -0
  40. package/dist/features/blocks/client/component/components/BlockRemoveButton.d.ts +3 -0
  41. package/dist/features/blocks/client/component/components/BlockRemoveButton.d.ts.map +1 -0
  42. package/dist/features/blocks/client/component/components/BlockRemoveButton.js +22 -0
  43. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -0
  44. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  45. package/dist/features/blocks/client/component/index.js +242 -63
  46. package/dist/features/blocks/client/component/index.js.map +1 -1
  47. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts +5 -0
  48. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -0
  49. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +28 -0
  50. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -0
  51. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.d.ts +3 -0
  52. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.d.ts.map +1 -0
  53. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +22 -0
  54. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -0
  55. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.d.ts +3 -0
  56. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.d.ts.map +1 -0
  57. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +22 -0
  58. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -0
  59. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.d.ts +3 -0
  60. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.d.ts.map +1 -0
  61. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +22 -0
  62. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -0
  63. package/dist/features/blocks/client/componentInline/index.d.ts +13 -1
  64. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  65. package/dist/features/blocks/client/componentInline/index.js +219 -43
  66. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  67. package/dist/features/blocks/client/index.d.ts +1 -5
  68. package/dist/features/blocks/client/index.d.ts.map +1 -1
  69. package/dist/features/blocks/client/index.js +138 -157
  70. package/dist/features/blocks/client/index.js.map +1 -1
  71. package/dist/features/blocks/client/markdownTransformer.d.ts +16 -0
  72. package/dist/features/blocks/client/markdownTransformer.d.ts.map +1 -0
  73. package/dist/features/blocks/client/markdownTransformer.js +144 -0
  74. package/dist/features/blocks/client/markdownTransformer.js.map +1 -0
  75. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  76. package/dist/features/blocks/client/nodes/BlocksNode.js +1 -3
  77. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  78. package/dist/features/blocks/client/plugin/commands.d.ts +0 -4
  79. package/dist/features/blocks/client/plugin/commands.d.ts.map +1 -1
  80. package/dist/features/blocks/client/plugin/commands.js +0 -1
  81. package/dist/features/blocks/client/plugin/commands.js.map +1 -1
  82. package/dist/features/blocks/client/plugin/index.d.ts +1 -2
  83. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  84. package/dist/features/blocks/client/plugin/index.js +28 -135
  85. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  86. package/dist/features/blocks/server/index.d.ts +1 -2
  87. package/dist/features/blocks/server/index.d.ts.map +1 -1
  88. package/dist/features/blocks/server/index.js +33 -10
  89. package/dist/features/blocks/server/index.js.map +1 -1
  90. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts +22 -0
  91. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts.map +1 -0
  92. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js +136 -0
  93. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js.map +1 -0
  94. package/dist/features/blocks/server/markdownTransformer.d.ts +22 -0
  95. package/dist/features/blocks/server/markdownTransformer.d.ts.map +1 -0
  96. package/dist/features/blocks/server/markdownTransformer.js +400 -0
  97. package/dist/features/blocks/server/markdownTransformer.js.map +1 -0
  98. package/dist/features/experimental_table/client/index.d.ts.map +1 -1
  99. package/dist/features/experimental_table/client/index.js +2 -0
  100. package/dist/features/experimental_table/client/index.js.map +1 -1
  101. package/dist/features/experimental_table/markdownTransformer.d.ts +5 -0
  102. package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -0
  103. package/dist/features/experimental_table/markdownTransformer.js +127 -0
  104. package/dist/features/experimental_table/markdownTransformer.js.map +1 -0
  105. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  106. package/dist/features/experimental_table/server/index.js +2 -0
  107. package/dist/features/experimental_table/server/index.js.map +1 -1
  108. package/dist/features/typesClient.d.ts +12 -19
  109. package/dist/features/typesClient.d.ts.map +1 -1
  110. package/dist/features/typesClient.js.map +1 -1
  111. package/dist/features/typesServer.d.ts +6 -2
  112. package/dist/features/typesServer.d.ts.map +1 -1
  113. package/dist/features/typesServer.js.map +1 -1
  114. package/dist/field/Field.d.ts.map +1 -1
  115. package/dist/field/Field.js +10 -21
  116. package/dist/field/Field.js.map +1 -1
  117. package/dist/field/bundled.css +1 -1
  118. package/dist/field/index.d.ts.map +1 -1
  119. package/dist/field/index.js +23 -14
  120. package/dist/field/index.js.map +1 -1
  121. package/dist/field/rscEntry.d.ts.map +1 -1
  122. package/dist/field/rscEntry.js +23 -1
  123. package/dist/field/rscEntry.js.map +1 -1
  124. package/dist/index.d.ts +4 -1
  125. package/dist/index.d.ts.map +1 -1
  126. package/dist/index.js +4 -1
  127. package/dist/index.js.map +1 -1
  128. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  129. package/dist/lexical/LexicalProvider.js +9 -18
  130. package/dist/lexical/LexicalProvider.js.map +1 -1
  131. package/dist/lexical/config/client/loader.d.ts +6 -1
  132. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  133. package/dist/lexical/config/client/loader.js +6 -0
  134. package/dist/lexical/config/client/loader.js.map +1 -1
  135. package/dist/lexical/config/client/sanitize.js +15 -14
  136. package/dist/lexical/config/client/sanitize.js.map +1 -1
  137. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  138. package/dist/lexical/config/server/sanitize.js +15 -2
  139. package/dist/lexical/config/server/sanitize.js.map +1 -1
  140. package/dist/lexical/nodes/index.d.ts +4 -0
  141. package/dist/lexical/nodes/index.d.ts.map +1 -1
  142. package/dist/lexical/nodes/index.js +8 -1
  143. package/dist/lexical/nodes/index.js.map +1 -1
  144. package/dist/lexical-proxy/@lexical-headless.d.ts +2 -0
  145. package/dist/lexical-proxy/@lexical-headless.d.ts.map +1 -0
  146. package/dist/lexical-proxy/@lexical-headless.js +2 -0
  147. package/dist/lexical-proxy/@lexical-headless.js.map +1 -0
  148. package/dist/lexical-proxy/@lexical-link.d.ts +2 -0
  149. package/dist/lexical-proxy/@lexical-link.d.ts.map +1 -0
  150. package/dist/lexical-proxy/@lexical-link.js +2 -0
  151. package/dist/lexical-proxy/@lexical-link.js.map +1 -0
  152. package/dist/lexical-proxy/@lexical-list.d.ts +2 -0
  153. package/dist/lexical-proxy/@lexical-list.d.ts.map +1 -0
  154. package/dist/lexical-proxy/@lexical-list.js +2 -0
  155. package/dist/lexical-proxy/@lexical-list.js.map +1 -0
  156. package/dist/lexical-proxy/@lexical-mark.d.ts +2 -0
  157. package/dist/lexical-proxy/@lexical-mark.d.ts.map +1 -0
  158. package/dist/lexical-proxy/@lexical-mark.js +2 -0
  159. package/dist/lexical-proxy/@lexical-mark.js.map +1 -0
  160. package/dist/lexical-proxy/@lexical-markdown.d.ts +2 -0
  161. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -0
  162. package/dist/lexical-proxy/@lexical-markdown.js +2 -0
  163. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -0
  164. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.d.ts +2 -0
  165. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.d.ts.map +1 -0
  166. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.js +2 -0
  167. package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.js.map +1 -0
  168. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.d.ts +2 -0
  169. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.d.ts.map +1 -0
  170. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.js +2 -0
  171. package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.js.map +1 -0
  172. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.d.ts +2 -0
  173. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.d.ts.map +1 -0
  174. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.js +2 -0
  175. package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.js.map +1 -0
  176. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.d.ts +2 -0
  177. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.d.ts.map +1 -0
  178. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.js +2 -0
  179. package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.js.map +1 -0
  180. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.d.ts +2 -0
  181. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.d.ts.map +1 -0
  182. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.js +2 -0
  183. package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.js.map +1 -0
  184. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.d.ts +2 -0
  185. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.d.ts.map +1 -0
  186. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.js +2 -0
  187. package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.js.map +1 -0
  188. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.d.ts +2 -0
  189. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.d.ts.map +1 -0
  190. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.js +2 -0
  191. package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.js.map +1 -0
  192. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.d.ts +2 -0
  193. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.d.ts.map +1 -0
  194. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.js +2 -0
  195. package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.js.map +1 -0
  196. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.d.ts +2 -0
  197. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.d.ts.map +1 -0
  198. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.js +2 -0
  199. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.js.map +1 -0
  200. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.d.ts +2 -0
  201. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.d.ts.map +1 -0
  202. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.js +2 -0
  203. package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.js.map +1 -0
  204. package/dist/lexical-proxy/@lexical-react/LexicalComposer.d.ts +2 -0
  205. package/dist/lexical-proxy/@lexical-react/LexicalComposer.d.ts.map +1 -0
  206. package/dist/lexical-proxy/@lexical-react/LexicalComposer.js +2 -0
  207. package/dist/lexical-proxy/@lexical-react/LexicalComposer.js.map +1 -0
  208. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.d.ts +2 -0
  209. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.d.ts.map +1 -0
  210. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.js +2 -0
  211. package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.js.map +1 -0
  212. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.d.ts +2 -0
  213. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.d.ts.map +1 -0
  214. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.js +2 -0
  215. package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.js.map +1 -0
  216. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +2 -0
  217. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +1 -0
  218. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +2 -0
  219. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +1 -0
  220. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.d.ts +2 -0
  221. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.d.ts.map +1 -0
  222. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.js +2 -0
  223. package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.js.map +1 -0
  224. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.d.ts +2 -0
  225. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.d.ts.map +1 -0
  226. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.js +2 -0
  227. package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.js.map +1 -0
  228. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.d.ts +2 -0
  229. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.d.ts.map +1 -0
  230. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.js +2 -0
  231. package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.js.map +1 -0
  232. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.d.ts +2 -0
  233. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.d.ts.map +1 -0
  234. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.js +2 -0
  235. package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.js.map +1 -0
  236. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.d.ts +2 -0
  237. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.d.ts.map +1 -0
  238. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.js +2 -0
  239. package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.js.map +1 -0
  240. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.d.ts +2 -0
  241. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.d.ts.map +1 -0
  242. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.js +2 -0
  243. package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.js.map +1 -0
  244. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.d.ts +2 -0
  245. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.d.ts.map +1 -0
  246. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.js +2 -0
  247. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.js.map +1 -0
  248. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.d.ts +2 -0
  249. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.d.ts.map +1 -0
  250. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.js +2 -0
  251. package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.js.map +1 -0
  252. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.d.ts +2 -0
  253. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.d.ts.map +1 -0
  254. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.js +2 -0
  255. package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.js.map +1 -0
  256. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.d.ts +2 -0
  257. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.d.ts.map +1 -0
  258. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.js +2 -0
  259. package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.js.map +1 -0
  260. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.d.ts +2 -0
  261. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.d.ts.map +1 -0
  262. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.js +2 -0
  263. package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.js.map +1 -0
  264. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.d.ts +2 -0
  265. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.d.ts.map +1 -0
  266. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.js +2 -0
  267. package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.js.map +1 -0
  268. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.d.ts +2 -0
  269. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.d.ts.map +1 -0
  270. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.js +2 -0
  271. package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.js.map +1 -0
  272. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.d.ts +2 -0
  273. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.d.ts.map +1 -0
  274. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.js +2 -0
  275. package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.js.map +1 -0
  276. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.d.ts +2 -0
  277. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.d.ts.map +1 -0
  278. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.js +2 -0
  279. package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.js.map +1 -0
  280. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.d.ts +2 -0
  281. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.d.ts.map +1 -0
  282. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.js +2 -0
  283. package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.js.map +1 -0
  284. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.d.ts +2 -0
  285. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.d.ts.map +1 -0
  286. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.js +2 -0
  287. package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.js.map +1 -0
  288. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.d.ts +2 -0
  289. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.d.ts.map +1 -0
  290. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.js +2 -0
  291. package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.js.map +1 -0
  292. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.d.ts +2 -0
  293. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.d.ts.map +1 -0
  294. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.js +2 -0
  295. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.js.map +1 -0
  296. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.d.ts +2 -0
  297. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.d.ts.map +1 -0
  298. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.js +2 -0
  299. package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.js.map +1 -0
  300. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.d.ts +2 -0
  301. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.d.ts.map +1 -0
  302. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.js +2 -0
  303. package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.js.map +1 -0
  304. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.d.ts +2 -0
  305. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.d.ts.map +1 -0
  306. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.js +2 -0
  307. package/dist/lexical-proxy/@lexical-react/LexicalTreeView.js.map +1 -0
  308. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.d.ts +2 -0
  309. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.d.ts.map +1 -0
  310. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.js +2 -0
  311. package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.js.map +1 -0
  312. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.d.ts +2 -0
  313. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.d.ts.map +1 -0
  314. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.js +2 -0
  315. package/dist/lexical-proxy/@lexical-react/useLexicalEditable.js.map +1 -0
  316. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.d.ts +2 -0
  317. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.d.ts.map +1 -0
  318. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.js +2 -0
  319. package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.js.map +1 -0
  320. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.d.ts +2 -0
  321. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.d.ts.map +1 -0
  322. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.js +2 -0
  323. package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.js.map +1 -0
  324. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.d.ts +2 -0
  325. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.d.ts.map +1 -0
  326. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.js +2 -0
  327. package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.js.map +1 -0
  328. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.d.ts +2 -0
  329. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.d.ts.map +1 -0
  330. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.js +2 -0
  331. package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.js.map +1 -0
  332. package/dist/lexical-proxy/@lexical-rich-text.d.ts +2 -0
  333. package/dist/lexical-proxy/@lexical-rich-text.d.ts.map +1 -0
  334. package/dist/lexical-proxy/@lexical-rich-text.js +2 -0
  335. package/dist/lexical-proxy/@lexical-rich-text.js.map +1 -0
  336. package/dist/lexical-proxy/@lexical-selection.d.ts +2 -0
  337. package/dist/lexical-proxy/@lexical-selection.d.ts.map +1 -0
  338. package/dist/lexical-proxy/@lexical-selection.js +2 -0
  339. package/dist/lexical-proxy/@lexical-selection.js.map +1 -0
  340. package/dist/lexical-proxy/@lexical-utils.d.ts +2 -0
  341. package/dist/lexical-proxy/@lexical-utils.d.ts.map +1 -0
  342. package/dist/lexical-proxy/@lexical-utils.js +2 -0
  343. package/dist/lexical-proxy/@lexical-utils.js.map +1 -0
  344. package/dist/lexical-proxy/lexical.d.ts +2 -0
  345. package/dist/lexical-proxy/lexical.d.ts.map +1 -0
  346. package/dist/lexical-proxy/lexical.js +2 -0
  347. package/dist/lexical-proxy/lexical.js.map +1 -0
  348. package/dist/types.d.ts +2 -0
  349. package/dist/types.d.ts.map +1 -1
  350. package/dist/types.js.map +1 -1
  351. package/dist/utilities/buildInitialState.d.ts +27 -0
  352. package/dist/utilities/buildInitialState.d.ts.map +1 -0
  353. package/dist/utilities/buildInitialState.js +53 -0
  354. package/dist/utilities/buildInitialState.js.map +1 -0
  355. package/dist/utilities/createClientFeature.d.ts +5 -0
  356. package/dist/utilities/createClientFeature.d.ts.map +1 -1
  357. package/dist/utilities/createClientFeature.js +6 -0
  358. package/dist/utilities/createClientFeature.js.map +1 -1
  359. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  360. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -5
  361. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  362. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  363. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js +8 -8
  364. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -1
  365. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  366. package/dist/utilities/initLexicalFeatures.js +3 -2
  367. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  368. package/dist/utilities/jsx/collectTopLevelJSXInLines.d.ts +52 -0
  369. package/dist/utilities/jsx/collectTopLevelJSXInLines.d.ts.map +1 -0
  370. package/dist/utilities/jsx/collectTopLevelJSXInLines.js +79 -0
  371. package/dist/utilities/jsx/collectTopLevelJSXInLines.js.map +1 -0
  372. package/dist/utilities/jsx/extractPropsFromJSXPropsString.d.ts +12 -0
  373. package/dist/utilities/jsx/extractPropsFromJSXPropsString.d.ts.map +1 -0
  374. package/dist/utilities/jsx/extractPropsFromJSXPropsString.js +125 -0
  375. package/dist/utilities/jsx/extractPropsFromJSXPropsString.js.map +1 -0
  376. package/dist/utilities/jsx/jsx.d.ts +26 -0
  377. package/dist/utilities/jsx/jsx.d.ts.map +1 -0
  378. package/dist/utilities/jsx/jsx.js +105 -0
  379. package/dist/utilities/jsx/jsx.js.map +1 -0
  380. package/dist/utilities/jsx/jsx.spec.d.ts +2 -0
  381. package/dist/utilities/jsx/jsx.spec.d.ts.map +1 -0
  382. package/dist/utilities/jsx/jsx.spec.js +142 -0
  383. package/dist/utilities/jsx/jsx.spec.js.map +1 -0
  384. package/dist/utilities/jsx/lexicalMarkdownCopy.d.ts +11 -0
  385. package/dist/utilities/jsx/lexicalMarkdownCopy.d.ts.map +1 -0
  386. package/dist/utilities/jsx/lexicalMarkdownCopy.js +61 -0
  387. package/dist/utilities/jsx/lexicalMarkdownCopy.js.map +1 -0
  388. package/package.json +284 -7
  389. package/dist/exports/client/Field-GWJ72IYP.js +0 -2
  390. package/dist/exports/client/Field-GWJ72IYP.js.map +0 -7
  391. package/dist/exports/client/chunk-D7PD5DUW.js +0 -2
  392. package/dist/exports/client/chunk-D7PD5DUW.js.map +0 -7
  393. package/dist/exports/client/chunk-OOBB5GCO.js +0 -2
  394. package/dist/exports/client/chunk-XDEGE6I5.js +0 -2
  395. package/dist/exports/client/chunk-XDEGE6I5.js.map +0 -7
  396. package/dist/exports/client/chunk-YGRKYSDC.js +0 -2
  397. package/dist/exports/client/chunk-YGRKYSDC.js.map +0 -7
  398. package/dist/exports/client/component-KLNTKKNE.js +0 -2
  399. package/dist/exports/client/component-KLNTKKNE.js.map +0 -7
  400. package/dist/exports/client/component-YICNYPTU.js +0 -2
  401. package/dist/exports/client/componentInline-6RPSMLNJ.js +0 -2
  402. package/dist/exports/client/componentInline-6RPSMLNJ.js.map +0 -7
  403. package/dist/features/blocks/client/component/FormSavePlugin.d.ts +0 -11
  404. package/dist/features/blocks/client/component/FormSavePlugin.d.ts.map +0 -1
  405. package/dist/features/blocks/client/component/FormSavePlugin.js +0 -53
  406. package/dist/features/blocks/client/component/FormSavePlugin.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ export * from '@lexical/react/useLexicalNodeSelection';
2
+ //# sourceMappingURL=useLexicalNodeSelection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLexicalNodeSelection.js","names":[],"sources":["../../../src/lexical-proxy/@lexical-react/useLexicalNodeSelection.ts"],"sourcesContent":["export * from '@lexical/react/useLexicalNodeSelection'\n"],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from '@lexical/react/useLexicalSubscription';
2
+ //# sourceMappingURL=useLexicalSubscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLexicalSubscription.d.ts","sourceRoot":"","sources":["../../../src/lexical-proxy/@lexical-react/useLexicalSubscription.tsx"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from '@lexical/react/useLexicalSubscription';
2
+ //# sourceMappingURL=useLexicalSubscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLexicalSubscription.js","names":[],"sources":["../../../src/lexical-proxy/@lexical-react/useLexicalSubscription.tsx"],"sourcesContent":["export * from '@lexical/react/useLexicalSubscription'\n"],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from '@lexical/react/useLexicalTextEntity';
2
+ //# sourceMappingURL=useLexicalTextEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLexicalTextEntity.d.ts","sourceRoot":"","sources":["../../../src/lexical-proxy/@lexical-react/useLexicalTextEntity.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from '@lexical/react/useLexicalTextEntity';
2
+ //# sourceMappingURL=useLexicalTextEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLexicalTextEntity.js","names":[],"sources":["../../../src/lexical-proxy/@lexical-react/useLexicalTextEntity.ts"],"sourcesContent":["export * from '@lexical/react/useLexicalTextEntity'\n"],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from '@lexical/rich-text';
2
+ //# sourceMappingURL=@lexical-rich-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"@lexical-rich-text.d.ts","sourceRoot":"","sources":["../../src/lexical-proxy/@lexical-rich-text.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from '@lexical/rich-text';
2
+ //# sourceMappingURL=@lexical-rich-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"@lexical-rich-text.js","names":[],"sources":["../../src/lexical-proxy/@lexical-rich-text.ts"],"sourcesContent":["export * from '@lexical/rich-text'\n"],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from '@lexical/selection';
2
+ //# sourceMappingURL=@lexical-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"@lexical-selection.d.ts","sourceRoot":"","sources":["../../src/lexical-proxy/@lexical-selection.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from '@lexical/selection';
2
+ //# sourceMappingURL=@lexical-selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"@lexical-selection.js","names":[],"sources":["../../src/lexical-proxy/@lexical-selection.ts"],"sourcesContent":["export * from '@lexical/selection'\n"],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from '@lexical/utils';
2
+ //# sourceMappingURL=@lexical-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"@lexical-utils.d.ts","sourceRoot":"","sources":["../../src/lexical-proxy/@lexical-utils.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from '@lexical/utils';
2
+ //# sourceMappingURL=@lexical-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"@lexical-utils.js","names":[],"sources":["../../src/lexical-proxy/@lexical-utils.ts"],"sourcesContent":["export * from '@lexical/utils'\n"],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from 'lexical';
2
+ //# sourceMappingURL=lexical.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexical.d.ts","sourceRoot":"","sources":["../../src/lexical-proxy/lexical.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from 'lexical';
2
+ //# sourceMappingURL=lexical.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexical.js","names":[],"sources":["../../src/lexical-proxy/lexical.ts"],"sourcesContent":["export * from 'lexical'\n"],"mappings":"AAAA,cAAc","ignoreList":[]}
package/dist/types.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { ClientField, DefaultCellComponentProps, RichTextAdapter, RichTextF
3
3
  import type { BaseClientFeatureProps, FeatureProviderProviderClient } from './features/typesClient.js';
4
4
  import type { FeatureProviderServer } from './features/typesServer.js';
5
5
  import type { SanitizedServerEditorConfig } from './lexical/config/types.js';
6
+ import type { InitialLexicalFormState } from './utilities/buildInitialState.js';
6
7
  export type LexicalFieldAdminProps = {
7
8
  /**
8
9
  * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false
@@ -67,6 +68,7 @@ export type LexicalRichTextFieldProps = {
67
68
  };
68
69
  };
69
70
  featureClientSchemaMap: FeatureClientSchemaMap;
71
+ initialLexicalFormState: InitialLexicalFormState;
70
72
  lexicalEditorConfig: LexicalEditorConfig;
71
73
  } & Pick<ServerFieldBase, 'permissions'> & RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>;
72
74
  export type LexicalRichTextCellProps = DefaultCellComponentProps<RichTextFieldClient<SerializedEditorState, AdapterProps, object>, SerializedEditorState>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACzF,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EACzB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EACV,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AAE5E,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,sBAAsB,CAAA;IAC9B,QAAQ,CAAC,EACL,CAAC,CAAC,EACA,eAAe,EACf,YAAY,GACb,EAAE;QACD;;;;;;;;;;WAUG;QACH,eAAe,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;QACvD;;;;;;;;;;;WAWG;QACH,YAAY,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;KACrD,KAAK,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAC7C,qBAAqB,CAAC,GAAG,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AM,CAAC,CAAA;AAEvE,MAAM,MAAM,wBAAwB,GAAG,yBAAyB,CAC9D,mBAAmB,CAAC,qBAAqB,EAAE,YAAY,EAAE,MAAM,CAAC,EAChE,qBAAqB,CACtB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,2BAA2B,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,aAAa,EAAE,6BAA6B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACtD,kBAAkB,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAA;CACnD,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'\nimport type {\n ClientField,\n DefaultCellComponentProps,\n RichTextAdapter,\n RichTextFieldClient,\n RichTextFieldClientProps,\n SanitizedConfig,\n ServerFieldBase,\n} from 'payload'\n\nimport type {\n BaseClientFeatureProps,\n FeatureProviderProviderClient,\n} from './features/typesClient.js'\nimport type { FeatureProviderServer } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n}\n\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?:\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n lexical?: LexicalEditorConfig\n}\n\nexport type LexicalRichTextAdapter = {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any, any>[]\n} & RichTextAdapter<SerializedEditorState, AdapterProps>\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n parentIsLocalized,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n }) => Promise<LexicalRichTextAdapter>\n\nexport type FeatureClientSchemaMap = {\n [featureKey: string]: {\n [key: string]: ClientField[]\n }\n}\n\nexport type LexicalRichTextFieldProps = {\n admin: LexicalFieldAdminProps\n // clientFeatures is added through the rsc field\n clientFeatures: {\n [featureKey: string]: {\n clientFeatureProps?: object\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n }\n featureClientSchemaMap: FeatureClientSchemaMap\n lexicalEditorConfig: LexicalEditorConfig\n} & Pick<ServerFieldBase, 'permissions'> &\n RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>\n\nexport type LexicalRichTextCellProps = DefaultCellComponentProps<\n RichTextFieldClient<SerializedEditorState, AdapterProps, object>,\n SerializedEditorState\n>\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n clientFeature: FeatureProviderProviderClient<any, any>\n clientFeatureProps: BaseClientFeatureProps<object>\n}\n"],"mappings":"AA8GA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'\nimport type {\n ClientField,\n DefaultCellComponentProps,\n RichTextAdapter,\n RichTextFieldClient,\n RichTextFieldClientProps,\n SanitizedConfig,\n ServerFieldBase,\n} from 'payload'\n\nimport type {\n BaseClientFeatureProps,\n FeatureProviderProviderClient,\n} from './features/typesClient.js'\nimport type { FeatureProviderServer } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\nimport type { InitialLexicalFormState } from './utilities/buildInitialState.js'\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n}\n\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?:\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n lexical?: LexicalEditorConfig\n}\n\nexport type LexicalRichTextAdapter = {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any, any>[]\n} & RichTextAdapter<SerializedEditorState, AdapterProps>\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n parentIsLocalized,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n }) => Promise<LexicalRichTextAdapter>\n\nexport type FeatureClientSchemaMap = {\n [featureKey: string]: {\n [key: string]: ClientField[]\n }\n}\n\nexport type LexicalRichTextFieldProps = {\n admin: LexicalFieldAdminProps\n // clientFeatures is added through the rsc field\n clientFeatures: {\n [featureKey: string]: {\n clientFeatureProps?: object\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n }\n featureClientSchemaMap: FeatureClientSchemaMap\n initialLexicalFormState: InitialLexicalFormState\n lexicalEditorConfig: LexicalEditorConfig\n} & Pick<ServerFieldBase, 'permissions'> &\n RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>\n\nexport type LexicalRichTextCellProps = DefaultCellComponentProps<\n RichTextFieldClient<SerializedEditorState, AdapterProps, object>,\n SerializedEditorState\n>\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n clientFeature: FeatureProviderProviderClient<any, any>\n clientFeatureProps: BaseClientFeatureProps<object>\n}\n"],"mappings":"AAgHA","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ import type { SerializedLexicalNode } from 'lexical';
2
+ import type { DocumentPreferences, FieldSchemaMap, FormState, Operation, PayloadRequest, RichTextField, SanitizedFieldPermissions } from 'payload';
3
+ export type InitialLexicalFormState = {
4
+ [nodeID: string]: {
5
+ [key: string]: any;
6
+ formState?: FormState;
7
+ };
8
+ };
9
+ type Props = {
10
+ context: {
11
+ collectionSlug: string;
12
+ field: RichTextField;
13
+ fieldSchemaMap: FieldSchemaMap;
14
+ id?: number | string;
15
+ lexicalFieldSchemaPath: string;
16
+ operation: Operation;
17
+ permissions?: SanitizedFieldPermissions;
18
+ preferences: DocumentPreferences;
19
+ renderFieldFn: any;
20
+ req: PayloadRequest;
21
+ };
22
+ initialState?: InitialLexicalFormState;
23
+ nodeData: SerializedLexicalNode[];
24
+ };
25
+ export declare function buildInitialState({ context, initialState: initialStateFromArgs, nodeData, }: Props): Promise<InitialLexicalFormState>;
26
+ export {};
27
+ //# sourceMappingURL=buildInitialState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildInitialState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildInitialState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,EACb,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAMhB,MAAM,MAAM,uBAAuB,GAAG;IACpC,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,SAAS,CAAC,EAAE,SAAS,CAAA;KACtB,CAAA;CACF,CAAA;AAED,KAAK,KAAK,GAAG;IACX,OAAO,EAAE;QACP,cAAc,EAAE,MAAM,CAAA;QACtB,KAAK,EAAE,aAAa,CAAA;QACpB,cAAc,EAAE,cAAc,CAAA;QAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACpB,sBAAsB,EAAE,MAAM,CAAA;QAC9B,SAAS,EAAE,SAAS,CAAA;QACpB,WAAW,CAAC,EAAE,yBAAyB,CAAA;QACvC,WAAW,EAAE,mBAAmB,CAAA;QAChC,aAAa,EAAE,GAAG,CAAA;QAClB,GAAG,EAAE,cAAc,CAAA;KACpB,CAAA;IACD,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;CAClC,CAAA;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,YAAY,EAAE,oBAAoB,EAClC,QAAQ,GACT,EAAE,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAwD1C"}
@@ -0,0 +1,53 @@
1
+ import { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState';
2
+ export async function buildInitialState({
3
+ context,
4
+ initialState: initialStateFromArgs,
5
+ nodeData
6
+ }) {
7
+ let initialState = initialStateFromArgs ?? {};
8
+ for (const node of nodeData) {
9
+ if ('children' in node) {
10
+ initialState = await buildInitialState({
11
+ context,
12
+ initialState,
13
+ nodeData: node.children
14
+ });
15
+ }
16
+ if (node.type === 'block' || node.type === 'inlineBlock') {
17
+ const blockNode = node;
18
+ const id = blockNode?.fields?.id;
19
+ if (!id) {
20
+ continue;
21
+ }
22
+ const schemaFieldsPath = node.type === 'block' ? `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockNode.fields.blockType}.fields` : `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockNode.fields.blockType}.fields`;
23
+ // Build form state for the block
24
+ const formStateResult = await fieldSchemasToFormState({
25
+ id: context.id,
26
+ collectionSlug: context.collectionSlug,
27
+ data: blockNode.fields,
28
+ fields: context.fieldSchemaMap.get(schemaFieldsPath)?.fields,
29
+ fieldSchemaMap: context.fieldSchemaMap,
30
+ operation: context.operation,
31
+ permissions: true,
32
+ preferences: context.preferences,
33
+ renderAllFields: true,
34
+ renderFieldFn: context.renderFieldFn,
35
+ req: context.req,
36
+ schemaPath: schemaFieldsPath
37
+ });
38
+ if (!initialState[id]) {
39
+ initialState[id] = {};
40
+ }
41
+ initialState[id].formState = formStateResult;
42
+ if (node.type === 'block') {
43
+ const currentFieldPreferences = context.preferences?.fields[context.field.name];
44
+ const collapsedArray = currentFieldPreferences?.collapsed;
45
+ if (collapsedArray && collapsedArray.includes(id)) {
46
+ initialState[id].collapsed = true;
47
+ }
48
+ }
49
+ }
50
+ }
51
+ return initialState;
52
+ }
53
+ //# sourceMappingURL=buildInitialState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildInitialState.js","names":["fieldSchemasToFormState","buildInitialState","context","initialState","initialStateFromArgs","nodeData","node","children","type","blockNode","id","fields","schemaFieldsPath","lexicalFieldSchemaPath","blockType","formStateResult","collectionSlug","data","fieldSchemaMap","get","operation","permissions","preferences","renderAllFields","renderFieldFn","req","schemaPath","formState","currentFieldPreferences","field","name","collapsedArray","collapsed","includes"],"sources":["../../src/utilities/buildInitialState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n DocumentPreferences,\n FieldSchemaMap,\n FormState,\n Operation,\n PayloadRequest,\n RichTextField,\n SanitizedFieldPermissions,\n} from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { SerializedBlockNode } from '../nodeTypes.js'\n\nexport type InitialLexicalFormState = {\n [nodeID: string]: {\n [key: string]: any\n formState?: FormState\n }\n}\n\ntype Props = {\n context: {\n collectionSlug: string\n field: RichTextField\n fieldSchemaMap: FieldSchemaMap\n id?: number | string\n lexicalFieldSchemaPath: string\n operation: Operation\n permissions?: SanitizedFieldPermissions\n preferences: DocumentPreferences\n renderFieldFn: any\n req: PayloadRequest\n }\n initialState?: InitialLexicalFormState\n nodeData: SerializedLexicalNode[]\n}\n\nexport async function buildInitialState({\n context,\n initialState: initialStateFromArgs,\n nodeData,\n}: Props): Promise<InitialLexicalFormState> {\n let initialState: InitialLexicalFormState = initialStateFromArgs ?? {}\n for (const node of nodeData) {\n if ('children' in node) {\n initialState = await buildInitialState({\n context,\n initialState,\n nodeData: node.children as SerializedLexicalNode[],\n })\n }\n\n if (node.type === 'block' || node.type === 'inlineBlock') {\n const blockNode = node as SerializedBlockNode\n const id = blockNode?.fields?.id\n if (!id) {\n continue\n }\n\n const schemaFieldsPath =\n node.type === 'block'\n ? `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockNode.fields.blockType}.fields`\n : `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockNode.fields.blockType}.fields`\n\n // Build form state for the block\n\n const formStateResult = await fieldSchemasToFormState({\n id: context.id,\n collectionSlug: context.collectionSlug,\n data: blockNode.fields,\n fields: (context.fieldSchemaMap.get(schemaFieldsPath) as any)?.fields,\n fieldSchemaMap: context.fieldSchemaMap,\n operation: context.operation as any, // TODO: Type\n permissions: true,\n preferences: context.preferences,\n renderAllFields: true, // If this function runs, the parent lexical field is being re-rendered => thus we can assume all its sub-fields need to be re-rendered\n renderFieldFn: context.renderFieldFn,\n req: context.req,\n schemaPath: schemaFieldsPath,\n })\n\n if (!initialState[id]) {\n initialState[id] = {}\n }\n\n initialState[id].formState = formStateResult\n\n if (node.type === 'block') {\n const currentFieldPreferences = context.preferences?.fields[context.field.name]\n const collapsedArray = currentFieldPreferences?.collapsed\n if (collapsedArray && collapsedArray.includes(id)) {\n initialState[id].collapsed = true\n }\n }\n }\n }\n return initialState\n}\n"],"mappings":"AAWA,SAASA,uBAAuB,QAAQ;AA4BxC,OAAO,eAAeC,kBAAkB;EACtCC,OAAO;EACPC,YAAA,EAAcC,oBAAoB;EAClCC;AAAQ,CACF;EACN,IAAIF,YAAA,GAAwCC,oBAAA,IAAwB,CAAC;EACrE,KAAK,MAAME,IAAA,IAAQD,QAAA,EAAU;IAC3B,IAAI,cAAcC,IAAA,EAAM;MACtBH,YAAA,GAAe,MAAMF,iBAAA,CAAkB;QACrCC,OAAA;QACAC,YAAA;QACAE,QAAA,EAAUC,IAAA,CAAKC;MACjB;IACF;IAEA,IAAID,IAAA,CAAKE,IAAI,KAAK,WAAWF,IAAA,CAAKE,IAAI,KAAK,eAAe;MACxD,MAAMC,SAAA,GAAYH,IAAA;MAClB,MAAMI,EAAA,GAAKD,SAAA,EAAWE,MAAA,EAAQD,EAAA;MAC9B,IAAI,CAACA,EAAA,EAAI;QACP;MACF;MAEA,MAAME,gBAAA,GACJN,IAAA,CAAKE,IAAI,KAAK,UACV,GAAGN,OAAA,CAAQW,sBAAsB,mDAAmDJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS,GACvH,GAAGZ,OAAA,CAAQW,sBAAsB,0DAA0DJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS;MAEpI;MAEA,MAAMC,eAAA,GAAkB,MAAMf,uBAAA,CAAwB;QACpDU,EAAA,EAAIR,OAAA,CAAQQ,EAAE;QACdM,cAAA,EAAgBd,OAAA,CAAQc,cAAc;QACtCC,IAAA,EAAMR,SAAA,CAAUE,MAAM;QACtBA,MAAA,EAAST,OAAA,CAAQgB,cAAc,CAACC,GAAG,CAACP,gBAAA,GAA2BD,MAAA;QAC/DO,cAAA,EAAgBhB,OAAA,CAAQgB,cAAc;QACtCE,SAAA,EAAWlB,OAAA,CAAQkB,SAAS;QAC5BC,WAAA,EAAa;QACbC,WAAA,EAAapB,OAAA,CAAQoB,WAAW;QAChCC,eAAA,EAAiB;QACjBC,aAAA,EAAetB,OAAA,CAAQsB,aAAa;QACpCC,GAAA,EAAKvB,OAAA,CAAQuB,GAAG;QAChBC,UAAA,EAAYd;MACd;MAEA,IAAI,CAACT,YAAY,CAACO,EAAA,CAAG,EAAE;QACrBP,YAAY,CAACO,EAAA,CAAG,GAAG,CAAC;MACtB;MAEAP,YAAY,CAACO,EAAA,CAAG,CAACiB,SAAS,GAAGZ,eAAA;MAE7B,IAAIT,IAAA,CAAKE,IAAI,KAAK,SAAS;QACzB,MAAMoB,uBAAA,GAA0B1B,OAAA,CAAQoB,WAAW,EAAEX,MAAM,CAACT,OAAA,CAAQ2B,KAAK,CAACC,IAAI,CAAC;QAC/E,MAAMC,cAAA,GAAiBH,uBAAA,EAAyBI,SAAA;QAChD,IAAID,cAAA,IAAkBA,cAAA,CAAeE,QAAQ,CAACvB,EAAA,GAAK;UACjDP,YAAY,CAACO,EAAA,CAAG,CAACsB,SAAS,GAAG;QAC/B;MACF;IACF;EACF;EACA,OAAO7B,YAAA;AACT","ignoreList":[]}
@@ -1,10 +1,15 @@
1
+ import type { RichTextFieldClient } from 'payload';
1
2
  import type { BaseClientFeatureProps, ClientFeature, ClientFeatureProviderMap, FeatureProviderProviderClient, ResolvedClientFeatureMap } from '../features/typesClient.js';
2
3
  import type { ClientEditorConfig } from '../lexical/config/types.js';
4
+ import type { FeatureClientSchemaMap } from '../types.js';
3
5
  export type CreateClientFeatureArgs<UnSanitizedClientProps, ClientProps> = ((props: {
6
+ featureClientSchemaMap: FeatureClientSchemaMap;
4
7
  /** unSanitizedEditorConfig.features, but mapped */
5
8
  featureProviderMap: ClientFeatureProviderMap;
9
+ field?: RichTextFieldClient;
6
10
  props: BaseClientFeatureProps<UnSanitizedClientProps>;
7
11
  resolvedFeatures: ResolvedClientFeatureMap;
12
+ schemaPath: string;
8
13
  unSanitizedEditorConfig: ClientEditorConfig;
9
14
  }) => ClientFeature<ClientProps>) | Omit<ClientFeature<ClientProps>, 'sanitizedClientFeatureProps'>;
10
15
  export declare const createClientFeature: <UnSanitizedClientProps = undefined, ClientProps = UnSanitizedClientProps>(args: CreateClientFeatureArgs<UnSanitizedClientProps, ClientProps>) => FeatureProviderProviderClient<UnSanitizedClientProps, ClientProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"createClientFeature.d.ts","sourceRoot":"","sources":["../../src/utilities/createClientFeature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EAExB,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,MAAM,MAAM,uBAAuB,CAAC,sBAAsB,EAAE,WAAW,IACnE,CAAC,CAAC,KAAK,EAAE;IACP,mDAAmD;IACnD,kBAAkB,EAAE,wBAAwB,CAAA;IAC5C,KAAK,EAAE,sBAAsB,CAAC,sBAAsB,CAAC,CAAA;IAErD,gBAAgB,EAAE,wBAAwB,CAAA;IAE1C,uBAAuB,EAAE,kBAAkB,CAAA;CAC5C,KAAK,aAAa,CAAC,WAAW,CAAC,CAAC,GACjC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,6BAA6B,CAAC,CAAA;AAEnE,eAAO,MAAM,mBAAmB,EAAE,CAChC,sBAAsB,GAAG,SAAS,EAClC,WAAW,GAAG,sBAAsB,EAEpC,IAAI,EAAE,uBAAuB,CAAC,sBAAsB,EAAE,WAAW,CAAC,KAC/D,6BAA6B,CAAC,sBAAsB,EAAE,WAAW,CAyCrE,CAAA"}
1
+ {"version":3,"file":"createClientFeature.d.ts","sourceRoot":"","sources":["../../src/utilities/createClientFeature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EAExB,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,MAAM,MAAM,uBAAuB,CAAC,sBAAsB,EAAE,WAAW,IACnE,CAAC,CAAC,KAAK,EAAE;IACP,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,mDAAmD;IACnD,kBAAkB,EAAE,wBAAwB,CAAA;IAC5C,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B,KAAK,EAAE,sBAAsB,CAAC,sBAAsB,CAAC,CAAA;IAErD,gBAAgB,EAAE,wBAAwB,CAAA;IAC1C,UAAU,EAAE,MAAM,CAAA;IAElB,uBAAuB,EAAE,kBAAkB,CAAA;CAC5C,KAAK,aAAa,CAAC,WAAW,CAAC,CAAC,GACjC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,6BAA6B,CAAC,CAAA;AAEnE,eAAO,MAAM,mBAAmB,EAAE,CAChC,sBAAsB,GAAG,SAAS,EAClC,WAAW,GAAG,sBAAsB,EAEpC,IAAI,EAAE,uBAAuB,CAAC,sBAAsB,EAAE,WAAW,CAAC,KAC/D,6BAA6B,CAAC,sBAAsB,EAAE,WAAW,CA+CrE,CAAA"}
@@ -5,14 +5,20 @@ export const createClientFeature = feature => {
5
5
  };
6
6
  if (typeof feature === 'function') {
7
7
  featureProviderClient.feature = ({
8
+ featureClientSchemaMap,
8
9
  featureProviderMap,
10
+ field,
9
11
  resolvedFeatures,
12
+ schemaPath,
10
13
  unSanitizedEditorConfig
11
14
  }) => {
12
15
  const toReturn = feature({
16
+ featureClientSchemaMap,
13
17
  featureProviderMap,
18
+ field,
14
19
  props,
15
20
  resolvedFeatures,
21
+ schemaPath,
16
22
  unSanitizedEditorConfig
17
23
  });
18
24
  if (toReturn.sanitizedClientFeatureProps === null) {
@@ -1 +1 @@
1
- {"version":3,"file":"createClientFeature.js","names":["createClientFeature","feature","featureProviderProvideClient","props","featureProviderClient","clientFeatureProps","featureProviderMap","resolvedFeatures","unSanitizedEditorConfig","toReturn","sanitizedClientFeatureProps","newFeature"],"sources":["../../src/utilities/createClientFeature.ts"],"sourcesContent":["import type {\n BaseClientFeatureProps,\n ClientFeature,\n ClientFeatureProviderMap,\n FeatureProviderClient,\n FeatureProviderProviderClient,\n ResolvedClientFeatureMap,\n} from '../features/typesClient.js'\nimport type { ClientEditorConfig } from '../lexical/config/types.js'\n\nexport type CreateClientFeatureArgs<UnSanitizedClientProps, ClientProps> =\n | ((props: {\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ClientFeatureProviderMap\n props: BaseClientFeatureProps<UnSanitizedClientProps>\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedClientFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ClientEditorConfig\n }) => ClientFeature<ClientProps>)\n | Omit<ClientFeature<ClientProps>, 'sanitizedClientFeatureProps'>\n\nexport const createClientFeature: <\n UnSanitizedClientProps = undefined,\n ClientProps = UnSanitizedClientProps,\n>(\n args: CreateClientFeatureArgs<UnSanitizedClientProps, ClientProps>,\n) => FeatureProviderProviderClient<UnSanitizedClientProps, ClientProps> = (feature) => {\n const featureProviderProvideClient: FeatureProviderProviderClient<any, any> = (props) => {\n const featureProviderClient: Partial<FeatureProviderClient<any, any>> = {\n clientFeatureProps: props,\n }\n\n if (typeof feature === 'function') {\n featureProviderClient.feature = ({\n featureProviderMap,\n resolvedFeatures,\n unSanitizedEditorConfig,\n }) => {\n const toReturn = feature({\n featureProviderMap,\n props,\n resolvedFeatures,\n unSanitizedEditorConfig,\n })\n\n if (toReturn.sanitizedClientFeatureProps === null) {\n toReturn.sanitizedClientFeatureProps = props\n }\n\n return toReturn\n }\n } else {\n // We have to spread feature here! Otherwise, if the arg of createClientFeature is not a function, and 2\n // richText editors have the same feature (even if both call it, e.g. both call UploadFeature()),\n // the second richText editor here will override sanitizedClientFeatureProps of the first feature, as both richText\n // editor features share the same reference to the feature object.\n // Example: richText editor 1 and 2 both have UploadFeature. richText editor 1 calls UploadFeature() with custom fields,\n // richText editor 2 calls UploadFeature() with NO custom fields. If we don't spread feature here, richText editor 1\n // will not have any custom fields, as richText editor 2 will override the feature object.\n const newFeature: ClientFeature<any> = { ...feature }\n newFeature.sanitizedClientFeatureProps = props\n featureProviderClient.feature = newFeature\n }\n return featureProviderClient as FeatureProviderClient<any, any>\n }\n\n return featureProviderProvideClient\n}\n"],"mappings":"AAsBA,OAAO,MAAMA,mBAAA,GAK8DC,OAAA;EACzE,MAAMC,4BAAA,GAAyEC,KAAA;IAC7E,MAAMC,qBAAA,GAAkE;MACtEC,kBAAA,EAAoBF;IACtB;IAEA,IAAI,OAAOF,OAAA,KAAY,YAAY;MACjCG,qBAAA,CAAsBH,OAAO,GAAG,CAAC;QAC/BK,kBAAkB;QAClBC,gBAAgB;QAChBC;MAAuB,CACxB;QACC,MAAMC,QAAA,GAAWR,OAAA,CAAQ;UACvBK,kBAAA;UACAH,KAAA;UACAI,gBAAA;UACAC;QACF;QAEA,IAAIC,QAAA,CAASC,2BAA2B,KAAK,MAAM;UACjDD,QAAA,CAASC,2BAA2B,GAAGP,KAAA;QACzC;QAEA,OAAOM,QAAA;MACT;IACF,OAAO;MACL;MACA;MACA;MACA;MACA;MACA;MACA;MACA,MAAME,UAAA,GAAiC;QAAE,GAAGV;MAAQ;MACpDU,UAAA,CAAWD,2BAA2B,GAAGP,KAAA;MACzCC,qBAAA,CAAsBH,OAAO,GAAGU,UAAA;IAClC;IACA,OAAOP,qBAAA;EACT;EAEA,OAAOF,4BAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"createClientFeature.js","names":["createClientFeature","feature","featureProviderProvideClient","props","featureProviderClient","clientFeatureProps","featureClientSchemaMap","featureProviderMap","field","resolvedFeatures","schemaPath","unSanitizedEditorConfig","toReturn","sanitizedClientFeatureProps","newFeature"],"sources":["../../src/utilities/createClientFeature.ts"],"sourcesContent":["import type { RichTextFieldClient } from 'payload'\n\nimport type {\n BaseClientFeatureProps,\n ClientFeature,\n ClientFeatureProviderMap,\n FeatureProviderClient,\n FeatureProviderProviderClient,\n ResolvedClientFeatureMap,\n} from '../features/typesClient.js'\nimport type { ClientEditorConfig } from '../lexical/config/types.js'\nimport type { FeatureClientSchemaMap } from '../types.js'\n\nexport type CreateClientFeatureArgs<UnSanitizedClientProps, ClientProps> =\n | ((props: {\n featureClientSchemaMap: FeatureClientSchemaMap\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ClientFeatureProviderMap\n field?: RichTextFieldClient\n props: BaseClientFeatureProps<UnSanitizedClientProps>\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedClientFeatureMap\n schemaPath: string\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ClientEditorConfig\n }) => ClientFeature<ClientProps>)\n | Omit<ClientFeature<ClientProps>, 'sanitizedClientFeatureProps'>\n\nexport const createClientFeature: <\n UnSanitizedClientProps = undefined,\n ClientProps = UnSanitizedClientProps,\n>(\n args: CreateClientFeatureArgs<UnSanitizedClientProps, ClientProps>,\n) => FeatureProviderProviderClient<UnSanitizedClientProps, ClientProps> = (feature) => {\n const featureProviderProvideClient: FeatureProviderProviderClient<any, any> = (props) => {\n const featureProviderClient: Partial<FeatureProviderClient<any, any>> = {\n clientFeatureProps: props,\n }\n\n if (typeof feature === 'function') {\n featureProviderClient.feature = ({\n featureClientSchemaMap,\n featureProviderMap,\n field,\n resolvedFeatures,\n schemaPath,\n unSanitizedEditorConfig,\n }) => {\n const toReturn = feature({\n featureClientSchemaMap,\n featureProviderMap,\n field,\n props,\n resolvedFeatures,\n schemaPath,\n unSanitizedEditorConfig,\n })\n\n if (toReturn.sanitizedClientFeatureProps === null) {\n toReturn.sanitizedClientFeatureProps = props\n }\n\n return toReturn\n }\n } else {\n // We have to spread feature here! Otherwise, if the arg of createClientFeature is not a function, and 2\n // richText editors have the same feature (even if both call it, e.g. both call UploadFeature()),\n // the second richText editor here will override sanitizedClientFeatureProps of the first feature, as both richText\n // editor features share the same reference to the feature object.\n // Example: richText editor 1 and 2 both have UploadFeature. richText editor 1 calls UploadFeature() with custom fields,\n // richText editor 2 calls UploadFeature() with NO custom fields. If we don't spread feature here, richText editor 1\n // will not have any custom fields, as richText editor 2 will override the feature object.\n const newFeature: ClientFeature<any> = { ...feature }\n newFeature.sanitizedClientFeatureProps = props\n featureProviderClient.feature = newFeature\n }\n return featureProviderClient as FeatureProviderClient<any, any>\n }\n\n return featureProviderProvideClient\n}\n"],"mappings":"AA4BA,OAAO,MAAMA,mBAAA,GAK8DC,OAAA;EACzE,MAAMC,4BAAA,GAAyEC,KAAA;IAC7E,MAAMC,qBAAA,GAAkE;MACtEC,kBAAA,EAAoBF;IACtB;IAEA,IAAI,OAAOF,OAAA,KAAY,YAAY;MACjCG,qBAAA,CAAsBH,OAAO,GAAG,CAAC;QAC/BK,sBAAsB;QACtBC,kBAAkB;QAClBC,KAAK;QACLC,gBAAgB;QAChBC,UAAU;QACVC;MAAuB,CACxB;QACC,MAAMC,QAAA,GAAWX,OAAA,CAAQ;UACvBK,sBAAA;UACAC,kBAAA;UACAC,KAAA;UACAL,KAAA;UACAM,gBAAA;UACAC,UAAA;UACAC;QACF;QAEA,IAAIC,QAAA,CAASC,2BAA2B,KAAK,MAAM;UACjDD,QAAA,CAASC,2BAA2B,GAAGV,KAAA;QACzC;QAEA,OAAOS,QAAA;MACT;IACF,OAAO;MACL;MACA;MACA;MACA;MACA;MACA;MACA;MACA,MAAME,UAAA,GAAiC;QAAE,GAAGb;MAAQ;MACpDa,UAAA,CAAWD,2BAA2B,GAAGV,KAAA;MACzCC,qBAAA,CAAsBH,OAAO,GAAGa,UAAA;IAClC;IACA,OAAOV,qBAAA;EACT;EAEA,OAAOF,4BAAA;AACT","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerContent.d.ts","sourceRoot":"","sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAGvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAIpD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,aAAa,CAAC,CAqIzF,CAAA"}
1
+ {"version":3,"file":"DrawerContent.d.ts","sourceRoot":"","sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAGvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAIpD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,aAAa,CAAC,CAwHzF,CAAA"}
@@ -21,7 +21,6 @@ export const DrawerContent = ({
21
21
  const {
22
22
  id,
23
23
  collectionSlug,
24
- docPermissions,
25
24
  getDocPreferences,
26
25
  globalSlug
27
26
  } = useDocumentInfo();
@@ -48,7 +47,9 @@ export const DrawerContent = ({
48
47
  id,
49
48
  collectionSlug,
50
49
  data: data ?? {},
51
- docPermissions,
50
+ docPermissions: {
51
+ fields: true
52
+ },
52
53
  docPreferences: await getDocPreferences(),
53
54
  globalSlug,
54
55
  operation: 'update',
@@ -62,7 +63,7 @@ export const DrawerContent = ({
62
63
  return () => {
63
64
  abortAndIgnore(controller);
64
65
  };
65
- }, [schemaFieldsPath, id, data, getFormState, collectionSlug, globalSlug, docPermissions, getDocPreferences]);
66
+ }, [schemaFieldsPath, id, data, getFormState, collectionSlug, globalSlug, getDocPreferences]);
66
67
  const onChange = useCallback(async ({
67
68
  formState: prevFormState
68
69
  }) => {
@@ -74,7 +75,9 @@ export const DrawerContent = ({
74
75
  } = await getFormState({
75
76
  id,
76
77
  collectionSlug,
77
- docPermissions,
78
+ docPermissions: {
79
+ fields: true
80
+ },
78
81
  docPreferences: await getDocPreferences(),
79
82
  formState: prevFormState,
80
83
  globalSlug,
@@ -86,7 +89,7 @@ export const DrawerContent = ({
86
89
  return prevFormState;
87
90
  }
88
91
  return state_0;
89
- }, [getFormState, id, collectionSlug, docPermissions, getDocPreferences, globalSlug, schemaFieldsPath]);
92
+ }, [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath]);
90
93
  // cleanup effect
91
94
  useEffect(() => {
92
95
  return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerContent.js","names":["Form","FormSubmit","RenderFields","useDocumentInfo","useServerFunctions","useTranslation","abortAndIgnore","React","useCallback","useEffect","useRef","useState","v4","uuid","useEditorConfigContext","DrawerContent","data","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","t","id","collectionSlug","docPermissions","getDocPreferences","globalSlug","onChangeAbortControllerRef","AbortController","initialState","setInitialState","fieldProps","featureClientSchemaMap","permissions","getFormState","schemaFieldsPath","fields","controller","awaitInitialState","state","docPreferences","operation","renderAllFields","signal","onChange","formState","prevFormState","current","_jsxs","beforeSubmit","disableValidationOnSubmit","Array","isArray","onSubmit","_jsx","forceRender","parentIndexPath","parentPath","parentSchemaPath","readOnly"],"sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id, collectionSlug, docPermissions, getDocPreferences, globalSlug } = useDocumentInfo()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap, permissions },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions,\n docPreferences: await getDocPreferences(),\n globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [\n schemaFieldsPath,\n id,\n data,\n getFormState,\n collectionSlug,\n globalSlug,\n docPermissions,\n getDocPreferences,\n ])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions,\n docPreferences: await getDocPreferences(),\n formState: prevFormState,\n globalSlug,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n docPermissions,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={permissions}\n readOnly={false}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SACEA,IAAI,EACJC,UAAU,EACVC,YAAY,EACZC,eAAe,EACfC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAChE,SAASC,EAAA,IAAMC,IAAI,QAAQ;AAI3B,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,aAAA,GAAiFA,CAAC;EAC7FC,IAAI;EACJC,UAAU;EACVC,gBAAgB;EAChBC,kBAAkB;EAClBC,wBAAwB;EACxBC,UAAU;EACVC;AAAgB,CACjB;EACC,MAAM;IAAEC;EAAC,CAAE,GAAGlB,cAAA;EACd,MAAM;IAAEmB,EAAE;IAAEC,cAAc;IAAEC,cAAc;IAAEC,iBAAiB;IAAEC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,EAAU;qBAEZL,IAAA,CAACvD,UAAA;gBAAYsB,CAAA,CAAE;;;AAGrB","ignoreList":[]}
1
+ {"version":3,"file":"DrawerContent.js","names":["Form","FormSubmit","RenderFields","useDocumentInfo","useServerFunctions","useTranslation","abortAndIgnore","React","useCallback","useEffect","useRef","useState","v4","uuid","useEditorConfigContext","DrawerContent","data","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","t","id","collectionSlug","getDocPreferences","globalSlug","onChangeAbortControllerRef","AbortController","initialState","setInitialState","fieldProps","featureClientSchemaMap","permissions","getFormState","schemaFieldsPath","fields","controller","awaitInitialState","state","docPermissions","docPreferences","operation","renderAllFields","signal","onChange","formState","prevFormState","current","_jsxs","beforeSubmit","disableValidationOnSubmit","Array","isArray","onSubmit","_jsx","forceRender","parentIndexPath","parentPath","parentSchemaPath","readOnly"],"sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap, permissions },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [schemaFieldsPath, id, data, getFormState, collectionSlug, globalSlug, getDocPreferences])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n formState: prevFormState,\n globalSlug,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath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EAGrF;EACA3B,SAAA,CAAU;IACR,OAAO;MACLH,cAAA,CAAesB,0BAAA,CAA2BqB,OAAO;IACnD;EACF,GAAG,EAAE;EAEL,IAAInB,YAAA,KAAiB,OAAO;IAC1B,OAAO;EACT;EAEA,oBACEoB,KAAA,CAAClD,IAAA;IACCmD,YAAA,EAAc,CAACL,QAAA,CAAS;IACxBM,yBAAyB;IACzBf,MAAA,EAAQgB,KAAA,CAAMC,OAAO,CAACjB,MAAA,IAAUA,MAAA,GAAS,EAAE;IAC3CP,YAAA,EAAcA,YAAA;IACdgB,QAAA,EAAU,CAACA,QAAA,CAAS;IACpBS,QAAA,EAAUpC,kBAAA;IACVN,IAAA,EAAMA,IAAA;4BAEN2C,IAAA,CAACtD,YAAA;MACCmC,MAAA,EAAQgB,KAAA,CAAMC,OAAO,CAACjB,MAAA,IAAUA,MAAA,GAAS,EAAE;MAC3CoB,WAAW;MACXC,eAAA,EAAgB;MAChBC,UAAA,EAAW,GAAG;MAAA;;MACdC,gBAAA,EAAkBxB,gBAAA;MAClBF,WAAA,EAAaA,WAAA;MACb2B,QAAA,EAAU;qBAEZL,IAAA,CAACvD,UAAA;gBAAYsB,CAAA,CAAE;;;AAGrB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useLexicalDrawer.d.ts","sourceRoot":"","sources":["../../../src/utilities/fieldsDrawer/useLexicalDrawer.tsx"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,SAAU,MAAM,gBAAgB,OAAO;;;CAwEnE,CAAA"}
1
+ {"version":3,"file":"useLexicalDrawer.d.ts","sourceRoot":"","sources":["../../../src/utilities/fieldsDrawer/useLexicalDrawer.tsx"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,SAAU,MAAM,gBAAgB,OAAO;;;CAoEnE,CAAA"}
@@ -17,7 +17,6 @@ export const useLexicalDrawer = (slug, restoreLate) => {
17
17
  const [wasOpen, setWasOpen] = useState(false);
18
18
  const {
19
19
  closeModal: closeBaseModal,
20
- isModalOpen: isBaseModalOpen,
21
20
  modalState,
22
21
  toggleModal: toggleBaseModal
23
22
  } = useModal();
@@ -66,10 +65,11 @@ export const useLexicalDrawer = (slug, restoreLate) => {
66
65
  t2 = $[7];
67
66
  }
68
67
  const closeDrawer = t2;
68
+ const isModalOpen = modalState?.[slug]?.isOpen;
69
69
  let t3;
70
- if ($[8] !== isBaseModalOpen || $[9] !== slug || $[10] !== storeSelection || $[11] !== restoreSelection || $[12] !== toggleBaseModal) {
70
+ if ($[8] !== isModalOpen || $[9] !== storeSelection || $[10] !== restoreSelection || $[11] !== toggleBaseModal || $[12] !== slug) {
71
71
  t3 = () => {
72
- if (!isBaseModalOpen(slug)) {
72
+ if (!isModalOpen) {
73
73
  storeSelection();
74
74
  } else {
75
75
  restoreSelection();
@@ -77,11 +77,11 @@ export const useLexicalDrawer = (slug, restoreLate) => {
77
77
  setWasOpen(true);
78
78
  toggleBaseModal(slug);
79
79
  };
80
- $[8] = isBaseModalOpen;
81
- $[9] = slug;
82
- $[10] = storeSelection;
83
- $[11] = restoreSelection;
84
- $[12] = toggleBaseModal;
80
+ $[8] = isModalOpen;
81
+ $[9] = storeSelection;
82
+ $[10] = restoreSelection;
83
+ $[11] = toggleBaseModal;
84
+ $[12] = slug;
85
85
  $[13] = t3;
86
86
  } else {
87
87
  t3 = $[13];
@@ -1 +1 @@
1
- {"version":3,"file":"useLexicalDrawer.js","names":["c","_c","useLexicalComposerContext","useModal","$getPreviousSelection","$getSelection","$setSelection","useCallback","useEffect","useState","useLexicalDrawer","slug","restoreLate","$","editor","selectionState","setSelectionState","wasOpen","setWasOpen","closeModal","closeBaseModal","isModalOpen","isBaseModalOpen","modalState","toggleModal","toggleBaseModal","t0","read","selection","storeSelection","t1","update","clone","discrete","skipTransforms","restoreSelection","t2","closeDrawer","t3","toggleDrawer","t4","t5","thisModalState","isOpen","setTimeout","t6"],"sources":["../../../src/utilities/fieldsDrawer/useLexicalDrawer.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useModal that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalDrawer = (slug: string, restoreLate?: boolean) => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const {\n closeModal: closeBaseModal,\n isModalOpen: isBaseModalOpen,\n modalState,\n toggleModal: toggleBaseModal,\n } = useModal()\n\n const storeSelection = useCallback(() => {\n editor.read(() => {\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n })\n }, [editor])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeDrawer = () => {\n //restoreSelection() // Should already be stored by the useEffect below\n closeBaseModal(slug)\n }\n\n const toggleDrawer = () => {\n if (!isBaseModalOpen(slug)) {\n storeSelection()\n } else {\n restoreSelection()\n }\n setWasOpen(true)\n toggleBaseModal(slug)\n }\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[slug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n\n if (restoreLate) {\n // restoreLate is used for upload extra field drawers. For some reason, the selection is not restored if we call restoreSelection immediately.\n setTimeout(() => {\n restoreSelection()\n }, 0)\n }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AA;IAIUK,EAAA,GAAAA,CAAA;MAAA,KACHvB,OAAA;QAAA;MAAA;MAIL,MAAAyB,cAAA,GAAuBnB,UAAU,CAACZ,IAAA;MAAK,IAEnC+B,cAAA,KAAmBA,cAAA,EAAAC,MAAgB;QACrCzB,UAAA,MAAW;QAAA,IAEPN,WAAA;UAEFgC,UAAA;YACET,gBAAA;UAAA,IACC;QAAA;UAEHA,gBAAA;QAAA;MAAA;IAAA;IAGHM,EAAA,IAAClB,UAAA,EAAYZ,IAAA,EAAMwB,gBAAA,EAAkBlB,OAAA,EAASL,WAAA;IAAYC,CAAA,OAAAI,OAAA;IAAAJ,CAAA,OAAAU,UAAA;IAAAV,CAAA,OAAAF,IAAA;IAAAE,CAAA,OAAAD,WAAA;IAAAC,CAAA,OAAAsB,gBAAA;IAAAtB,CAAA,OAAA2B,EAAA;IAAA3B,CAAA,OAAA4B,EAAA;EAAA;IAAAD,EAAA,GAAA3B,CAAA;IAAA4B,EAAA,GAAA5B,CAAA;EAAA;EAnB7DL,SAAA,CAAUgC,EAmBV,EAAGC,EAA0D;EAAA,IAAAI,EAAA;EAAA,IAAAhC,CAAA,SAAAwB,WAAA,IAAAxB,CAAA,SAAA0B,YAAA;IAEtDM,EAAA;MAAAR,WAAA;MAAAE;IAAA;IAGP1B,CAAA,OAAAwB,WAAA;IAAAxB,CAAA,OAAA0B,YAAA;IAAA1B,CAAA,OAAAgC,EAAA;EAAA;IAAAA,EAAA,GAAAhC,CAAA;EAAA;EAAA,OAHOgC,EAGP;AAAA,CACF","ignoreList":[]}
1
+ {"version":3,"file":"useLexicalDrawer.js","names":["c","_c","useLexicalComposerContext","useModal","$getPreviousSelection","$getSelection","$setSelection","useCallback","useEffect","useState","useLexicalDrawer","slug","restoreLate","$","editor","selectionState","setSelectionState","wasOpen","setWasOpen","closeModal","closeBaseModal","modalState","toggleModal","toggleBaseModal","t0","read","selection","storeSelection","t1","update","clone","discrete","skipTransforms","restoreSelection","t2","closeDrawer","isModalOpen","isOpen","t3","toggleDrawer","t4","t5","thisModalState","setTimeout","t6"],"sources":["../../../src/utilities/fieldsDrawer/useLexicalDrawer.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useModal that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalDrawer = (slug: string, restoreLate?: boolean) => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const { closeModal: closeBaseModal, modalState, toggleModal: toggleBaseModal } = useModal()\n\n const storeSelection = useCallback(() => {\n editor.read(() => {\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n })\n }, [editor])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeDrawer = useCallback(() => {\n //restoreSelection() // Should already be stored by the useEffect below\n closeBaseModal(slug)\n }, [closeBaseModal, slug])\n const isModalOpen = modalState?.[slug]?.isOpen\n\n const toggleDrawer = useCallback(() => {\n if (!isModalOpen) {\n storeSelection()\n } else {\n restoreSelection()\n }\n setWasOpen(true)\n toggleBaseModal(slug)\n }, [slug, storeSelection, toggleBaseModal, restoreSelection, isModalOpen])\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[slug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n\n if (restoreLate) {\n // restoreLate is used for upload extra field drawers. For some reason, the selection is not restored if we call restoreSelection immediately.\n setTimeout(() => {\n restoreSelection()\n }, 0)\n } else {\n restoreSelection()\n }\n }\n }, [modalState, slug, restoreSelection, wasOpen, restoreLate])\n\n return {\n closeDrawer,\n toggleDrawer,\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,QAAQ,QAAQ;AACzB,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,aAAa,QAAQ;AACpE,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAEjD;;;;;AAKA,OAAO,MAAMC,gBAAA,GAAmBA,CAAAC,IAAA,EAAAC,WAAA;EAAA,MAAAC,CAAA,GAAAZ,EAAA;EAC9B,OAAAa,MAAA,IAAiBZ,yBAAA;EACjB,OAAAa,cAAA,EAAAC,iBAAA,IAA4CP,QAAA,KAA+B;EAC3E,OAAAQ,OAAA,EAAAC,UAAA,IAA8BT,QAAA,MAAkB;EAEhD;IAAAU,UAAA,EAAAC,cAAA;IAAAC,UAAA;IAAAC,WAAA,EAAAC;EAAA,IAAiFpB,QAAA;EAAA,IAAAqB,EAAA;EAAA,IAAAX,CAAA,QAAAC,MAAA;IAE9CU,EAAA,GAAAA,CAAA;MACjCV,MAAA,CAAAW,IAAA;QACE,MAAAC,SAAA,GAAkBrB,aAAA,MAAmBD,qBAAA;QACrCY,iBAAA,CAAkBU,SAAA;MAAA,CACpB;IAAA;IACFb,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAAW,EAAA;EAAA;IAAAA,EAAA,GAAAX,CAAA;EAAA;EALA,MAAAc,cAAA,GAAuBH,EAKZ;EAAA,IAAAI,EAAA;EAAA,IAAAf,CAAA,QAAAE,cAAA,IAAAF,CAAA,QAAAC,MAAA;IAE0Bc,EAAA,GAAAA,CAAA;MAAA,IAC/B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,GAAG;IAC/C,cAAc,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAA;IAC3D,sBAAsB,EAAE,sBAAsB,CAAA;CAC/C,CA4HA"}
@@ -1,5 +1,5 @@
1
- import { getFromImportMap } from '@payloadcms/ui/elements/RenderServerComponent';
2
1
  import { createClientFields, deepCopyObjectSimple } from 'payload';
2
+ import { getFromImportMap } from 'payload/shared';
3
3
  export function initLexicalFeatures(args) {
4
4
  const clientFeatures = {};
5
5
  const fieldSchemaMap = Object.fromEntries(new Map(args.fieldSchemaMap));
@@ -59,7 +59,8 @@ export function initLexicalFeatures(args) {
59
59
  defaultIDType: args.payload.config.db.defaultIDType,
60
60
  disableAddingID: true,
61
61
  fields: 'fields' in state ? state.fields : [state],
62
- i18n: args.i18n
62
+ i18n: args.i18n,
63
+ importMap: args.payload.importMap
63
64
  });
64
65
  featureClientSchemaMap[featureKey][key] = clientFields;
65
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"initLexicalFeatures.js","names":["getFromImportMap","createClientFields","deepCopyObjectSimple","initLexicalFeatures","args","clientFeatures","fieldSchemaMap","Object","fromEntries","Map","resolvedFeatureMapArray","Array","from","sanitizedEditorConfig","resolvedFeatureMap","entries","sort","a","b","order","featureClientSchemaMap","featureKey","resolvedFeature","ClientFeaturePayloadComponent","ClientFeature","clientFeatureProvider","importMap","payload","PayloadComponent","schemaPath","silent","clientFeatureProps","key","clientProps","generateSchemaMap","featureSchemaPath","split","join","featurePath","path","featureSchemaMap","state","startsWith","clientFields","fields","defaultIDType","config","db","disableAddingID","i18n"],"sources":["../../src/utilities/initLexicalFeatures.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport { getFromImportMap } from '@payloadcms/ui/elements/RenderServerComponent'\nimport {\n type ClientField,\n createClientFields,\n deepCopyObjectSimple,\n type FieldSchemaMap,\n type Payload,\n} from 'payload'\n\nimport type { FeatureProviderProviderClient } from '../features/typesClient.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { FeatureClientSchemaMap, LexicalRichTextFieldProps } from '../types.js'\ntype Args = {\n fieldSchemaMap: FieldSchemaMap\n i18n: I18nClient\n path: string\n payload: Payload\n sanitizedEditorConfig: SanitizedServerEditorConfig\n schemaPath: string\n}\n\nexport function initLexicalFeatures(args: Args): {\n clientFeatures: LexicalRichTextFieldProps['clientFeatures']\n featureClientSchemaMap: FeatureClientSchemaMap\n} {\n const clientFeatures: LexicalRichTextFieldProps['clientFeatures'] = {}\n\n const fieldSchemaMap = Object.fromEntries(new Map(args.fieldSchemaMap))\n //&const value = deepCopyObjectSimple(args.fieldState.value)\n\n // turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:\n const resolvedFeatureMapArray = Array.from(\n args.sanitizedEditorConfig.resolvedFeatureMap.entries(),\n ).sort((a, b) => a[1].order - b[1].order)\n\n const featureClientSchemaMap: FeatureClientSchemaMap = {}\n\n for (const [featureKey, resolvedFeature] of resolvedFeatureMapArray) {\n clientFeatures[featureKey] = {}\n\n /**\n * Handle client features\n */\n const ClientFeaturePayloadComponent = resolvedFeature.ClientFeature\n\n if (ClientFeaturePayloadComponent) {\n const clientFeatureProvider = getFromImportMap<FeatureProviderProviderClient>({\n importMap: args.payload.importMap,\n PayloadComponent: ClientFeaturePayloadComponent,\n schemaPath: 'lexical-clientComponent',\n silent: true,\n })\n\n if (!clientFeatureProvider) {\n continue\n }\n\n const clientFeatureProps = resolvedFeature.clientFeatureProps ?? {}\n clientFeatureProps.featureKey = resolvedFeature.key\n clientFeatureProps.order = resolvedFeature.order\n if (\n typeof ClientFeaturePayloadComponent === 'object' &&\n ClientFeaturePayloadComponent.clientProps\n ) {\n clientFeatureProps.clientProps = ClientFeaturePayloadComponent.clientProps\n }\n\n // As clientFeatureProvider is a client function, we cannot execute it on the server here. Thus, the client will have to execute clientFeatureProvider with its props\n clientFeatures[featureKey] = { clientFeatureProps, clientFeatureProvider }\n }\n\n /**\n * Handle sub-fields (formstate of those)ttt\n */\n // The args.fieldSchemaMap generated before in buildFormState should contain all of lexical features' sub-field schemas\n // as well, as it already called feature.generateSchemaMap for each feature.\n // We will check for the existance resolvedFeature.generateSchemaMap to skip unnecessary loops for constructing featureSchemaMap, but we don't run it here\n if (resolvedFeature.generateSchemaMap) {\n const featureSchemaPath = [\n ...args.schemaPath.split('.'),\n 'lexical_internal_feature',\n featureKey,\n ].join('.')\n\n const featurePath = [...args.path.split('.'), 'lexical_internal_feature', featureKey].join(\n '.',\n )\n\n // Like args.fieldSchemaMap, we only want to include the sub-fields of the current feature\n const featureSchemaMap: typeof fieldSchemaMap = {}\n for (const key in fieldSchemaMap) {\n const state = fieldSchemaMap[key]\n\n if (key.startsWith(featureSchemaPath)) {\n featureSchemaMap[key] = state\n }\n }\n\n featureClientSchemaMap[featureKey] = {}\n\n for (const key in featureSchemaMap) {\n const state = featureSchemaMap[key]\n\n const clientFields = createClientFields({\n clientFields: ('fields' in state\n ? deepCopyObjectSimple(state.fields)\n : [deepCopyObjectSimple(state)]) as ClientField[],\n defaultIDType: args.payload.config.db.defaultIDType,\n disableAddingID: true,\n fields: 'fields' in state ? state.fields : [state],\n i18n: args.i18n,\n })\n featureClientSchemaMap[featureKey][key] = clientFields\n }\n\n /*\n This is for providing an initial form state. Right now we only want to provide the clientfields though\n const schemaMap: {\n [key: string]: FieldState\n } = {}\n\n const lexicalDeepIterate = (editorState) => {\n console.log('STATE', editorState)\n\n if (\n editorState &&\n typeof editorState === 'object' &&\n 'children' in editorState &&\n Array.isArray(editorState.children)\n ) {\n for (const childKey in editorState.children) {\n const childState = editorState.children[childKey]\n\n if (childState && typeof childState === 'object') {\n lexicalDeepIterate(childState)\n }\n }\n }\n }\n\n lexicalDeepIterate(value.root)*/\n }\n }\n return {\n clientFeatures,\n featureClientSchemaMap,\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ;AACjC,SAEEC,kBAAkB,EAClBC,oBAAoB,QAGf;AAcP,OAAO,SAASC,oBA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ACAe;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"initLexicalFeatures.js","names":["createClientFields","deepCopyObjectSimple","getFromImportMap","initLexicalFeatures","args","clientFeatures","fieldSchemaMap","Object","fromEntries","Map","resolvedFeatureMapArray","Array","from","sanitizedEditorConfig","resolvedFeatureMap","entries","sort","a","b","order","featureClientSchemaMap","featureKey","resolvedFeature","ClientFeaturePayloadComponent","ClientFeature","clientFeatureProvider","importMap","payload","PayloadComponent","schemaPath","silent","clientFeatureProps","key","clientProps","generateSchemaMap","featureSchemaPath","split","join","featurePath","path","featureSchemaMap","state","startsWith","clientFields","fields","defaultIDType","config","db","disableAddingID","i18n"],"sources":["../../src/utilities/initLexicalFeatures.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport {\n type ClientField,\n createClientFields,\n deepCopyObjectSimple,\n type FieldSchemaMap,\n type Payload,\n} from 'payload'\nimport { getFromImportMap } from 'payload/shared'\n\nimport type { FeatureProviderProviderClient } from '../features/typesClient.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { FeatureClientSchemaMap, LexicalRichTextFieldProps } from '../types.js'\ntype Args = {\n fieldSchemaMap: FieldSchemaMap\n i18n: I18nClient\n path: string\n payload: Payload\n sanitizedEditorConfig: SanitizedServerEditorConfig\n schemaPath: string\n}\n\nexport function initLexicalFeatures(args: Args): {\n clientFeatures: LexicalRichTextFieldProps['clientFeatures']\n featureClientSchemaMap: FeatureClientSchemaMap\n} {\n const clientFeatures: LexicalRichTextFieldProps['clientFeatures'] = {}\n\n const fieldSchemaMap = Object.fromEntries(new Map(args.fieldSchemaMap))\n //&const value = deepCopyObjectSimple(args.fieldState.value)\n\n // turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:\n const resolvedFeatureMapArray = Array.from(\n args.sanitizedEditorConfig.resolvedFeatureMap.entries(),\n ).sort((a, b) => a[1].order - b[1].order)\n\n const featureClientSchemaMap: FeatureClientSchemaMap = {}\n\n for (const [featureKey, resolvedFeature] of resolvedFeatureMapArray) {\n clientFeatures[featureKey] = {}\n\n /**\n * Handle client features\n */\n const ClientFeaturePayloadComponent = resolvedFeature.ClientFeature\n\n if (ClientFeaturePayloadComponent) {\n const clientFeatureProvider = getFromImportMap<FeatureProviderProviderClient>({\n importMap: args.payload.importMap,\n PayloadComponent: ClientFeaturePayloadComponent,\n schemaPath: 'lexical-clientComponent',\n silent: true,\n })\n\n if (!clientFeatureProvider) {\n continue\n }\n\n const clientFeatureProps = resolvedFeature.clientFeatureProps ?? {}\n clientFeatureProps.featureKey = resolvedFeature.key\n clientFeatureProps.order = resolvedFeature.order\n if (\n typeof ClientFeaturePayloadComponent === 'object' &&\n ClientFeaturePayloadComponent.clientProps\n ) {\n clientFeatureProps.clientProps = ClientFeaturePayloadComponent.clientProps\n }\n\n // As clientFeatureProvider is a client function, we cannot execute it on the server here. Thus, the client will have to execute clientFeatureProvider with its props\n clientFeatures[featureKey] = { clientFeatureProps, clientFeatureProvider }\n }\n\n /**\n * Handle sub-fields (formstate of those)ttt\n */\n // The args.fieldSchemaMap generated before in buildFormState should contain all of lexical features' sub-field schemas\n // as well, as it already called feature.generateSchemaMap for each feature.\n // We will check for the existance resolvedFeature.generateSchemaMap to skip unnecessary loops for constructing featureSchemaMap, but we don't run it here\n if (resolvedFeature.generateSchemaMap) {\n const featureSchemaPath = [\n ...args.schemaPath.split('.'),\n 'lexical_internal_feature',\n featureKey,\n ].join('.')\n\n const featurePath = [...args.path.split('.'), 'lexical_internal_feature', featureKey].join(\n '.',\n )\n\n // Like args.fieldSchemaMap, we only want to include the sub-fields of the current feature\n const featureSchemaMap: typeof fieldSchemaMap = {}\n for (const key in fieldSchemaMap) {\n const state = fieldSchemaMap[key]\n\n if (key.startsWith(featureSchemaPath)) {\n featureSchemaMap[key] = state\n }\n }\n\n featureClientSchemaMap[featureKey] = {}\n\n for (const key in featureSchemaMap) {\n const state = featureSchemaMap[key]\n\n const clientFields = createClientFields({\n clientFields: ('fields' in state\n ? deepCopyObjectSimple(state.fields)\n : [deepCopyObjectSimple(state)]) as ClientField[],\n defaultIDType: args.payload.config.db.defaultIDType,\n disableAddingID: true,\n fields: 'fields' in state ? state.fields : [state],\n i18n: args.i18n,\n importMap: args.payload.importMap,\n })\n featureClientSchemaMap[featureKey][key] = clientFields\n }\n\n /*\n This is for providing an initial form state. Right now we only want to provide the clientfields though\n const schemaMap: {\n [key: string]: FieldState\n } = {}\n\n const lexicalDeepIterate = (editorState) => {\n console.log('STATE', editorState)\n\n if (\n editorState &&\n typeof editorState === 'object' &&\n 'children' in editorState &&\n Array.isArray(editorState.children)\n ) {\n for (const childKey in editorState.children) {\n const childState = editorState.children[childKey]\n\n if (childState && typeof childState === 'object') {\n lexicalDeepIterate(childState)\n }\n }\n }\n }\n\n lexicalDeepIterate(value.root)*/\n }\n }\n return {\n clientFeatures,\n featureClientSchemaMap,\n }\n}\n"],"mappings":"AAEA,SAEEA,kBAAkB,EAClBC,oBAAoB,QAGf;AACP,SAASC,gBAAgB,QAAQ;AAcjC,OAAO,SAASC,oBAAoBC,IAAU;EAI5C,MAAMC,cAAA,GAA8D,CAAC;EAErE,MAAMC,cAAA,GAAiBC,MAAA,CAAOC,WAAW,CAAC,IAAIC,GAAA,CAAIL,IAAA,CAAKE,cAAc;EACrE;EAEA;EACA,MAAMI,uBAAA,GAA0BC,KAAA,CAAMC,IAAI,CACxCR,IAAA,CAAKS,qBAAqB,CAACC,kBAAkB,CAACC,OAAO,IACrDC,IAAI,CAAC,CAACC,CAAA,EAAGC,CAAA,KAAMD,CAAC,CAAC,EAAE,CAACE,KAAK,GAAGD,CAAC,CAAC,EAAE,CAACC,KAAK;EAExC,MAAMC,sBAAA,GAAiD,CAAC;EAExD,KAAK,MAAM,CAACC,UAAA,EAAYC,eAAA,CAAgB,IAAIZ,uBAAA,EAAyB;IACnEL,cAAc,CAACgB,UAAA,CAAW,GAAG,CAAC;IAE9B;;;IAGA,MAAME,6BAAA,GAAgC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