@payloadcms/richtext-lexical 4.0.0-internal.1f9ae9a → 4.0.0-internal.293e026

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 (338) hide show
  1. package/dist/@types/assets.d.js +2 -0
  2. package/dist/@types/assets.d.js.map +1 -0
  3. package/dist/cell/rscEntry.d.ts.map +1 -1
  4. package/dist/cell/rscEntry.js +5 -5
  5. package/dist/cell/rscEntry.js.map +1 -1
  6. package/dist/exports/client/Field-VYBSMSRY.js +2 -0
  7. package/dist/exports/client/Field-VYBSMSRY.js.map +7 -0
  8. package/dist/exports/client/{RelationshipComponent-RZL743CS.js → RelationshipComponent-YCPAKOL7.js} +1 -1
  9. package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
  10. package/dist/exports/client/bundled.css +1 -1
  11. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  12. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  13. package/dist/exports/client/chunk-ESITTE3C.js +2 -0
  14. package/dist/exports/client/chunk-ESITTE3C.js.map +7 -0
  15. package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
  16. package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
  17. package/dist/exports/client/{component-CVM4OESA.js → component-PHZQBOJE.js} +2 -2
  18. package/dist/exports/client/component-PHZQBOJE.js.map +7 -0
  19. package/dist/exports/client/componentInline-H24N7GUG.js +2 -0
  20. package/dist/exports/client/index.d.ts +1 -0
  21. package/dist/exports/client/index.d.ts.map +1 -1
  22. package/dist/exports/client/index.js +25 -25
  23. package/dist/exports/client/index.js.map +4 -4
  24. package/dist/exports/server/rsc.browser.d.ts +11 -0
  25. package/dist/exports/server/rsc.browser.d.ts.map +1 -0
  26. package/dist/exports/server/rsc.browser.js +10 -0
  27. package/dist/exports/server/rsc.browser.js.map +1 -0
  28. package/dist/features/blockquote/server/index.d.ts +1 -4
  29. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  30. package/dist/features/blockquote/server/index.js +2 -0
  31. package/dist/features/blockquote/server/index.js.map +1 -1
  32. package/dist/features/blockquote/server/schema.d.ts +8 -0
  33. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  34. package/dist/features/blockquote/server/schema.js +15 -0
  35. package/dist/features/blockquote/server/schema.js.map +1 -0
  36. package/dist/features/blocks/client/component/index.d.ts +2 -1
  37. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  38. package/dist/features/blocks/client/component/index.js +16 -8
  39. package/dist/features/blocks/client/component/index.js.map +1 -1
  40. package/dist/features/blocks/client/componentInline/index.d.ts +2 -1
  41. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  42. package/dist/features/blocks/client/componentInline/index.js +15 -7
  43. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  44. package/dist/features/blocks/client/index.d.ts.map +1 -1
  45. package/dist/features/blocks/client/index.js +4 -2
  46. package/dist/features/blocks/client/index.js.map +1 -1
  47. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  48. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  49. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +1 -1
  50. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  51. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  52. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +1 -1
  53. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  54. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  55. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  56. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  57. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  58. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  59. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  60. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  61. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  62. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  63. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  64. package/dist/features/blocks/server/index.d.ts +1 -0
  65. package/dist/features/blocks/server/index.d.ts.map +1 -1
  66. package/dist/features/blocks/server/index.js +24 -72
  67. package/dist/features/blocks/server/index.js.map +1 -1
  68. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  69. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  70. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  71. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  72. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  73. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  74. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  75. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  76. package/dist/features/blocks/server/schema.d.ts +45 -0
  77. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  78. package/dist/features/blocks/server/schema.js +139 -0
  79. package/dist/features/blocks/server/schema.js.map +1 -0
  80. package/dist/features/blocks/server/validate.d.ts +1 -2
  81. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  82. package/dist/features/blocks/server/validate.js.map +1 -1
  83. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  84. package/dist/features/converters/lexicalToHtml/async/types.d.ts +14 -15
  85. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  86. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  87. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  88. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +14 -15
  89. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  90. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  91. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +4 -2
  92. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  93. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  94. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  95. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  96. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  97. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  98. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  99. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  100. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  101. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  102. package/dist/features/experimental_table/server/index.d.ts +1 -6
  103. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  104. package/dist/features/experimental_table/server/index.js +4 -0
  105. package/dist/features/experimental_table/server/index.js.map +1 -1
  106. package/dist/features/experimental_table/server/schema.d.ts +27 -0
  107. package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
  108. package/dist/features/experimental_table/server/schema.js +107 -0
  109. package/dist/features/experimental_table/server/schema.js.map +1 -0
  110. package/dist/features/heading/server/index.d.ts +2 -4
  111. package/dist/features/heading/server/index.d.ts.map +1 -1
  112. package/dist/features/heading/server/index.js +2 -0
  113. package/dist/features/heading/server/index.js.map +1 -1
  114. package/dist/features/heading/server/schema.d.ts +10 -0
  115. package/dist/features/heading/server/schema.d.ts.map +1 -0
  116. package/dist/features/heading/server/schema.js +37 -0
  117. package/dist/features/heading/server/schema.js.map +1 -0
  118. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  119. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  120. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  121. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  122. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  123. package/dist/features/horizontalRule/server/index.js +2 -0
  124. package/dist/features/horizontalRule/server/index.js.map +1 -1
  125. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
  126. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  127. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  128. package/dist/features/horizontalRule/server/schema.d.ts +7 -0
  129. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  130. package/dist/features/horizontalRule/server/schema.js +25 -0
  131. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  132. package/dist/features/link/client/index.d.ts.map +1 -1
  133. package/dist/features/link/client/index.js.map +1 -1
  134. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  135. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  136. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  137. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  138. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  139. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  140. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  141. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  142. package/dist/features/link/markdownTransformer.d.ts +1 -1
  143. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  144. package/dist/features/link/markdownTransformer.js.map +1 -1
  145. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  146. package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
  147. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  148. package/dist/features/link/nodes/AutoLinkNode.js +2 -1
  149. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  150. package/dist/features/link/nodes/LinkNode.d.ts +3 -3
  151. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  152. package/dist/features/link/nodes/LinkNode.js +2 -1
  153. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  154. package/dist/features/link/server/baseFields.js.map +1 -1
  155. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  156. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  157. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  158. package/dist/features/link/server/index.d.ts +2 -1
  159. package/dist/features/link/server/index.d.ts.map +1 -1
  160. package/dist/features/link/server/index.js +3 -0
  161. package/dist/features/link/server/index.js.map +1 -1
  162. package/dist/features/link/server/schema.d.ts +32 -0
  163. package/dist/features/link/server/schema.d.ts.map +1 -0
  164. package/dist/features/link/server/schema.js +169 -0
  165. package/dist/features/link/server/schema.js.map +1 -0
  166. package/dist/features/link/server/validate.d.ts +1 -1
  167. package/dist/features/link/server/validate.d.ts.map +1 -1
  168. package/dist/features/link/server/validate.js.map +1 -1
  169. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  170. package/dist/features/lists/checklist/server/index.js +3 -0
  171. package/dist/features/lists/checklist/server/index.js.map +1 -1
  172. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  173. package/dist/features/lists/orderedList/server/index.js +3 -0
  174. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  175. package/dist/features/lists/plugin/index.d.ts +0 -9
  176. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  177. package/dist/features/lists/plugin/index.js.map +1 -1
  178. package/dist/features/lists/shared/schema.d.ts +18 -0
  179. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  180. package/dist/features/lists/shared/schema.js +62 -0
  181. package/dist/features/lists/shared/schema.js.map +1 -0
  182. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  183. package/dist/features/lists/unorderedList/server/index.js +3 -0
  184. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  185. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  186. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  187. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  188. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  189. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  190. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  191. package/dist/features/relationship/client/plugins/index.d.ts +1 -1
  192. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  193. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  194. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  195. package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
  196. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  197. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
  198. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  199. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  200. package/dist/features/relationship/server/index.d.ts +1 -0
  201. package/dist/features/relationship/server/index.d.ts.map +1 -1
  202. package/dist/features/relationship/server/index.js +2 -0
  203. package/dist/features/relationship/server/index.js.map +1 -1
  204. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  205. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  206. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  207. package/dist/features/relationship/server/schema.d.ts +28 -0
  208. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  209. package/dist/features/relationship/server/schema.js +80 -0
  210. package/dist/features/relationship/server/schema.js.map +1 -0
  211. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
  212. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  213. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
  214. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  215. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  216. package/dist/features/typesServer.d.ts +17 -40
  217. package/dist/features/typesServer.d.ts.map +1 -1
  218. package/dist/features/typesServer.js.map +1 -1
  219. package/dist/features/upload/client/component/index.css +2 -2
  220. package/dist/features/upload/client/component/index.d.ts +1 -1
  221. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  222. package/dist/features/upload/client/component/index.js.map +1 -1
  223. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  224. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  225. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  226. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  227. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  228. package/dist/features/upload/client/plugin/index.js.map +1 -1
  229. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
  230. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  231. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  232. package/dist/features/upload/server/index.d.ts +1 -0
  233. package/dist/features/upload/server/index.d.ts.map +1 -1
  234. package/dist/features/upload/server/index.js +3 -2
  235. package/dist/features/upload/server/index.js.map +1 -1
  236. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  237. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  238. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  239. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  240. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  241. package/dist/features/upload/server/schema.d.ts +52 -0
  242. package/dist/features/upload/server/schema.d.ts.map +1 -0
  243. package/dist/features/upload/server/schema.js +129 -0
  244. package/dist/features/upload/server/schema.js.map +1 -0
  245. package/dist/features/upload/server/validate.d.ts +1 -1
  246. package/dist/features/upload/server/validate.d.ts.map +1 -1
  247. package/dist/features/upload/server/validate.js.map +1 -1
  248. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  249. package/dist/field/bundled.css +1 -1
  250. package/dist/field/clientEntry.d.ts +29 -0
  251. package/dist/field/clientEntry.d.ts.map +1 -0
  252. package/dist/field/clientEntry.js +86 -0
  253. package/dist/field/clientEntry.js.map +1 -0
  254. package/dist/field/index.css +9 -12
  255. package/dist/field/index.js +1 -1
  256. package/dist/field/index.js.map +1 -1
  257. package/dist/field/rscEntry.d.ts.map +1 -1
  258. package/dist/field/rscEntry.js +2 -0
  259. package/dist/field/rscEntry.js.map +1 -1
  260. package/dist/index.d.ts +8 -5
  261. package/dist/index.d.ts.map +1 -1
  262. package/dist/index.js +47 -4
  263. package/dist/index.js.map +1 -1
  264. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  265. package/dist/lexical/LexicalEditor.js +36 -2
  266. package/dist/lexical/LexicalEditor.js.map +1 -1
  267. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  268. package/dist/lexical/LexicalProvider.js +22 -7
  269. package/dist/lexical/LexicalProvider.js.map +1 -1
  270. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  271. package/dist/lexical/config/client/loader.js +5 -1
  272. package/dist/lexical/config/client/loader.js.map +1 -1
  273. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  274. package/dist/lexical/config/server/sanitize.js +9 -11
  275. package/dist/lexical/config/server/sanitize.js.map +1 -1
  276. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  277. package/dist/types/builtInNodes.d.ts +14 -0
  278. package/dist/types/builtInNodes.d.ts.map +1 -0
  279. package/dist/types/builtInNodes.js +203 -0
  280. package/dist/types/builtInNodes.js.map +1 -0
  281. package/dist/types/index.d.ts +16 -17
  282. package/dist/types/index.d.ts.map +1 -1
  283. package/dist/types/index.js.map +1 -1
  284. package/dist/types/jsonSchemaHelpers.d.ts +30 -0
  285. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  286. package/dist/types/jsonSchemaHelpers.js +58 -0
  287. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  288. package/dist/types/nodeTypes.d.ts +115 -61
  289. package/dist/types/nodeTypes.d.ts.map +1 -1
  290. package/dist/types/nodeTypes.js +3 -2
  291. package/dist/types/nodeTypes.js.map +1 -1
  292. package/dist/types/schema.d.ts.map +1 -1
  293. package/dist/types/schema.js +67 -65
  294. package/dist/types/schema.js.map +1 -1
  295. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  296. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  297. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  298. package/dist/utilities/buildEditorState.d.ts +17 -3
  299. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  300. package/dist/utilities/buildEditorState.js +8 -0
  301. package/dist/utilities/buildEditorState.js.map +1 -1
  302. package/dist/utilities/buildInitialState.d.ts +2 -1
  303. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  304. package/dist/utilities/buildInitialState.js.map +1 -1
  305. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  306. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  307. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  308. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  309. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  310. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  311. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  312. package/dist/utilities/fieldsDrawer/index.css +12 -0
  313. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  314. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  315. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  316. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  317. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  318. package/dist/utilities/generateImportMap.js +7 -3
  319. package/dist/utilities/generateImportMap.js.map +1 -1
  320. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  321. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  322. package/package.json +8 -7
  323. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  324. package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
  325. package/dist/exports/client/RelationshipComponent-RZL743CS.js.map +0 -7
  326. package/dist/exports/client/chunk-6QWQ7JV4.js +0 -2
  327. package/dist/exports/client/chunk-6QWQ7JV4.js.map +0 -7
  328. package/dist/exports/client/chunk-FEJXFRL7.js +0 -2
  329. package/dist/exports/client/chunk-FEJXFRL7.js.map +0 -7
  330. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  331. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  332. package/dist/exports/client/component-CVM4OESA.js.map +0 -7
  333. package/dist/exports/client/componentInline-JJZ2NKW2.js +0 -2
  334. package/dist/features/link/nodes/types.d.ts +0 -27
  335. package/dist/features/link/nodes/types.d.ts.map +0 -1
  336. package/dist/features/link/nodes/types.js +0 -2
  337. package/dist/features/link/nodes/types.js.map +0 -1
  338. /package/dist/exports/client/{componentInline-JJZ2NKW2.js.map → componentInline-H24N7GUG.js.map} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utilities/fieldsDrawer/Drawer.tsx", "../../../src/utilities/fieldsDrawer/DrawerContent.tsx", "../../../src/features/upload/client/drawer/commands.ts"],
4
- "sourcesContent": ["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n", "'use client'\nimport type { FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentForm,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { deepCopyObjectSimpleWithoutReactComponents } from 'payload/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 const { fields: parentDocumentFields } = useDocumentForm()\n const isEditable = useLexicalEditable()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap },\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 documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: data,\n operation: 'update',\n readOnly: !isEditable,\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 isEditable,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }: { formState: FormState }) => {\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 documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\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 isEditable,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\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={true}\n readOnly={!isEditable}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )\n}\n", "'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nexport const INSERT_UPLOAD_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_UPLOAD_WITH_DRAWER_COMMAND')\n"],
5
- "mappings": "wCAAA,OAAAA,KAAAC,MAAA,iEAGA,OAASC,UAAAA,EAAQC,qBAAAA,EAAmBC,YAAAA,MAAgB,iBACpD,MAAkB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AA,CAAAvB,KAAAA,EAAAG,WAAAA,EAAAC,iBAAAA,EAAAC,mBAIsBO,EAYpBN,yBAAAA,EAAAC,WAAAA,EAAAC,iBAAAA,CAAA,CAAA,iGAlBNQ,GEvCJ,OAASQ,iBAAAA,MAAqB,UAEvB,IAAMC,GAERD,EAAc,mCAAA",
6
- "names": ["c", "_c", "Drawer", "EditDepthProvider", "useModal", "useLexicalEditable", "Form", "FormSubmit", "RenderFields", "useDocumentForm", "useDocumentInfo", "useServerFunctions", "useTranslation", "abortAndIgnore", "deepCopyObjectSimpleWithoutReactComponents", "useCallback", "useEffect", "useRef", "useState", "v4", "uuid", "DrawerContent", "data", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "t", "useTranslation", "id", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "fields", "parentDocumentFields", "useDocumentForm", "isEditable", "useLexicalEditable", "onChangeAbortControllerRef", "useRef", "AbortController", "initialState", "setInitialState", "useState", "fieldProps", "featureClientSchemaMap", "useEditorConfigContext", "getFormState", "useServerFunctions", "schemaFieldsPath", "useEffect", "controller", "state", "docPermissions", "docPreferences", "documentFormState", "deepCopyObjectSimpleWithoutReactComponents", "excludeFiles", "initialBlockData", "operation", "readOnly", "renderAllFields", "signal", "abortAndIgnore", "onChange", "useCallback", "formState", "prevFormState", "current", "initialBlockFormState", "_jsxs", "Form", "beforeSubmit", "disableValidationOnSubmit", "Array", "isArray", "onSubmit", "uuid", "_jsx", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "permissions", "FormSubmit", "FieldsDrawer", "t0", "$", "_c", "className", "data", "drawerSlug", "drawerTitle", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "closeModal", "useModal", "t1", "t2", "args", "args2", "setTimeout", "t3", "_jsx", "EditDepthProvider", "children", "Drawer", "slug", "title", "DrawerContent", "createCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND"]
7
- }
@@ -1,2 +0,0 @@
1
- import{a as ue}from"./chunk-INBEEENE.js";import{b as ae}from"./chunk-RJ5MAOKZ.js";import{jsx as l,jsxs as _,Fragment as Re}from"react/jsx-runtime";import{useLexicalComposerContext as je}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Me}from"@lexical/react/useLexicalEditable";import{getTranslation as me}from"@payloadcms/translations";import{Button as de,Drawer as Ke,EditDepthProvider as Ae,Form as Je,formatDrawerSlug as ze,FormSubmit as Ve,RenderFields as He,ShimmerEffect as We,useConfig as Xe,useDocumentForm as Ge,useDocumentInfo as Ue,useEditDepth as qe,useServerFunctions as Qe,useTranslation as Ye}from"@payloadcms/ui";import{abortAndIgnore as J}from"@payloadcms/ui/shared";import{$getNodeByKey as z,SKIP_DOM_SELECTION_TAG as fe}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as V,reduceFieldsToValues as Ze}from"payload/shared";import F,{createContext as et,useCallback as H,useEffect as E,useMemo as B,useRef as y}from"react";import{v4 as tt}from"uuid";import{jsx as Oe}from"react/jsx-runtime";import Te from"bson-objectid";import{$applyNodeReplacement as Ee}from"lexical";import $e from"react";import{addClassNamesToElement as De}from"@lexical/utils";import Ie from"bson-objectid";import{$applyNodeReplacement as ve,DecoratorNode as we}from"lexical";var S=class extends we{__cacheBuster;__fields;constructor({cacheBuster:t,fields:e,key:i}){super(i),this.__fields=e,this.__cacheBuster=t||0}static clone(t){return new this({cacheBuster:t.__cacheBuster,fields:t.__fields,key:t.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(t){return Ne(t.fields)}static isInline(){return!1}canIndent(){return!0}createDOM(t){let e=document.createElement("span");return De(e,t?.theme?.inlineBlock),e}decorate(t,e){return null}exportDOM(){let t=document.createElement("span");t.classList.add("inline-block-container");let e=document.createTextNode(this.getTextContent());return t.append(e),{element:t}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(t,e){let i=this.getWritable();i.__fields=t,e||i.__cacheBuster++}updateDOM(){return!1}};function Ne(c){return ve(new S({fields:{...c,id:c?.id||new Ie.default().toHexString()}}))}var Le=$e.lazy(()=>import("./componentInline-JJZ2NKW2.js").then(c=>({default:c.InlineBlockComponent}))),T=class extends S{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importJSON(t){return Pe(t.fields)}decorate(...[t,e,i,f]){return Oe(Le,{cacheBuster:this.getCacheBuster(),className:e.theme.inlineBlock??"LexicalEditorTheme__inlineBlock",CustomBlock:i,CustomLabel:f,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Pe(c){return Ee(new T({fields:{...c,id:c?.id||new Te.default().toHexString()}}))}function A(c){return c instanceof T}var be=et({initialState:!1}),pe=()=>F.use(be),Dt=c=>{let{cacheBuster:t,className:e,CustomBlock:i,CustomLabel:f,formData:n,nodeKey:a}=c,[h]=je(),u=Me(),{i18n:$,t:k}=Ye(),{createdInlineBlock:W,fieldProps:{featureClientSchemaMap:ke,initialLexicalFormState:he,schemaPath:X},setCreatedInlineBlock:G,uuid:Be}=ae(),{fields:D}=Ge(),{getFormState:I}=Qe(),Ce=qe(),U=y(!1),[m,L]=F.useState(()=>{let r=he?.[n.id]?.formState;return r?Object.fromEntries(Object.entries(r).map(([s,o])=>[s,s in n?{...o,initialValue:n[s],value:n[s]}:o])):!1}),q=y(!1),Q=y(t);E(()=>{q.current?(Q.current!==t&&L(!1),Q.current=t):q.current=!0},[t]);let[ge]=F.useState(()=>tt()),[Y,Z]=F.useState(()=>{if(!f)return m?._components?.customComponents?.BlockLabel??void 0}),[ee,te]=F.useState(()=>{if(!i)return m?._components?.customComponents?.Block??void 0}),ne=B(()=>i?l(i,{className:e,formData:n,isEditor:!0,isJSXConverter:!1,nodeKey:a,useInlineBlockComponentContext:pe}):ee,[i,e,n,a,ee]),P=B(()=>f?l(f,{className:e,formData:n,isEditor:!0,isJSXConverter:!1,nodeKey:a,useInlineBlockComponentContext:pe}):Y,[f,e,n,a,Y]),oe=ze({slug:`lexical-inlineBlocks-create-${Be}-${n.id}`,depth:Ce}),{toggleDrawer:b}=ue(oe,!0),xe=y(null),{id:v,collectionSlug:w,getDocPreferences:N,globalSlug:O}=Ue(),{config:Se}=Xe(),_e=`${X}.lexical_internal_feature.blocks.lexical_inline_blocks.${n.blockType}`,C=ke.blocks?.[_e]?.[0],d=C.blockReferences?typeof C?.blockReferences?.[0]=="string"?Se.blocksMap[C?.blockReferences?.[0]]:C?.blockReferences?.[0]:C?.blocks?.[0],re=d?.fields??[];E(()=>{!U.current&&W?.getKey()===a&&(re.length>2&&b(),G?.(void 0),U.current=!0)},[re.length,W,a,G,b]);let se=H(()=>{h.update(()=>{z(a)?.remove()})},[h,a]),g=d?.labels?.singular?me(d?.labels.singular,$):d?.slug,R=y(new AbortController),x=`${X}.lexical_internal_feature.blocks.lexical_inline_blocks.${d?.slug}.fields`;E(()=>{let r=new AbortController;return n&&!m&&(async()=>{let{state:o}=await I({id:v,collectionSlug:w,data:n,docPermissions:{fields:!0},docPreferences:await N(),documentFormState:V(D,{excludeFiles:!0}),globalSlug:O,initialBlockData:n,initialBlockFormState:n,operation:"update",readOnly:!u,renderAllFields:!0,schemaPath:x,signal:r.signal});if(o){let p=Ze(V(o,{excludeFiles:!0}),!0);h.update(()=>{let K=z(a);if(K&&A(K)){let ce=p;ce.blockType=n.blockType,K.setFields(ce,!0)}},{tag:fe}),L(o),f||Z(o._components?.customComponents?.BlockLabel),i||te(o._components?.customComponents?.Block)}})(),()=>{J(r)}},[I,h,a,u,f,i,x,v,n,m,w,O,N,D]);let le=H(async({formState:r,submit:s})=>{J(R.current);let o=new AbortController;R.current=o;let{state:p}=await I({id:v,collectionSlug:w,docPermissions:{fields:!0},docPreferences:await N(),documentFormState:V(D,{excludeFiles:!0}),formState:r,globalSlug:O,initialBlockFormState:r,operation:"update",readOnly:!u,renderAllFields:!!s,schemaPath:x,signal:o.signal});return p?(s&&(f||Z(p._components?.customComponents?.BlockLabel),i||te(p._components?.customComponents?.Block)),p):r},[I,v,w,N,D,O,u,x,i,f]);E(()=>{let r=(s,o)=>Object.keys(o).some(p=>o[p]&&s[p]!==o[p].value);return()=>{m&&r(n,m)&&L(!1),J(R.current)}},[n,m]);let ye=H((r,s)=>{s.blockType=n.blockType,h.update(()=>{let o=z(a);o&&A(o)&&o.setFields(s,!0)},{tag:fe})},[h,a,n]),j=B(()=>()=>l(de,{buttonStyle:"ghost",className:`${e}__removeButton`,disabled:!u,icon:"x",onClick:r=>{r.preventDefault(),r.stopPropagation(),se()},round:!0,size:"medium",tooltip:k("lexical:blocks:inlineBlocks:remove",{label:g})}),[e,g,u,se,k]),Fe=B(()=>()=>l(de,{buttonStyle:"ghost",className:`${e}__editButton`,disabled:!u,el:"button",icon:"edit",onClick:()=>{b()},round:!0,size:"medium",tooltip:k("lexical:blocks:inlineBlocks:edit",{label:g})}),[e,g,u,k,b]),M=B(()=>({children:r,className:s})=>l("div",{className:[`${e}__container`,e+"-"+n.blockType,s].filter(Boolean).join(" "),...u?{onClick:()=>b(),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),b())},role:"button",tabIndex:0}:{},ref:xe,children:r}),[e,n.blockType,u,b]),ie=B(()=>P?()=>P:()=>l("div",{children:d?.labels?me(d?.labels.singular,$):""}),[P,d?.labels,$]);return d?_(Je,{beforeSubmit:[async({formState:r})=>await le({formState:r,submit:!0})],disableValidationOnSubmit:!0,el:"div",fields:d?.fields,initialState:m||{},onChange:[le],onSubmit:(r,s)=>{ye(r,s),b()},uuid:ge,children:[l(Ae,{children:l(Ke,{className:"",slug:oe,title:k(`lexical:blocks:inlineBlocks:${n?.id?"edit":"create"}`,{label:g??k("lexical:blocks:inlineBlocks:label")}),children:m?_(Re,{children:[l(He,{fields:d?.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:x,permissions:!0,readOnly:!u}),l(Ve,{programmaticSubmit:!0,children:k("fields:saveChanges")})]}):null})}),ne?l(be,{value:{EditButton:Fe,initialState:m,InlineBlockContainer:M,Label:ie,nodeKey:a,RemoveButton:j},children:ne}):_(M,{children:[m?l(ie,{}):l(We,{height:"15px",width:"40px"}),u?l("div",{className:`${e}__actions`,children:l(j,{})}):null]})]}):_(M,{className:`${e}-not-found`,children:[_("span",{children:["Error: Block '",n.blockType,"' not found"]}),u?l("div",{className:`${e}__actions`,children:l(j,{})}):null]})};export{pe as a,Dt as b,T as c,Pe as d,A as e};
2
- //# sourceMappingURL=chunk-FEJXFRL7.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/features/blocks/client/componentInline/index.tsx", "../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx", "../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical'\n\nimport './index.css'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\nimport type { BlockComponentProps } from '../component/index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\nexport type InlineBlockComponentProps<\n TFormData extends Record<string, unknown> = InlineBlockFields,\n> = {\n readonly CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>\n readonly CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>\n} & Pick<BlockComponentProps<TFormData>, 'cacheBuster' | 'className' | 'formData' | 'nodeKey'>\n\nexport type InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<InlineBlockComponentProps<InlineBlockFields>> = (\n props,\n) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n return Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist, we render them directly with formData instead.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n CustomLabelFromProps,\n CustomBlockFromProps,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\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 documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n removeInlineBlock()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n {...(isEditable\n ? {\n onClick: () => toggleDrawer(),\n onKeyDown: (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n toggleDrawer()\n }\n },\n role: 'button',\n tabIndex: 0,\n }\n : {})}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType, isEditable, toggleDrawer],\n )\n\n const Label = useMemo(() => {\n if (resolvedCustomLabel) {\n return () => resolvedCustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [resolvedCustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={formUuid}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {resolvedCustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {resolvedCustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n", "'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport type InlineBlockDecorateFunction = (\n editor: LexicalEditor,\n config: EditorConfig,\n CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>,\n CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>,\n) => JSX.Element\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(\n ...[_editor, config, CustomBlock, CustomLabel]: Parameters<InlineBlockDecorateFunction>\n ): ReturnType<InlineBlockDecorateFunction> {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'}\n CustomBlock={CustomBlock}\n CustomLabel={CustomLabel}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return $applyNodeReplacement(\n new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../types/nodeTypes.js'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: InlineBlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedLexicalNode, 'inlineBlock'>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, config?.theme?.inlineBlock)\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return $applyNodeReplacement(\n new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],
5
- "mappings": "mJAIA,OAASA,6BAAAA,OAAiC,wCAC1C,OAASC,sBAAAA,OAA0B,oCACnC,OAASC,kBAAAA,OAAsB,2BAC/B,OACEC,UAAAA,GACAC,UAAAA,GACAC,qBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,cAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,aAAAA,GACAC,mBAAAA,GACAC,mBAAAA,GACAC,gBAAAA,GACAC,sBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OAASC,iBAAAA,EAAeC,0BAAAA,OAA8B,UAEtD,OAAO,8CAAAC,EAAA,wBAAAC,OAAA,iBAEP,OAAAC,GAASF,iBAAAA,GAAAA,eAAAA,EAAAA,aAAAA,EAA4CC,WAAAA,EAAAA,UAAAA,MAAoB,QACzE,OAAOC,MAAAC,OAASC,gDC5BhB,OAAOC,OAAc,gBACrB,OACEC,yBAAAA,OAIK,UACP,OAAOC,OAAyB,QCKhC,OAASC,0BAAAA,OA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AA,eAzE/BmB,EAAAkB,EAAA,CAChB,UAAA,GAAA1J,CACE,aAAsBC,SAAA,CAAcuI,EAAA,OAAqB,4BACtDnI,EAAA,UAAA,aAAA,MAAK8G,EAAe9G,MAAS6F,WAC7BzF,GAAAT,CAAA,YACMC,SAAckH,EAAAE,EAAoB,CAAA,CAAA",
6
- "names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "Drawer", "EditDepthProvider", "Form", "formatDrawerSlug", "FormSubmit", "RenderFields", "ShimmerEffect", "useConfig", "useDocumentForm", "useDocumentInfo", "useEditDepth", "useServerFunctions", "useTranslation", "abortAndIgnore", "$getNodeByKey", "SKIP_DOM_SELECTION_TAG", "deepCopyObjectSimpleWithoutReactComponents", "reduceFieldsToValues", "React", "uuid", "createContext", "ObjectID", "$applyNodeReplacement", "React", "addClassNamesToElement", "ObjectID", "$applyNodeReplacement", "DecoratorNode", "ServerInlineBlockNode", "__cacheBuster", "__fields", "constructor", "cacheBuster", "fields", "key", "clone", "node", "__key", "getType", "importDOM", "importJSON", "serializedNode", "$createServerInlineBlockNode", "isInline", "canIndent", "createDOM", "config", "element", "document", "createElement", "theme", "inlineBlock", "decorate", "editor", "exportDOM", "classList", "add", "text", "createTextNode", "getTextContent", "append", "exportJSON", "type", "getFields", "version", "getCacheBuster", "getLatest", "setFields", "preventFormStateUpdate", "writable", "getWritable", "updateDOM", "id", "default", "toHexString", "InlineBlockComponent", "React", "lazy", "then", "module", "default", "InlineBlockNode", "ServerInlineBlockNode", "clone", "node", "getType", "importJSON", "serializedNode", "$createInlineBlockNode", "fields", "decorate", "_editor", "config", "CustomBlock", "CustomLabel", "_jsx", "cacheBuster", "getCacheBuster", "className", "theme", "inlineBlock", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "$applyNodeReplacement", "id", "ObjectID", "toHexString", "$isInlineBlockNode", "InlineBlockComponentContext", "createContext", "useInlineBlockComponentContext", "React", "cacheBuster", "baseClass", "className", "CustomBlock", "CustomBlockFromProps", "CustomLabel", "formData", "nodeKey", "props", "useLexicalComposerContext", "isEditable", "i18n", "t", "useTranslation", "createdInlineBlock", "fieldProps", "featureClientSchemaMap", "initialLexicalFormState", "setCreatedInlineBlock", "uuid", "uuidFromContext", "useEditorConfigContext", "parentDocumentFields", "fields", "useDocumentForm", "getFormState", "useServerFunctions", "editDepth", "useEditDepth", "firstTimeDrawer", "setInitialState", "cachedFormState", "fieldName", "fieldState", "initialValue", "value", "hasMounted", "useRef", "useEffect", "prevCacheBuster", "current", "setCustomLabel", "CustomLabelFromProps", "initialState", "setCustomBlock", "resolvedCustomBlock", "useMemo", "isEditor", "isJSXConverter", "resolvedCustomLabel", "drawerSlug", "slug", "toggleDrawer", "useLexicalDrawer", "inlineBlockElemElemRef", "id", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "config", "useConfig", "schemaPath", "clientSchemaMap", "componentMapRenderedBlockPath", "blocksField", "clientBlock", "blockReferences", "clientBlockFields", "undefined", "length", "editor", "removeInlineBlock", "getTranslation", "blockDisplayName", "labels", "singular", "onChangeAbortControllerRef", "AbortController", "state", "data", "docPermissions", "docPreferences", "deepCopyObjectSimpleWithoutReactComponents", "documentFormState", "initialBlockData", "initialBlockFormState", "operation", "readOnly", "renderAllFields", "schemaFieldsPath", "reduceFieldsToValues", "newFormStateData", "excludeFiles", "update", "$getNodeByKey", "node", "$isInlineBlockNode", "newData", "blockType", "SKIP_DOM_SELECTION_TAG", "abortAndIgnore", "abortController", "onChange", "formState", "submit", "state_0", "prevFormState", "formData_0", "initialState_0", "isStateOutOfSync", "key", "newData_0", "onFormSubmit", "useCallback", "node_0", "_jsx", "Button", "RemoveButton", "buttonStyle", "disabled", "icon", "e", "onClick", "preventDefault", "round", "size", "tooltip", "EditButton", "el", "children", "e_0", "onKeyDown", "role", "tabIndex", "ref", "Label", "_jsxs", "Form", "beforeSubmit", "formState_0", "disableValidationOnSubmit", "onSubmit", "formUuid", "EditDepthProvider", "title", "_Fragment", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "permissions", "FormSubmit", "programmaticSubmit", "InlineBlockContainer", "ShimmerEffect", "height", "width"]
7
- }
@@ -1,2 +0,0 @@
1
- import{c as T}from"react/compiler-runtime";import{useLexicalComposerContext as b}from"@lexical/react/LexicalComposerContext";import{useModal as h}from"@payloadcms/ui";import{$getPreviousSelection as v,$getSelection as E,$setSelection as P}from"lexical";import{useEffect as W,useState as k}from"react";var F=(t,i)=>{let e=T(24),[s]=b(),[c,B]=k(null),[n,D]=k(!1),{closeModal:u,modalState:l,toggleModal:O}=h(),r;e[0]!==s?(r=()=>{s.read(()=>{let M=E()??v();B(M)})},e[0]=s,e[1]=r):r=e[1];let w=r,a;e[2]!==s||e[3]!==c?(a=()=>{c&&s.update(()=>{P(c.clone())},{discrete:!0,skipTransforms:!0})},e[2]=s,e[3]=c,e[4]=a):a=e[4];let o=a,f;e[5]!==u||e[6]!==t?(f=()=>{u(t)},e[5]=u,e[6]=t,e[7]=f):f=e[7];let x=f,$=l?.[t]?.isOpen,m;e[8]!==$||e[9]!==o||e[10]!==t||e[11]!==w||e[12]!==O?(m=()=>{$?o():w(),D(!0),O(t)},e[8]=$,e[9]=o,e[10]=t,e[11]=w,e[12]=O,e[13]=m):m=e[13];let C=m,p,d;e[14]!==l||e[15]!==i||e[16]!==o||e[17]!==t||e[18]!==n?(p=()=>{if(!n)return;let M=l[t];M&&!M?.isOpen&&(D(!1),i?setTimeout(()=>{o()},0):o())},d=[l,t,o,n,i],e[14]=l,e[15]=i,e[16]=o,e[17]=t,e[18]=n,e[19]=p,e[20]=d):(p=e[19],d=e[20]),W(p,d);let S;return e[21]!==x||e[22]!==C?(S={closeDrawer:x,toggleDrawer:C},e[21]=x,e[22]=C,e[23]=S):S=e[23],S};export{F as a};
2
- //# sourceMappingURL=chunk-INBEEENE.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utilities/fieldsDrawer/useLexicalDrawer.tsx"],
4
- "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"],
5
- "mappings": "AAAA,OAAAA,KAAAC,MAAA,yBAGA,OAASC,6BAAAA,MAAiC,wCAC1C,OAASC,YAAAA,MAAgB,iBACzB,OAASC,yBAAAA,EAAuBC,iBAAAA,EAAeC,iBAAAA,MAAqB,UACpE,OAAsBC,aAAAA,EAAWC,YAAAA,MAAgB,QAO1C,IAAMC,EAAmBA,CAAAC,EAAAC,IAAA,CAAA,IAAAC,EAAAX,EAAA,EAAA,EAC9B,CAAAY,CAAA,EAAiBX,EAAA,EACjB,CAAAY,EAAAC,CAAA,EAA4CP,EAAA,IAA+B,EAC3E,CAAAQ,EAAAC,CAAA,EAA8BT,EAAA,EAAkB,EAEhD,CAAAU,WAAAC,EAAAC,WAAAA,EAAAC,YAAAC,CAAA,EAAiFnB,EAAA,EAAAoB,EAAAX,EAAA,CAAA,IAAAC,GAE9CU,EAAAA,IAAA,CACjCV,EAAAW,KAAA,IAAA,CACE,IAAAC,EAAkBpB,EAAA,GAAmBD,EAAA,EACrCW,EAAkBU,CAAA,CAAA,CACpB,CAAA,EACFb,EAAA,CAAA,EAAAC,EAAAD,EAAA,CAAA,EAAAW,GAAAA,EAAAX,EAAA,CAAA,EALA,IAAAc,EAAuBH,EAKZI,EAAAf,EAAA,CAAA,IAAAC,GAAAD,EAAA,CAAA,IAAAE,GAE0Ba,EAAAA,IAAA,CAC/Bb,GACFD,EAAAe,OAAA,IAAA,CAEItB,EAAcQ,EAAAe,MAAoB,CAAA,CAAA,EAAA,CAAAC,SAAA,GAAAC,eAAA,EAAA,CAEG,CAAA,EAG7CnB,EAAA,CAAA,EAAAC,EAAAD,EAAA,CAAA,EAAAE,EAAAF,EAAA,CAAA,EAAAe,GAAAA,EAAAf,EAAA,CAAA,EATA,IAAAoB,EAAyBL,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A,EAAAoB,EAAApB,EAAA,EAAA,EAAAF,EAAAE,EAAA,EAAA,EAAAI,EAAAJ,EAAA,EAAA,EAAA2B,EAAA3B,EAAA,EAAA,EAAA4B,IAAAD,EAAA3B,EAAA,EAAA,EAAA4B,EAAA5B,EAAA,EAAA,GAnB7DL,EAAUgC,EAmBPC,CAA0D,EAAA,IAAAG,EAAA,OAAA/B,EAAA,EAAA,IAAAsB,GAAAtB,EAAA,EAAA,IAAA0B,GAEtDK,EAAA,CAAAT,YAAAA,EAAAI,aAAAA,CAAA,EAGP1B,EAAA,EAAA,EAAAsB,EAAAtB,EAAA,EAAA,EAAA0B,EAAA1B,EAAA,EAAA,EAAA+B,GAAAA,EAAA/B,EAAA,EAAA,EAHO+B,CAGP",
6
- "names": ["c", "_c", "useLexicalComposerContext", "useModal", "$getPreviousSelection", "$getSelection", "$setSelection", "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"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/features/upload/client/component/index.tsx"],
4
- "sourcesContent": ["'use client'\nimport type { ClientCollectionConfig, Data, FormState, JsonObject } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n formatDrawerSlug,\n Pill,\n Thumbnail,\n useConfig,\n useEditDepth,\n usePayloadAPI,\n useTranslation,\n} from '@payloadcms/ui'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n $isRangeSelection,\n type ElementFormatType,\n} from 'lexical'\nimport { formatAdminURL, isImage } from 'payload/shared'\nimport React, { useCallback, useEffect, useId, useReducer, useRef, useState } from 'react'\n\nimport type { BaseClientFeatureProps } from '../../../typesClient.js'\nimport type { UploadData } from '../../server/nodes/UploadNode.js'\nimport type { UploadFeaturePropsClient } from '../index.js'\nimport type { UploadNode } from '../nodes/UploadNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport './index.css'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n className: string\n data: UploadData\n format?: ElementFormatType\n nodeKey: string\n}\n\nexport const UploadComponent: React.FC<ElementProps> = (props) => {\n const {\n className: baseClass,\n data: { fields, relationTo, value },\n format,\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.',\n )\n }\n\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n const uploadRef = useRef<HTMLDivElement | null>(null)\n const { uuid } = useEditorConfigContext()\n const editDepth = useEditDepth()\n const [editor] = useLexicalComposerContext()\n\n const {\n editorConfig,\n fieldProps: { schemaPath },\n } = useEditorConfigContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation()\n const [isSelected, setIsSelected] = useState(false)\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [relatedCollection] = useState<ClientCollectionConfig>(() =>\n getEntityConfig({ collectionSlug: relationTo }),\n )\n\n const componentID = useId()\n\n const extraFieldsDrawerSlug = formatDrawerSlug({\n slug: `lexical-upload-drawer-` + uuid + componentID, // There can be multiple upload components, each with their own drawer, in one single editor => separate them by componentID\n depth: editDepth,\n })\n\n // Need to use hook to initialize useEffect that restores cursor position\n const { toggleDrawer } = useLexicalDrawer(extraFieldsDrawerSlug, true)\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n // Get the referenced document\n const [{ data }, { setParams }] = usePayloadAPI(\n formatAdminURL({ apiRoute: api, path: `/${relatedCollection.slug}/${value}`, serverURL }),\n { initialParams },\n )\n\n const thumbnailSRC = data?.thumbnailURL || data?.url\n\n useEffect(() => {\n return editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n const selection = $getSelection()\n\n if ($isNodeSelection(selection)) {\n setIsSelected(selection.has(nodeKey))\n } else if ($isRangeSelection(selection)) {\n const nodes = selection.getNodes()\n setIsSelected(nodes.some((node) => node.getKey() === nodeKey))\n } else {\n setIsSelected(false)\n }\n })\n })\n }, [editor, nodeKey])\n\n useEffect(() => {\n const outerEl = uploadRef.current?.closest(`.${baseClass}`)\n\n if (outerEl) {\n outerEl.classList.toggle(`${baseClass}--selected`, isSelected)\n }\n }, [isSelected, baseClass])\n\n const removeUpload = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateUpload = useCallback(\n (_data: Data) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n dispatchCacheBust()\n closeDocumentDrawer()\n },\n [setParams, cacheBust, closeDocumentDrawer],\n )\n\n const hasExtraFields = (\n editorConfig?.resolvedFeatureMap?.get('upload')\n ?.sanitizedClientFeatureProps as BaseClientFeatureProps<UploadFeaturePropsClient>\n ).collections?.[relatedCollection.slug]?.hasExtraFields\n\n const onExtraFieldsDrawerSubmit = useCallback(\n (_: FormState, data: JsonObject) => {\n // Update lexical node (with key nodeKey) with new data\n editor.update(() => {\n const uploadNode: null | UploadNode = $getNodeByKey(nodeKey)\n if (uploadNode) {\n const newData: UploadData = {\n ...uploadNode.getData(),\n fields: data,\n }\n uploadNode.setData(newData)\n }\n })\n },\n [editor, nodeKey],\n )\n\n const aspectRatio =\n thumbnailSRC && data?.width && data?.height\n ? data.width > data.height\n ? 'landscape'\n : 'portrait'\n : 'landscape'\n\n return (\n <div\n className={`${baseClass}__contents ${baseClass}__contents--${aspectRatio}`}\n data-align={format || undefined}\n data-filename={data?.filename}\n ref={uploadRef}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__media`}>\n <Thumbnail\n collectionSlug={relationTo}\n fileSrc={isImage(data?.mimeType) ? thumbnailSRC : null}\n height={data?.height}\n size=\"none\"\n width={data?.width}\n />\n\n {isEditable && (\n <div className={`${baseClass}__floater`} data-theme=\"dark\">\n <Pill className={`${baseClass}__collectionLabel`} pillStyle=\"dark\" size=\"small\">\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </Pill>\n\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <span className={`${baseClass}__filename`}>\n {data?.filename || t('general:untitled')}\n </span>\n </DocumentDrawerToggler>\n\n {hasExtraFields ? (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"write\"\n onClick={toggleDrawer}\n round\n size=\"medium\"\n tooltip={t('fields:editRelationship')}\n />\n ) : null}\n\n <div className={`${baseClass}__divider`} />\n\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__swap-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n size=\"medium\"\n tooltip={t('fields:swapUpload')}\n />\n\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n size=\"medium\"\n tooltip={t('fields:removeUpload')}\n />\n </div>\n )}\n </div>\n </div>\n\n {value ? <DocumentDrawer onSave={updateUpload} /> : null}\n {hasExtraFields ? (\n <FieldsDrawer\n data={fields}\n drawerSlug={extraFieldsDrawerSlug}\n drawerTitle={t('general:editLabel', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n featureKey=\"upload\"\n handleDrawerSubmit={onExtraFieldsDrawerSubmit}\n schemaPath={schemaPath}\n schemaPathSuffix={relatedCollection.slug}\n />\n ) : null}\n </div>\n )\n}\n"],
5
- "mappings": "sOAGA,OAASA,6BAAAA,OAAiC,2CAC1C,OAASC,sBAAAA,OAA0B,oCACnC,OAASC,kBAAAA,MAAsB,2BAC/B,OACEC,UAAAA,EACAC,oBAAAA,GACAC,QAAAA,GACAC,aAAAA,GACAC,aAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,kBAAAA,OACK,iBACP,OACEC,iBAAAA,EACAC,iBAAAA,GACAC,oBAAAA,GACAC,qBAAAA,OAEK,UACP,OAASC,kBAAAA,GAAgBC,WAAAA,OAAe,iBACxC,OAAgBC,eAAAA,EAAaC,aAAAA,EAAWC,SAAAA,GAAOC,cAAAA,GAAYC,UAAAA,GAAQC,YAAAA,MAAgB,QAYnF,IAAAC,EAAO,CAEP,MAAMA,GAENC,GAAAC,GAAA,CASA,GAAO,CACL,UAAMC,EACJC,KAAAA,CACAC,OAAAA,EAAQC,WAAAA,EAAQC,MAAAA,GAAiB,OAAAC,EACjCA,QAAAA,GACAC,EAAO,GACLP,OAAAQ,GAAA,SAEJ,MAAI,IAAOA,MAAA,wHAAoB,EAI/B,GAAA,CAEA,OAAM,CACJC,OAAQ,CACNC,IAAAA,GAAa,UAAAC,GACJ,gBAAAC,GAEXA,GAAAA,EACEC,EAAAC,GAAA,IAAA,EACEC,CACN,KAAAC,GAAQA,EAAAA,EAASC,EAAAA,GAAA,EAC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,GAAArB,CAAA,YACMC,aAAcD,OAAsB,SAAA,CAAW2E,EAAAQ,GAAA,eAClDR,oBAAM1E,UAAW,OAAiCmF,KAAAA,QAAiBH,SAAKI,EAAArD,EAAA,OAAA,SAAAV,CAAA,IACrE+D,EAAAA,EAAiCC,eAGnC3C,uBAAsB1C,SAAc0E,EAAA,OAAA,WACnC,GAAA3E,CAAA2E,aAAM1E,SAAAC,GAAcF,UAAAuB,EAAA,kBAAqB,yBAK1C4C,QAEGoB,UAAA,GAAYvF,CAAA,0BACZC,SAAA,CAAWoB,EACXmE,GAAAA,SACAC,KAAG,QACHC,QAAKnD,EACLoD,MAAA,GACAC,KAAK,SACLX,QAAK1D,EAAA,yBAAA,IACLsE,KAAWlB,EAAA,MAAA,WAEX,GAAA3E,CAEJ2E,cAAmB3E,EAAAA,EAAA,qBAGjBuF,UAAA,GAAYvF,CAAA,wBACZC,SAAA,CAAWoB,EACXmE,GAAAA,SACAC,KAAG,OACHC,QAAK,IAAA,CACLC,EAASA,gBAAAG,EAAA,CACPzC,QAAO0C,CACLC,QAAAA,MAEJ,MAAA,GACAJ,KAAK,SACLX,QAAK1D,EAAA,mBAAA,IACMoD,EAAAsB,EAAA,qBAIXV,UAAA,GAAYvF,CAAA,iBACZC,SAAA,CAAWoB,EACXmE,KAAAA,IACAE,QAAKQ,GAAA,CACLP,EAAAA,eAAU,EACRO,EAAEC,GAEJ,MAAA,GACAP,KAAK,SACLX,QAAK1D,EAAA,qBAAA,GACLsE,uBAOT3B,IAAwBkC,KAAQlC,EAAAA,EAAAA,EAAAA,MAAmB/D,EAGhDD,WAAMmC,EACNgE,YAAYhE,EAAAA,oBAAA,CACZiE,MAAAA,EAAetE,EAAqB,OAAA,SAAAV,CAAA,IAEpC,WAAA,SACAiF,mBAAWC,GACXC,WAAAA,EACAC,iBAAYA,EAAA,OACZC,IAAAA",
6
- "names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "formatDrawerSlug", "Pill", "Thumbnail", "useConfig", "useEditDepth", "usePayloadAPI", "useTranslation", "$getNodeByKey", "$getSelection", "$isNodeSelection", "$isRangeSelection", "formatAdminURL", "isImage", "useCallback", "useEffect", "useId", "useReducer", "useRef", "useState", "initialParams", "UploadComponent", "props", "baseClass", "className", "data", "fields", "relationTo", "format", "nodeKey", "value", "config", "routes", "serverURL", "getEntityConfig", "useConfig", "useRef", "uploadRef", "uuid", "useEditorConfigContext", "editDepth", "useLexicalComposerContext", "editorConfig", "fieldProps", "isEditable", "i18n", "t", "useTranslation", "setIsSelected", "useState", "isSelected", "dispatchCacheBust", "state", "cacheBust", "useReducer", "relatedCollection", "collectionSlug", "componentID", "useId", "formatDrawerSlug", "extraFieldsDrawerSlug", "slug", "toggleDrawer", "useLexicalDrawer", "closeDocumentDrawer", "DocumentDrawer", "DocumentDrawerToggler", "useLexicalDocumentDrawer", "id", "setParams", "usePayloadAPI", "apiRoute", "api", "path", "thumbnailSRC", "useEffect", "editor", "editorState", "$getSelection", "$isNodeSelection", "selection", "nodes", "$isRangeSelection", "getNodes", "node", "outerEl", "removeUpload", "useCallback", "_data", "updateUpload", "hasExtraFields", "resolvedFeatureMap", "update", "$getNodeByKey", "uploadNode", "newData", "aspectRatio", "ref", "_jsx", "_jsxs", "Thumbnail", "fileSrc", "isImage", "height", "size", "width", "Pill", "pillStyle", "getTranslation", "labels", "buttonStyle", "disabled", "el", "icon", "onClick", "round", "tooltip", "INSERT_UPLOAD_WITH_DRAWER_COMMAND", "dispatchCommand", "replace", "Button", "e", "preventDefault", "onSave", "drawerSlug", "drawerTitle", "featureKey", "onExtraFieldsDrawerSubmit", "handleDrawerSubmit", "schemaPath", "schemaPathSuffix"]
7
- }
@@ -1,2 +0,0 @@
1
- "use client";import{a,b}from"./chunk-FEJXFRL7.js";import"./chunk-INBEEENE.js";import"./chunk-RJ5MAOKZ.js";export{b as InlineBlockComponent,a as useInlineBlockComponentContext};
2
- //# sourceMappingURL=componentInline-JJZ2NKW2.js.map
@@ -1,27 +0,0 @@
1
- import type { SerializedElementNode, SerializedLexicalNode } from 'lexical';
2
- import type { DefaultDocumentIDType, JsonValue } from 'payload';
3
- import type { StronglyTypedElementNode } from '../../../types/nodeTypes.js';
4
- export type LinkFields = {
5
- [key: string]: JsonValue;
6
- doc?: {
7
- relationTo: string;
8
- value: {
9
- [key: string]: JsonValue;
10
- id: DefaultDocumentIDType;
11
- } | DefaultDocumentIDType;
12
- } | null;
13
- linkType: 'custom' | 'internal';
14
- newTab: boolean;
15
- url?: string;
16
- };
17
- export type SerializedLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {
18
- fields: LinkFields;
19
- /**
20
- * @todo make required in 4.0 and type AutoLinkNode differently
21
- */
22
- id?: string;
23
- } & StronglyTypedElementNode<SerializedElementNode, 'link', T>;
24
- export type SerializedAutoLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {
25
- fields: LinkFields;
26
- } & StronglyTypedElementNode<SerializedElementNode, 'autolink', T>;
27
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/features/link/nodes/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAE/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAE3E,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,GAAG,CAAC,EAAE;QACJ,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EACD;YAEE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;YACxB,EAAE,EAAE,qBAAqB,CAAA;SAC1B,GACD,qBAAqB,CAAA;KAC1B,GAAG,IAAI,CAAA;IACR,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC/B,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IAAI;IACxF,MAAM,EAAE,UAAU,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,GAAG,wBAAwB,CAAC,qBAAqB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;AAE9D,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IAAI;IAC5F,MAAM,EAAE,UAAU,CAAA;CACnB,GAAG,wBAAwB,CAAC,qBAAqB,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/features/link/nodes/types.ts"],"sourcesContent":["import type { SerializedElementNode, SerializedLexicalNode } from 'lexical'\nimport type { DefaultDocumentIDType, JsonValue } from 'payload'\n\nimport type { StronglyTypedElementNode } from '../../../types/nodeTypes.js'\n\nexport type LinkFields = {\n [key: string]: JsonValue\n doc?: {\n relationTo: string\n value:\n | {\n // Actual doc data, populated in afterRead hook\n [key: string]: JsonValue\n id: DefaultDocumentIDType\n }\n | DefaultDocumentIDType\n } | null\n linkType: 'custom' | 'internal'\n newTab: boolean\n url?: string\n}\n\nexport type SerializedLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n fields: LinkFields\n /**\n * @todo make required in 4.0 and type AutoLinkNode differently\n */\n id?: string // optional if AutoLinkNode\n} & StronglyTypedElementNode<SerializedElementNode, 'link', T>\n\nexport type SerializedAutoLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n fields: LinkFields\n} & StronglyTypedElementNode<SerializedElementNode, 'autolink', T>\n"],"mappings":"AA8BA","ignoreList":[]}