@payloadcms/richtext-lexical 4.0.0-internal.c7d5de4 → 4.0.0-internal.cb69780

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 (432) hide show
  1. package/dist/exports/client/Field-TS5CRYHE.js +2 -0
  2. package/dist/exports/client/Field-TS5CRYHE.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
  5. package/dist/exports/client/{chunk-X3D4LZS7.js.map → chunk-3LRZDIIG.js.map} +4 -4
  6. package/dist/exports/client/chunk-43E5QYAA.js +2 -0
  7. package/dist/exports/client/chunk-43E5QYAA.js.map +7 -0
  8. package/dist/exports/client/{chunk-ESITTE3C.js → chunk-ZFGDYZDE.js} +2 -2
  9. package/dist/exports/client/{chunk-ESITTE3C.js.map → chunk-ZFGDYZDE.js.map} +2 -2
  10. package/dist/exports/client/component-D5QLYS7W.js +2 -0
  11. package/dist/exports/client/component-D5QLYS7W.js.map +7 -0
  12. package/dist/exports/client/componentInline-55HZXGUS.js +2 -0
  13. package/dist/exports/client/index.d.ts +1 -1
  14. package/dist/exports/client/index.d.ts.map +1 -1
  15. package/dist/exports/client/index.js +26 -26
  16. package/dist/exports/client/index.js.map +4 -4
  17. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  18. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  19. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  20. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  21. package/dist/features/blocks/client/component/index.d.ts +0 -6
  22. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  23. package/dist/features/blocks/client/component/index.js +133 -76
  24. package/dist/features/blocks/client/component/index.js.map +1 -1
  25. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  26. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  27. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  28. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  29. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  30. package/dist/features/blocks/client/componentInline/index.js +2 -2
  31. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  32. package/dist/features/blocks/server/index.js +2 -2
  33. package/dist/features/blocks/server/index.js.map +1 -1
  34. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  35. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  36. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  37. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  38. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  39. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  40. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  41. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  42. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  43. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  44. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  45. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  46. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  47. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  48. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  49. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  50. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  51. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  52. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  53. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  54. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  55. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  56. package/dist/features/debug/testRecorder/client/plugin/index.css +0 -1
  57. package/dist/features/heading/constants.d.ts +2 -0
  58. package/dist/features/heading/constants.d.ts.map +1 -0
  59. package/dist/features/heading/constants.js +2 -0
  60. package/dist/features/heading/constants.js.map +1 -0
  61. package/dist/features/heading/server/index.d.ts.map +1 -1
  62. package/dist/features/heading/server/index.js +5 -1
  63. package/dist/features/heading/server/index.js.map +1 -1
  64. package/dist/features/heading/server/validate.d.ts +6 -0
  65. package/dist/features/heading/server/validate.d.ts.map +1 -0
  66. package/dist/features/heading/server/validate.js +15 -0
  67. package/dist/features/heading/server/validate.js.map +1 -0
  68. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  69. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  70. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +1 -1
  71. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  72. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -1
  73. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  74. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  75. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  76. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  77. package/dist/features/indent/client/IndentPlugin.js +122 -1
  78. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  79. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  80. package/dist/features/indent/server/i18n.js +74 -37
  81. package/dist/features/indent/server/i18n.js.map +1 -1
  82. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  83. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +6 -3
  84. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  85. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
  86. package/dist/features/link/nodes/AutoLinkNode.d.ts +1 -1
  87. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  88. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  89. package/dist/features/link/nodes/LinkNode.d.ts +1 -1
  90. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  91. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  92. package/dist/features/link/server/index.js +2 -2
  93. package/dist/features/link/server/index.js.map +1 -1
  94. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  95. package/dist/features/lists/checklist/server/index.js +5 -2
  96. package/dist/features/lists/checklist/server/index.js.map +1 -1
  97. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  98. package/dist/features/lists/orderedList/server/index.js +5 -2
  99. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  100. package/dist/features/lists/shared/constants.d.ts +2 -0
  101. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  102. package/dist/features/lists/shared/constants.js +2 -0
  103. package/dist/features/lists/shared/constants.js.map +1 -0
  104. package/dist/features/lists/shared/validate.d.ts +5 -0
  105. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  106. package/dist/features/lists/shared/validate.js +15 -0
  107. package/dist/features/lists/shared/validate.js.map +1 -0
  108. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  109. package/dist/features/lists/unorderedList/server/index.js +5 -2
  110. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  111. package/dist/features/relationship/client/index.d.ts +2 -2
  112. package/dist/features/relationship/client/index.d.ts.map +1 -1
  113. package/dist/features/relationship/client/index.js.map +1 -1
  114. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  115. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  116. package/dist/features/relationship/client/plugins/index.js +27 -31
  117. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  118. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  119. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  120. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  121. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  122. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  123. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  124. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  125. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  126. package/dist/features/relationship/server/index.d.ts +8 -1
  127. package/dist/features/relationship/server/index.d.ts.map +1 -1
  128. package/dist/features/relationship/server/index.js +28 -11
  129. package/dist/features/relationship/server/index.js.map +1 -1
  130. package/dist/features/relationship/server/schema.d.ts +2 -2
  131. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  132. package/dist/features/relationship/server/schema.js +5 -10
  133. package/dist/features/relationship/server/schema.js.map +1 -1
  134. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  135. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  136. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  137. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  138. package/dist/features/table/client/index.d.ts.map +1 -0
  139. package/dist/features/table/client/index.js.map +1 -0
  140. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  141. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  142. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  143. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  144. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  145. package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +17 -44
  146. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  147. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  148. package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +41 -18
  149. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  150. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  151. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  152. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  153. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  154. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  155. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  156. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  157. package/dist/features/table/client/utils/debounce.js.map +1 -0
  158. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  159. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  160. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  161. package/dist/features/table/markdownTransformer.js.map +1 -0
  162. package/dist/features/table/server/index.d.ts +3 -0
  163. package/dist/features/table/server/index.d.ts.map +1 -0
  164. package/dist/features/{experimental_table → table}/server/index.js +4 -4
  165. package/dist/features/table/server/index.js.map +1 -0
  166. package/dist/features/table/server/schema.d.ts.map +1 -0
  167. package/dist/features/table/server/schema.js.map +1 -0
  168. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  169. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  170. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  171. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  172. package/dist/features/toolbars/fixed/client/Toolbar/index.css +78 -6
  173. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  174. package/dist/features/toolbars/fixed/client/Toolbar/index.js +4 -1
  175. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  176. package/dist/features/toolbars/inline/client/Toolbar/index.css +0 -1
  177. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  178. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  179. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  180. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  181. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  182. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  183. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -13
  184. package/dist/features/typesServer.d.ts +1 -1
  185. package/dist/features/typesServer.d.ts.map +1 -1
  186. package/dist/features/typesServer.js.map +1 -1
  187. package/dist/features/upload/client/component/index.js +2 -1
  188. package/dist/features/upload/client/component/index.js.map +1 -1
  189. package/dist/features/upload/client/index.d.ts +3 -2
  190. package/dist/features/upload/client/index.d.ts.map +1 -1
  191. package/dist/features/upload/client/index.js.map +1 -1
  192. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  193. package/dist/features/upload/client/plugin/index.js +47 -52
  194. package/dist/features/upload/client/plugin/index.js.map +1 -1
  195. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  196. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  197. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  198. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  199. package/dist/features/upload/server/index.d.ts +6 -2
  200. package/dist/features/upload/server/index.d.ts.map +1 -1
  201. package/dist/features/upload/server/index.js +20 -16
  202. package/dist/features/upload/server/index.js.map +1 -1
  203. package/dist/features/upload/server/schema.d.ts +2 -2
  204. package/dist/features/upload/server/schema.d.ts.map +1 -1
  205. package/dist/features/upload/server/schema.js +4 -8
  206. package/dist/features/upload/server/schema.js.map +1 -1
  207. package/dist/features/upload/server/validate.d.ts +2 -2
  208. package/dist/features/upload/server/validate.d.ts.map +1 -1
  209. package/dist/features/upload/server/validate.js +3 -0
  210. package/dist/features/upload/server/validate.js.map +1 -1
  211. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  212. package/dist/field/Diff/converters/listitem/index.js +2 -1
  213. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  214. package/dist/field/Diff/index.d.ts +3 -2
  215. package/dist/field/Diff/index.d.ts.map +1 -1
  216. package/dist/field/Diff/index.js +1 -0
  217. package/dist/field/Diff/index.js.map +1 -1
  218. package/dist/field/RenderLexical/index.d.ts +3 -1
  219. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  220. package/dist/field/RenderLexical/index.js +23 -23
  221. package/dist/field/RenderLexical/index.js.map +1 -1
  222. package/dist/field/ViewSelector.d.ts.map +1 -1
  223. package/dist/field/ViewSelector.js +1 -0
  224. package/dist/field/ViewSelector.js.map +1 -1
  225. package/dist/field/bundled.css +1 -1
  226. package/dist/field/index.css +10 -10
  227. package/dist/i18n.d.ts.map +1 -1
  228. package/dist/i18n.js +68 -0
  229. package/dist/i18n.js.map +1 -1
  230. package/dist/index.d.ts +2 -2
  231. package/dist/index.d.ts.map +1 -1
  232. package/dist/index.js +5 -5
  233. package/dist/index.js.map +1 -1
  234. package/dist/lexical/LexicalEditor.css +29 -20
  235. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  236. package/dist/lexical/LexicalEditor.js +61 -64
  237. package/dist/lexical/LexicalEditor.js.map +1 -1
  238. package/dist/lexical/config/server/loader.d.ts +1 -1
  239. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  240. package/dist/lexical/config/server/loader.js +2 -2
  241. package/dist/lexical/config/server/loader.js.map +1 -1
  242. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  243. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  244. package/dist/lexical/config/server/sanitize.js +2 -2
  245. package/dist/lexical/config/server/sanitize.js.map +1 -1
  246. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +18 -25
  247. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  248. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  249. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  250. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +0 -1
  251. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  252. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -21
  253. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  254. package/dist/lexical/plugins/SlashMenu/index.css +0 -1
  255. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
  256. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  257. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  258. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +1 -0
  259. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  260. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -2
  261. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  262. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  263. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  264. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  265. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  266. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  267. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  268. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  269. package/dist/lexical/ui/ContentEditable.css +16 -15
  270. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  271. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  272. package/dist/lexical/ui/ContentEditable.js +9 -6
  273. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  274. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  275. package/dist/lexical/ui/icons/H3/index.js +13 -6
  276. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  277. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  278. package/dist/lexical/ui/icons/H4/index.js +13 -6
  279. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  280. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  281. package/dist/lexical/ui/icons/H5/index.js +13 -6
  282. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  283. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  284. package/dist/lexical/ui/icons/H6/index.js +13 -6
  285. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  286. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
  287. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
  288. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
  289. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
  290. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
  291. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
  292. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
  293. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
  294. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
  295. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
  296. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
  297. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
  298. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
  299. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
  300. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
  301. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
  302. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
  303. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
  304. package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
  305. package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
  306. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
  307. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
  308. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
  309. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
  310. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
  311. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
  312. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
  313. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
  314. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
  315. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
  316. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
  317. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
  318. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
  319. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
  320. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
  321. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
  322. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
  323. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
  324. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
  325. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
  326. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
  327. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
  328. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
  329. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
  330. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
  331. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
  332. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
  333. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
  334. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
  335. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
  336. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
  337. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
  338. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
  339. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
  340. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
  341. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
  342. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
  343. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
  344. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
  345. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
  346. package/dist/types/index.d.ts +1 -1
  347. package/dist/types/index.d.ts.map +1 -1
  348. package/dist/types/index.js.map +1 -1
  349. package/dist/types/nodeTypes.d.ts +1 -1
  350. package/dist/types/nodeTypes.d.ts.map +1 -1
  351. package/dist/types/nodeTypes.js.map +1 -1
  352. package/dist/utilities/createServerFeature.d.ts +1 -1
  353. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  354. package/dist/utilities/createServerFeature.js +2 -2
  355. package/dist/utilities/createServerFeature.js.map +1 -1
  356. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  357. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  358. package/dist/utilities/editorConfigFactory.js +9 -9
  359. package/dist/utilities/editorConfigFactory.js.map +1 -1
  360. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  361. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  362. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  363. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  364. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  365. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  366. package/package.json +97 -23
  367. package/dist/dependencyChecker.spec.js +0 -16
  368. package/dist/dependencyChecker.spec.js.map +0 -1
  369. package/dist/exports/client/Field-QGSHF22S.js +0 -2
  370. package/dist/exports/client/Field-QGSHF22S.js.map +0 -7
  371. package/dist/exports/client/chunk-UD4DQ4AK.js +0 -2
  372. package/dist/exports/client/chunk-UD4DQ4AK.js.map +0 -7
  373. package/dist/exports/client/chunk-X3D4LZS7.js +0 -2
  374. package/dist/exports/client/component-PHZQBOJE.js +0 -2
  375. package/dist/exports/client/component-PHZQBOJE.js.map +0 -7
  376. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  377. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  378. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  379. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  380. package/dist/features/experimental_table/client/index.js.map +0 -1
  381. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  382. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  383. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  384. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  385. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  386. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  387. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  388. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  389. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  390. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  391. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  392. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  393. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  394. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  395. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  396. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  397. package/dist/features/experimental_table/server/index.d.ts +0 -3
  398. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  399. package/dist/features/experimental_table/server/index.js.map +0 -1
  400. package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
  401. package/dist/features/experimental_table/server/schema.js.map +0 -1
  402. package/dist/features/link/markdownTransformer.spec.js +0 -195
  403. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  404. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  405. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  406. package/dist/lexical/utils/url.spec.js +0 -114
  407. package/dist/lexical/utils/url.spec.js.map +0 -1
  408. package/dist/utilities/jsx/jsx.spec.js +0 -178
  409. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  410. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-55HZXGUS.js.map} +0 -0
  411. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  412. /package/dist/features/{experimental_table → table}/client/index.js +0 -0
  413. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +0 -0
  414. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  415. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  416. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  417. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  418. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  419. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -0
  420. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  421. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  422. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  423. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  424. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
  425. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  426. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  427. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  428. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
  429. /package/dist/features/{experimental_table → table}/markdownTransformer.d.ts +0 -0
  430. /package/dist/features/{experimental_table → table}/markdownTransformer.js +0 -0
  431. /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
  432. /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
@@ -0,0 +1,11 @@
1
+ import type { LexicalEditor } from 'lexical';
2
+ import type { ReactNode } from 'react';
3
+ import { useBlockReordering } from '../useBlockReordering.js';
4
+ export declare function BlockReordering({ children, editor, nodeKey, }: {
5
+ children: (props: {
6
+ reorderInstructionsID: string;
7
+ } & ReturnType<typeof useBlockReordering>) => ReactNode;
8
+ editor: LexicalEditor;
9
+ nodeKey: string;
10
+ }): ReactNode;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/blocks/client/component/BlockReordering/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAE7D,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,MAAM,EACN,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,CACR,KAAK,EAAE;QAAE,qBAAqB,EAAE,MAAM,CAAA;KAAE,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,KAC7E,SAAS,CAAA;IACd,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;CAChB,aAKA"}
@@ -0,0 +1,18 @@
1
+ import { useId } from 'react';
2
+ import { useBlockReordering } from '../useBlockReordering.js';
3
+ export function BlockReordering({
4
+ children,
5
+ editor,
6
+ nodeKey
7
+ }) {
8
+ const reorder = useBlockReordering({
9
+ editor,
10
+ nodeKey
11
+ });
12
+ const reorderInstructionsID = useId();
13
+ return children({
14
+ ...reorder,
15
+ reorderInstructionsID
16
+ });
17
+ }
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["useId","useBlockReordering","BlockReordering","children","editor","nodeKey","reorder","reorderInstructionsID"],"sources":["../../../../../../src/features/blocks/client/component/BlockReordering/index.tsx"],"sourcesContent":["import type { LexicalEditor } from 'lexical'\nimport type { ReactNode } from 'react'\n\nimport { useId } from 'react'\n\nimport { useBlockReordering } from '../useBlockReordering.js'\n\nexport function BlockReordering({\n children,\n editor,\n nodeKey,\n}: {\n children: (\n props: { reorderInstructionsID: string } & ReturnType<typeof useBlockReordering>,\n ) => ReactNode\n editor: LexicalEditor\n nodeKey: string\n}) {\n const reorder = useBlockReordering({ editor, nodeKey })\n const reorderInstructionsID = useId()\n\n return children({ ...reorder, reorderInstructionsID })\n}\n"],"mappings":"AAGA,SAASA,KAAK,QAAQ;AAEtB,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,SAASC,gBAAgB;EAC9BC,QAAQ;EACRC,MAAM;EACNC;AAAO,CAOR;EACC,MAAMC,OAAA,GAAUL,kBAAA,CAAmB;IAAEG,MAAA;IAAQC;EAAQ;EACrD,MAAME,qBAAA,GAAwBP,KAAA;EAE9B,OAAOG,QAAA,CAAS;IAAE,GAAGG,OAAO;IAAEC;EAAsB;AACtD","ignoreList":[]}
@@ -21,13 +21,7 @@ export type BlockComponentProps<TFormData extends Record<string, unknown> = Bloc
21
21
  * Will be rendered with useBlockComponentContext hook.
22
22
  */
23
23
  readonly CustomLabel?: React.FC<ViewMapBlockComponentProps>;
24
- /**
25
- * The block's form data (field values).
26
- */
27
24
  readonly formData: TFormData;
28
- /**
29
- * The unique key identifying this block node in the current editor instance.
30
- */
31
25
  readonly nodeKey: string;
32
26
  };
33
27
  export declare const BlockComponent: React.FC<BlockComponentProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAkD,MAAM,OAAO,CAAA;AAGtE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,aAAa,CAAA;AACpB,OAAO,8CAA8C,CAAA;AAerD,MAAM,MAAM,mBAAmB,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,IAAI;IACzF;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAA;IAC3D;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAA;IAC3D;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA0uBxD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAkD,MAAM,OAAO,CAAA;AAGtE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,aAAa,CAAA;AACpB,OAAO,8CAA8C,CAAA;AAgBrD,MAAM,MAAM,mBAAmB,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,IAAI;IACzF;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAA;IAC3D;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAA;IAC3D,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA6yBxD,CAAA"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
4
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
5
5
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
6
6
  import { getTranslation } from '@payloadcms/translations';
@@ -17,6 +17,7 @@ import { RegisterFormSubmit, useDrawerSubmit } from '../../../../utilities/field
17
17
  import { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js';
18
18
  import { $isBlockNode } from '../nodes/BlocksNode.js';
19
19
  import { BlockContent, useBlockComponentContext } from './BlockContent.js';
20
+ import { BlockReordering } from './BlockReordering/index.js';
20
21
  import { removeEmptyArrayValues } from './removeEmptyArrayValues.js';
21
22
  export const BlockComponent = props => {
22
23
  const {
@@ -68,6 +69,11 @@ export const BlockComponent = props => {
68
69
  const [editor] = useLexicalComposerContext();
69
70
  const isEditable = useLexicalEditable();
70
71
  const blockType = formData.blockType;
72
+ const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`;
73
+ const clientSchemaMap = featureClientSchemaMap['blocks'];
74
+ const blocksField = clientSchemaMap?.[componentMapRenderedBlockPath]?.[0];
75
+ const blockOrSlug = blocksField?.blocks?.[0];
76
+ const clientBlock = typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug;
71
77
  const {
72
78
  getFormState
73
79
  } = useServerFunctions();
@@ -217,19 +223,14 @@ export const BlockComponent = props => {
217
223
  }
218
224
  }
219
225
  };
220
- if (formData && !initialState) {
226
+ if (clientBlock && formData && !initialState) {
221
227
  void awaitInitialState();
222
228
  }
223
229
  return () => {
224
230
  abortAndIgnore(abortController);
225
231
  };
226
- }, [getFormState, schemaFieldsPath, isEditable, id, CustomLabelFromProps, CustomBlockFromProps, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields, blockType]);
232
+ }, [getFormState, schemaFieldsPath, isEditable, id, CustomLabelFromProps, CustomBlockFromProps, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields, blockType, clientBlock]);
227
233
  const [isCollapsed, setIsCollapsed] = React.useState(initialLexicalFormState?.[formData.id]?.collapsed ?? false);
228
- const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`;
229
- const clientSchemaMap = featureClientSchemaMap['blocks'];
230
- const blocksField = clientSchemaMap?.[componentMapRenderedBlockPath]?.[0];
231
- const blockOrSlug = blocksField?.blocks?.[0];
232
- const clientBlock = typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug;
233
234
  const {
234
235
  i18n,
235
236
  t
@@ -394,7 +395,7 @@ export const BlockComponent = props => {
394
395
  round: true,
395
396
  tooltip: "Remove Block"
396
397
  }), [baseClass, isEditable, removeBlock]);
397
- const BlockCollapsible = useMemo(() => ({
398
+ const BlockCollapsible = useMemo(() => function BlockCollapsible({
398
399
  Actions,
399
400
  children: children_0,
400
401
  className,
@@ -408,77 +409,133 @@ export const BlockComponent = props => {
408
409
  removeButton,
409
410
  showDragHandle = true,
410
411
  showRowNumber = true
411
- }) => {
412
- return /*#__PURE__*/_jsx("div", {
413
- className: `${baseClass}__container ${baseClass}-${blockType}`,
414
- children: /*#__PURE__*/_jsx(Collapsible, {
415
- actions: typeof Actions !== 'undefined' ? Actions : isEditable ? /*#__PURE__*/_jsx(Popup, {
416
- button: /*#__PURE__*/_jsx(MoreIcon, {}),
417
- buttonClassName: `${baseClass}__actions-button`,
418
- caret: false,
419
- horizontalAlign: "right",
420
- render: ({
421
- close
422
- }) => /*#__PURE__*/_jsxs(PopupList.ButtonGroup, {
423
- buttonSize: "medium",
424
- children: [(resolvedCustomBlock && editButton !== false || !resolvedCustomBlock && editButton) && /*#__PURE__*/_jsx(PopupList.Button, {
425
- onClick: () => {
426
- toggleDrawer();
427
- close();
428
- },
429
- children: t('general:edit')
430
- }), removeButton !== false && /*#__PURE__*/_jsxs(PopupList.Button, {
431
- onClick: () => {
432
- removeBlock();
433
- close();
434
- },
435
- children: [/*#__PURE__*/_jsx(XIcon, {}), t('general:remove')]
436
- })]
412
+ }) {
413
+ return /*#__PURE__*/_jsx(BlockReordering, {
414
+ editor: editor,
415
+ nodeKey: nodeKey,
416
+ children: ({
417
+ isReordering,
418
+ move,
419
+ onBlur,
420
+ onKeyDown,
421
+ reorderInstructionsID,
422
+ targetIndex
423
+ }) => /*#__PURE__*/_jsx("div", {
424
+ className: `${baseClass}__container ${baseClass}-${blockType}`,
425
+ onKeyDownCapture: event => {
426
+ const target = event.target;
427
+ if (event.altKey || event.ctrlKey || event.metaKey || target.closest('.collapsible')?.parentElement !== event.currentTarget) {
428
+ return;
429
+ }
430
+ // Handle controls before Lexical consumes keys using its retained text selection.
431
+ if (target.matches('.collapsible__drag') && (event.key !== 'Escape' || isReordering) && [' ', 'ArrowDown', 'ArrowUp', 'Enter', 'Escape', 'Tab'].includes(event.key)) {
432
+ onKeyDown(event);
433
+ event.stopPropagation();
434
+ } else if (event.key === 'Tab' && target.matches('.collapsible__toggle')) {
435
+ event.stopPropagation();
436
+ }
437
+ },
438
+ children: /*#__PURE__*/_jsxs(Collapsible, {
439
+ actions: typeof Actions !== 'undefined' ? Actions : isEditable ? /*#__PURE__*/_jsx(Popup, {
440
+ button: /*#__PURE__*/_jsx(MoreIcon, {}),
441
+ buttonClassName: `${baseClass}__actions-button`,
442
+ caret: false,
443
+ horizontalAlign: "right",
444
+ popupType: "menu",
445
+ render: ({
446
+ close
447
+ }) => /*#__PURE__*/_jsxs(PopupList.ButtonGroup, {
448
+ buttonSize: "medium",
449
+ children: [/*#__PURE__*/_jsx(PopupList.Button, {
450
+ onClick: () => {
451
+ close();
452
+ move({
453
+ direction: -1
454
+ });
455
+ },
456
+ children: t('general:moveUp')
457
+ }), /*#__PURE__*/_jsx(PopupList.Button, {
458
+ onClick: () => {
459
+ close();
460
+ move({
461
+ direction: 1
462
+ });
463
+ },
464
+ children: t('general:moveDown')
465
+ }), (resolvedCustomBlock && editButton !== false || !resolvedCustomBlock && editButton) && /*#__PURE__*/_jsx(PopupList.Button, {
466
+ onClick: () => {
467
+ toggleDrawer();
468
+ close();
469
+ },
470
+ children: t('general:edit')
471
+ }), removeButton !== false && /*#__PURE__*/_jsxs(PopupList.Button, {
472
+ onClick: () => {
473
+ removeBlock();
474
+ close();
475
+ },
476
+ children: [/*#__PURE__*/_jsx(XIcon, {}), t('general:remove')]
477
+ })]
478
+ }),
479
+ size: "large"
480
+ }) : null,
481
+ className: [`${baseClass}__row`, fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`, className].filter(Boolean).join(' '),
482
+ collapsibleStyle: fieldHasErrors ? 'error' : 'default',
483
+ dragHandleProps: showDragHandle && isEditable ? {
484
+ id: nodeKey,
485
+ attributes: {
486
+ 'aria-describedby': reorderInstructionsID,
487
+ 'aria-pressed': isReordering,
488
+ role: 'button',
489
+ tabIndex: 0
490
+ },
491
+ listeners: {
492
+ onBlur
493
+ }
494
+ } : undefined,
495
+ header: /*#__PURE__*/_jsx("div", {
496
+ className: `${baseClass}__block-header`,
497
+ children: typeof Label !== 'undefined' ? Label : typeof resolvedCustomLabel !== 'undefined' ? resolvedCustomLabel : /*#__PURE__*/_jsxs("div", {
498
+ className: `${baseClass}__block-label`,
499
+ children: [showRowNumber && /*#__PURE__*/_jsx("span", {
500
+ className: `${baseClass}__block-number`,
501
+ children: String(rowIndex + 1).padStart(2, '0')
502
+ }), typeof CustomPill !== 'undefined' ? CustomPill : /*#__PURE__*/_jsx(Pill, {
503
+ className: `${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`,
504
+ pillStyle: "white",
505
+ size: "small",
506
+ children: blockDisplayName ?? blockType
507
+ }), !disableBlockName && !clientBlock?.admin?.disableBlockName && /*#__PURE__*/_jsx(SectionTitle, {
508
+ path: "blockName",
509
+ readOnly: !isEditable
510
+ }), fieldHasErrors && /*#__PURE__*/_jsx(ErrorPill, {
511
+ count: errorCount_0 ?? 0,
512
+ i18n: i18n,
513
+ withMessage: true
514
+ })]
515
+ })
437
516
  }),
438
- size: "large"
439
- }) : null,
440
- className: [`${baseClass}__row`, fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`, className].filter(Boolean).join(' '),
441
- collapsibleStyle: fieldHasErrors ? 'error' : 'default',
442
- dragHandleProps: showDragHandle ? {
443
- id: nodeKey,
444
- attributes: {
445
- role: 'button',
446
- tabIndex: 0
517
+ isCollapsed: isCollapsed,
518
+ onToggle: incomingCollapsedState => {
519
+ onCollapsedChange(incomingCollapsedState);
520
+ setIsCollapsed(incomingCollapsedState);
447
521
  },
448
- listeners: {}
449
- } : undefined,
450
- header: /*#__PURE__*/_jsx("div", {
451
- className: `${baseClass}__block-header`,
452
- children: typeof Label !== 'undefined' ? Label : typeof resolvedCustomLabel !== 'undefined' ? resolvedCustomLabel : /*#__PURE__*/_jsxs("div", {
453
- className: `${baseClass}__block-label`,
454
- children: [showRowNumber && /*#__PURE__*/_jsx("span", {
455
- className: `${baseClass}__block-number`,
456
- children: String(rowIndex + 1).padStart(2, '0')
457
- }), typeof CustomPill !== 'undefined' ? CustomPill : /*#__PURE__*/_jsx(Pill, {
458
- className: `${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`,
459
- pillStyle: "white",
460
- size: "small",
461
- children: blockDisplayName ?? blockType
462
- }), !disableBlockName && !clientBlock?.admin?.disableBlockName && /*#__PURE__*/_jsx(SectionTitle, {
463
- path: "blockName",
464
- readOnly: !isEditable
465
- }), fieldHasErrors && /*#__PURE__*/_jsx(ErrorPill, {
466
- count: errorCount_0 ?? 0,
467
- i18n: i18n,
468
- withMessage: true
522
+ ...(collapsibleProps || {}),
523
+ AfterCollapsible: /*#__PURE__*/_jsxs(_Fragment, {
524
+ children: [collapsibleProps?.AfterCollapsible, /*#__PURE__*/_jsx("span", {
525
+ className: "sr-only",
526
+ role: "status",
527
+ children: isReordering ? `${t('general:order')}: ${(targetIndex ?? 0) + 1}` : ''
469
528
  })]
470
- })
471
- }),
472
- isCollapsed: isCollapsed,
473
- onToggle: incomingCollapsedState => {
474
- onCollapsedChange(incomingCollapsedState);
475
- setIsCollapsed(incomingCollapsedState);
476
- },
477
- ...(collapsibleProps || {}),
478
- children: children_0
479
- }, 0)
529
+ }),
530
+ children: [/*#__PURE__*/_jsxs("span", {
531
+ className: "sr-only",
532
+ id: reorderInstructionsID,
533
+ children: ["Space / Enter · ", t('general:moveUp'), " ↑ · ", t('general:moveDown'), " ↓ ·", ' ', t('general:cancel'), " Escape"]
534
+ }), children_0]
535
+ }, 0)
536
+ })
480
537
  });
481
- }, [resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, i18n, isCollapsed, onCollapsedChange, isEditable, nodeKey, removeBlock, rowIndex, t, toggleDrawer]);
538
+ }, [editor, resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, i18n, isCollapsed, onCollapsedChange, isEditable, nodeKey, removeBlock, rowIndex, t, toggleDrawer]);
482
539
  const blockID = formData?.id;
483
540
  const {
484
541
  headerActions,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Collapsible","Drawer","EditDepthProvider","ErrorPill","Form","formatDrawerSlug","MoreIcon","Pill","Popup","PopupList","RenderFields","SectionTitle","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useFormSubmitted","useServerFunctions","useTranslation","XIcon","abortAndIgnore","$getNodeByKey","$getRoot","SKIP_DOM_SELECTION_TAG","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","RegisterFormSubmit","useDrawerSubmit","useLexicalDrawer","$isBlockNode","BlockContent","useBlockComponentContext","removeEmptyArrayValues","BlockComponent","props","cacheBuster","className","baseClass","CustomBlock","CustomBlockFromProps","CustomLabel","CustomLabelFromProps","formData","nodeKey","submitted","id","collectionSlug","globalSlug","fieldProps","featureClientSchemaMap","field","parentLexicalRichTextField","initialLexicalFormState","schemaPath","uuidFromContext","fields","parentDocumentFields","onChangeAbortControllerRef","AbortController","editDepth","errorCount","setErrorCount","useState","config","drawerSlug","slug","depth","toggleDrawer","getDocPreferences","setDocFieldPreferences","editor","isEditable","blockType","getFormState","schemaFieldsPath","initialState","setInitialState","cachedFormState","formState","mergedState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","blockName","passesCondition","valid","hasMounted","prevCacheBuster","current","formUuid","setCustomLabel","undefined","customComponents","BlockLabel","setCustomBlock","Block","resolvedCustomBlock","_jsx","isEditor","isJSXConverter","resolvedCustomLabel","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","excludeFiles","initialBlockData","operation","readOnly","renderAllFields","signal","newFormStateData","update","node","newData","setFields","tag","_components","isCollapsed","setIsCollapsed","collapsed","componentMapRenderedBlockPath","clientSchemaMap","blocksField","blockOrSlug","blocks","clientBlock","blocksMap","i18n","t","onChange","prevFormState","submit","controller","newFormState","initialBlockFormState","setTimeout","rowErrorCount","formField","values","removeBlock","remove","rowIndex","setRowIndex","updateIndex","getEditorState","read","root","children","getChildren","blockCount","child","getKey","registerUpdateListener","blockDisplayName","labels","singular","onCollapsedChange","changedCollapsed","then","currentDocPreferences","currentFieldPreferences","name","collapsedArray","newCollapsed","length","includes","push","splice","indexOf","hello","EditButton","buttonStyle","disabled","el","icon","onClick","e","preventDefault","stopPropagation","onMouseDown","round","size","tooltip","label","RemoveButton","BlockCollapsible","Actions","collapsibleProps","disableBlockName","editButton","fieldHasErrors","Label","CustomPill","removeButton","showDragHandle","showRowNumber","actions","button","buttonClassName","caret","horizontalAlign","render","close","_jsxs","ButtonGroup","buttonSize","filter","Boolean","join","collapsibleStyle","dragHandleProps","attributes","role","tabIndex","listeners","header","String","padStart","pillStyle","admin","path","count","withMessage","onToggle","incomingCollapsedState","blockID","headerActions","submitRef","BlockDrawer","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","style","display","beforeSubmit","onSubmit","formSchema"],"sources":["../../../../../src/features/blocks/client/component/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Collapsible,\n Drawer,\n EditDepthProvider,\n ErrorPill,\n Form,\n formatDrawerSlug,\n MoreIcon,\n Pill,\n Popup,\n PopupList,\n RenderFields,\n SectionTitle,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useFormSubmitted,\n useServerFunctions,\n useTranslation,\n XIcon,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, $getRoot, SKIP_DOM_SELECTION_TAG } from 'lexical'\nimport {\n type BlocksFieldClient,\n type ClientBlock,\n type CollapsedPreferences,\n type FormState,\n} from 'payload'\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapBlockComponentProps } from '../../../../types/index.js'\nimport type { BlockFields } from '../../server/schema.js'\n\nimport './index.css'\nimport '../../../../utilities/fieldsDrawer/index.css'\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport {\n RegisterFormSubmit,\n useDrawerSubmit,\n} from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isBlockNode } from '../nodes/BlocksNode.js'\nimport {\n type BlockCollapsibleWithErrorProps,\n BlockContent,\n useBlockComponentContext,\n} from './BlockContent.js'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\nexport type BlockComponentProps<TFormData extends Record<string, unknown> = BlockFields> = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly className: string\n /**\n * Custom block component from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomBlock?: React.FC<ViewMapBlockComponentProps>\n /**\n * Custom block label from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomLabel?: React.FC<ViewMapBlockComponentProps>\n /**\n * The block's form data (field values).\n */\n readonly formData: TFormData\n /**\n * The unique key identifying this block node in the current editor instance.\n */\n readonly nodeKey: string\n}\n\nexport const BlockComponent: React.FC<BlockComponentProps> = (props) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const submitted = useFormSubmitted()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const {\n fieldProps: {\n featureClientSchemaMap,\n field: parentLexicalRichTextField,\n initialLexicalFormState,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n\n const { fields: parentDocumentFields } = useDocumentForm()\n const onChangeAbortControllerRef = useRef(new AbortController())\n const editDepth = useEditDepth()\n const [errorCount, setErrorCount] = React.useState(0)\n\n const { config } = useConfig()\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-blocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug)\n\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const blockType = formData.blockType\n\n const { getFormState } = useServerFunctions()\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}.fields`\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 const mergedState = 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 // Manually add blockName, as it's not part of cachedFormState\n mergedState.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n return mergedState\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 (CustomBlockFromProps/CustomLabelFromProps),\n // we render them directly with formData instead, so these states are unused.\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 // When viewMap components exist, render directly with formData (always current from\n // the lexical node). When they don't, fall back to server-rendered state.\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 useBlockComponentContext={useBlockComponentContext}\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 useBlockComponentContext={useBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\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 operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n state.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as BlockFields\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 && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = 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 ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state._components?.customComponents?.Block ?? undefined)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n isEditable,\n id,\n CustomLabelFromProps,\n CustomBlockFromProps,\n formData,\n editor,\n nodeKey,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n blockType,\n ])\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(\n initialLexicalFormState?.[formData.id]?.collapsed ?? false,\n )\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient | undefined\n\n const blockOrSlug = blocksField?.blocks?.[0]\n const clientBlock: ClientBlock | undefined =\n typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug\n\n const { i18n, t } = useTranslation<object, string>()\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: newFormState } = 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 (!newFormState) {\n return prevFormState\n }\n\n if (prevFormState.blockName) {\n newFormState.blockName = prevFormState.blockName\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n removeEmptyArrayValues({\n fields: deepCopyObjectSimpleWithoutReactComponents(newFormState, { excludeFiles: true }),\n }),\n true,\n ) as BlockFields\n\n setTimeout(() => {\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\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 }, 0)\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined)\n }\n\n let rowErrorCount = 0\n for (const formField of Object.values(newFormState)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n\n return newFormState\n },\n\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n blockType,\n parentDocumentFields,\n isEditable,\n editor,\n nodeKey,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const [rowIndex, setRowIndex] = React.useState<number>(0)\n\n useEffect(() => {\n const updateIndex = () => {\n editor.getEditorState().read(() => {\n const root = $getRoot()\n const children = root.getChildren()\n let blockCount = 0\n for (const child of children) {\n if ($isBlockNode(child)) {\n if (child.getKey() === nodeKey) {\n setRowIndex(blockCount)\n return\n }\n blockCount++\n }\n }\n })\n }\n updateIndex()\n return editor.registerUpdateListener(() => {\n updateIndex()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences =\n currentDocPreferences?.fields?.[parentLexicalRichTextField.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(parentLexicalRichTextField.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, parentLexicalRichTextField.name, setDocFieldPreferences, formData.id],\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={(e) => {\n e.preventDefault()\n e.stopPropagation()\n toggleDrawer()\n return false\n }}\n onMouseDown={(e) => {\n // Needed to preserve lexical selection for toggleDrawer lexical selection restore.\n // I believe this is needed due to this button (usually) being inside of a collapsible.\n e.preventDefault()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, isEditable, t, blockDisplayName, toggleDrawer],\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 removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n ),\n [baseClass, isEditable, removeBlock],\n )\n\n const BlockCollapsible = useMemo(\n () =>\n ({\n Actions,\n children,\n className,\n collapsibleProps,\n disableBlockName,\n editButton,\n errorCount,\n fieldHasErrors,\n Label,\n Pill: CustomPill,\n removeButton,\n showDragHandle = true,\n showRowNumber = true,\n }: BlockCollapsibleWithErrorProps) => {\n return (\n <div className={`${baseClass}__container ${baseClass}-${blockType}`}>\n <Collapsible\n actions={\n typeof Actions !== 'undefined' ? (\n Actions\n ) : isEditable ? (\n <Popup\n button={<MoreIcon />}\n buttonClassName={`${baseClass}__actions-button`}\n caret={false}\n horizontalAlign=\"right\"\n render={({ close }) => (\n <PopupList.ButtonGroup buttonSize=\"medium\">\n {((resolvedCustomBlock && editButton !== false) ||\n (!resolvedCustomBlock && editButton)) && (\n <PopupList.Button\n onClick={() => {\n toggleDrawer()\n close()\n }}\n >\n {t('general:edit')}\n </PopupList.Button>\n )}\n {removeButton !== false && (\n <PopupList.Button\n onClick={() => {\n removeBlock()\n close()\n }}\n >\n <XIcon />\n {t('general:remove')}\n </PopupList.Button>\n )}\n </PopupList.ButtonGroup>\n )}\n size=\"large\"\n />\n ) : null\n }\n className={[\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n dragHandleProps={\n showDragHandle\n ? {\n id: nodeKey,\n attributes: { role: 'button', tabIndex: 0 },\n listeners: {},\n }\n : undefined\n }\n header={\n <div className={`${baseClass}__block-header`}>\n {typeof Label !== 'undefined' ? (\n Label\n ) : typeof resolvedCustomLabel !== 'undefined' ? (\n resolvedCustomLabel\n ) : (\n <div className={`${baseClass}__block-label`}>\n {showRowNumber && (\n <span className={`${baseClass}__block-number`}>\n {String(rowIndex + 1).padStart(2, '0')}\n </span>\n )}\n {typeof CustomPill !== 'undefined' ? (\n CustomPill\n ) : (\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`}\n pillStyle=\"white\"\n size=\"small\"\n >\n {blockDisplayName ?? blockType}\n </Pill>\n )}\n {!disableBlockName && !clientBlock?.admin?.disableBlockName && (\n <SectionTitle path=\"blockName\" readOnly={!isEditable} />\n )}\n\n {fieldHasErrors && (\n <ErrorPill count={errorCount ?? 0} i18n={i18n} withMessage />\n )}\n </div>\n )}\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n {...(collapsibleProps || {})}\n >\n {children}\n </Collapsible>\n </div>\n )\n },\n [\n resolvedCustomBlock,\n resolvedCustomLabel,\n blockDisplayName,\n baseClass,\n clientBlock?.admin?.disableBlockName,\n blockType,\n i18n,\n isCollapsed,\n onCollapsedChange,\n isEditable,\n nodeKey,\n removeBlock,\n rowIndex,\n t,\n toggleDrawer,\n ],\n )\n\n const blockID = formData?.id\n\n const { headerActions, submitRef } = useDrawerSubmit()\n\n const BlockDrawer = useMemo(\n () => () => (\n <EditDepthProvider>\n <Drawer\n className={''}\n headerActions={headerActions}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${blockID ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <div className=\"fields-drawer\">\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 <RegisterFormSubmit submitRef={submitRef} />\n </div>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n ),\n [\n initialState,\n drawerSlug,\n blockID,\n blockDisplayName,\n t,\n isEditable,\n clientBlock?.fields,\n schemaFieldsPath,\n headerActions,\n submitRef,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\n ],\n )\n\n // Memoized Form JSX\n const Block = useMemo(() => {\n if (!initialState) {\n return null\n }\n return (\n <div data-block-drawer-slug={drawerSlug} style={{ display: 'contents' }}>\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n return await onChange({ formState, submit: true })\n },\n ]}\n el=\"div\"\n fields={clientBlock?.fields ?? []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={(formState, newData) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n newData.blockType = blockType\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n node.setFields(newData as BlockFields, 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 toggleDrawer()\n }}\n submitted={submitted}\n uuid={formUuid}\n >\n <BlockContent\n baseClass={baseClass}\n BlockDrawer={BlockDrawer}\n Collapsible={BlockCollapsible}\n CustomBlock={resolvedCustomBlock}\n CustomLabel={resolvedCustomLabel}\n EditButton={EditButton}\n errorCount={errorCount}\n formSchema={clientBlock?.fields ?? []}\n initialState={initialState}\n nodeKey={nodeKey}\n RemoveButton={RemoveButton}\n />\n </Form>\n </div>\n )\n }, [\n BlockCollapsible,\n BlockDrawer,\n resolvedCustomBlock,\n resolvedCustomLabel,\n blockType,\n drawerSlug,\n RemoveButton,\n EditButton,\n baseClass,\n editor,\n errorCount,\n toggleDrawer,\n clientBlock?.fields,\n formUuid,\n initialState,\n nodeKey,\n onChange,\n submitted,\n ])\n\n if (!clientBlock) {\n return (\n <BlockCollapsible disableBlockName={true} fieldHasErrors={true}>\n <div className={`${baseClass}-not-found`}>\n Error: Block '{blockType}' not found in the config but exists in the lexical data\n </div>\n </BlockCollapsible>\n )\n }\n\n return Block\n}\n"],"mappings":"AAAA;;;AAEA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,iBAAiB,EACjBC,SAAS,EACTC,IAAI,EACJC,gBAAgB,EAChBC,QAAQ,EACRC,IAAI,EACJC,KAAK,EACLC,SAAS,EACTC,YAAY,EACZC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,gBAAgB,EAChBC,kBAAkB,EAClBC,cAAc,EACdC,KAAK,QACA;AACP,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,EAAEC,QAAQ,EAAEC,sBA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IAAA,CAACxE,YAAA;UACCO,SAAA,EAAWA,SAAA;UACXwM,WAAA,EAAaA,WAAA;UACbrP,WAAA,EAAa0M,gBAAA;UACb5J,WAAA,EAAa+D,mBAAA;UACb7D,WAAA,EAAaiE,mBAAA;UACb0E,UAAA,EAAYA,UAAA;UACZvH,UAAA,EAAYA,UAAA;UACZ4L,UAAA,EAAYlH,WAAA,EAAa/E,MAAA,IAAU,EAAE;UACrCoB,YAAA,EAAcA,YAAA;UACdhC,OAAA,EAASA,OAAA;UACTsJ,YAAA,EAAcA;;;;EAKxB,GAAG,CACDC,gBAAA,EACA2C,WAAA,EACAxI,mBAAA,EACAI,mBAAA,EACAjC,SAAA,EACAR,UAAA,EACAiI,YAAA,EACAd,UAAA,EACA9I,SAAA,EACAiC,MAAA,EACAV,UAAA,EACAO,YAAA,EACAmE,WAAA,EAAa/E,MAAA,EACbuC,QAAA,EACAnB,YAAA,EACAhC,OAAA,EACA+F,QAAA,EACA9F,SAAA,CACD;EAED,IAAI,CAAC0F,WAAA,EAAa;IAChB,oBACEhC,IAAA,CAAC4F,gBAAA;MAAiBG,gBAAA,EAAkB;MAAME,cAAA,EAAgB;gBACxD,aAAAa,KAAA,CAAC;QAAIhL,SAAA,EAAW,GAAGC,SAAA,YAAqB;mBAAE,kBACzBmC,SAAA,EAAU;;;EAIjC;EAEA,OAAO4B,KAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Collapsible","Drawer","EditDepthProvider","ErrorPill","Form","formatDrawerSlug","MoreIcon","Pill","Popup","PopupList","RenderFields","SectionTitle","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useFormSubmitted","useServerFunctions","useTranslation","XIcon","abortAndIgnore","$getNodeByKey","$getRoot","SKIP_DOM_SELECTION_TAG","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","RegisterFormSubmit","useDrawerSubmit","useLexicalDrawer","$isBlockNode","BlockContent","useBlockComponentContext","BlockReordering","removeEmptyArrayValues","BlockComponent","props","cacheBuster","className","baseClass","CustomBlock","CustomBlockFromProps","CustomLabel","CustomLabelFromProps","formData","nodeKey","submitted","id","collectionSlug","globalSlug","fieldProps","featureClientSchemaMap","field","parentLexicalRichTextField","initialLexicalFormState","schemaPath","uuidFromContext","fields","parentDocumentFields","onChangeAbortControllerRef","AbortController","editDepth","errorCount","setErrorCount","useState","config","drawerSlug","slug","depth","toggleDrawer","getDocPreferences","setDocFieldPreferences","editor","isEditable","blockType","componentMapRenderedBlockPath","clientSchemaMap","blocksField","blockOrSlug","blocks","clientBlock","blocksMap","getFormState","schemaFieldsPath","initialState","setInitialState","cachedFormState","formState","mergedState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","blockName","passesCondition","valid","hasMounted","prevCacheBuster","current","formUuid","setCustomLabel","undefined","customComponents","BlockLabel","setCustomBlock","Block","resolvedCustomBlock","_jsx","isEditor","isJSXConverter","resolvedCustomLabel","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","excludeFiles","initialBlockData","operation","readOnly","renderAllFields","signal","newFormStateData","update","node","newData","setFields","tag","_components","isCollapsed","setIsCollapsed","collapsed","i18n","t","onChange","prevFormState","submit","controller","newFormState","initialBlockFormState","setTimeout","rowErrorCount","formField","values","removeBlock","remove","rowIndex","setRowIndex","updateIndex","getEditorState","read","root","children","getChildren","blockCount","child","getKey","registerUpdateListener","blockDisplayName","labels","singular","onCollapsedChange","changedCollapsed","then","currentDocPreferences","currentFieldPreferences","name","collapsedArray","newCollapsed","length","includes","push","splice","indexOf","hello","EditButton","buttonStyle","disabled","el","icon","onClick","e","preventDefault","stopPropagation","onMouseDown","round","size","tooltip","label","RemoveButton","BlockCollapsible","Actions","collapsibleProps","disableBlockName","editButton","fieldHasErrors","Label","CustomPill","removeButton","showDragHandle","showRowNumber","isReordering","move","onBlur","onKeyDown","reorderInstructionsID","targetIndex","onKeyDownCapture","event","target","altKey","ctrlKey","metaKey","closest","parentElement","currentTarget","matches","key","_jsxs","actions","button","buttonClassName","caret","horizontalAlign","popupType","render","close","ButtonGroup","buttonSize","direction","filter","Boolean","join","collapsibleStyle","dragHandleProps","attributes","role","tabIndex","listeners","header","String","padStart","pillStyle","admin","path","count","withMessage","onToggle","incomingCollapsedState","AfterCollapsible","_Fragment","blockID","headerActions","submitRef","BlockDrawer","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","style","display","beforeSubmit","onSubmit","formSchema"],"sources":["../../../../../src/features/blocks/client/component/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Collapsible,\n Drawer,\n EditDepthProvider,\n ErrorPill,\n Form,\n formatDrawerSlug,\n MoreIcon,\n Pill,\n Popup,\n PopupList,\n RenderFields,\n SectionTitle,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useFormSubmitted,\n useServerFunctions,\n useTranslation,\n XIcon,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, $getRoot, SKIP_DOM_SELECTION_TAG } from 'lexical'\nimport {\n type BlocksFieldClient,\n type ClientBlock,\n type CollapsedPreferences,\n type FormState,\n} from 'payload'\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapBlockComponentProps } from '../../../../types/index.js'\nimport type { BlockFields } from '../../server/schema.js'\n\nimport './index.css'\nimport '../../../../utilities/fieldsDrawer/index.css'\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport {\n RegisterFormSubmit,\n useDrawerSubmit,\n} from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isBlockNode } from '../nodes/BlocksNode.js'\nimport {\n type BlockCollapsibleWithErrorProps,\n BlockContent,\n useBlockComponentContext,\n} from './BlockContent.js'\nimport { BlockReordering } from './BlockReordering/index.js'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\nexport type BlockComponentProps<TFormData extends Record<string, unknown> = BlockFields> = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly className: string\n /**\n * Custom block component from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomBlock?: React.FC<ViewMapBlockComponentProps>\n /**\n * Custom block label from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomLabel?: React.FC<ViewMapBlockComponentProps>\n readonly formData: TFormData\n readonly nodeKey: string\n}\n\nexport const BlockComponent: React.FC<BlockComponentProps> = (props) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const submitted = useFormSubmitted()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const {\n fieldProps: {\n featureClientSchemaMap,\n field: parentLexicalRichTextField,\n initialLexicalFormState,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n\n const { fields: parentDocumentFields } = useDocumentForm()\n const onChangeAbortControllerRef = useRef(new AbortController())\n const editDepth = useEditDepth()\n const [errorCount, setErrorCount] = React.useState(0)\n\n const { config } = useConfig()\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-blocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug)\n\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const blockType = formData.blockType\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient | undefined\n\n const blockOrSlug = blocksField?.blocks?.[0]\n const clientBlock: ClientBlock | undefined =\n typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug\n\n const { getFormState } = useServerFunctions()\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}.fields`\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 const mergedState = 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 // Manually add blockName, as it's not part of cachedFormState\n mergedState.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n return mergedState\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 (CustomBlockFromProps/CustomLabelFromProps),\n // we render them directly with formData instead, so these states are unused.\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 // When viewMap components exist, render directly with formData (always current from\n // the lexical node). When they don't, fall back to server-rendered state.\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 useBlockComponentContext={useBlockComponentContext}\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 useBlockComponentContext={useBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\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 operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n state.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as BlockFields\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 && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = 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 ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state._components?.customComponents?.Block ?? undefined)\n }\n }\n }\n\n if (clientBlock && formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n isEditable,\n id,\n CustomLabelFromProps,\n CustomBlockFromProps,\n formData,\n editor,\n nodeKey,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n blockType,\n clientBlock,\n ])\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(\n initialLexicalFormState?.[formData.id]?.collapsed ?? false,\n )\n\n const { i18n, t } = useTranslation<object, string>()\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: newFormState } = 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 (!newFormState) {\n return prevFormState\n }\n\n if (prevFormState.blockName) {\n newFormState.blockName = prevFormState.blockName\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n removeEmptyArrayValues({\n fields: deepCopyObjectSimpleWithoutReactComponents(newFormState, { excludeFiles: true }),\n }),\n true,\n ) as BlockFields\n\n setTimeout(() => {\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\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 }, 0)\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined)\n }\n\n let rowErrorCount = 0\n for (const formField of Object.values(newFormState)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n\n return newFormState\n },\n\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n blockType,\n parentDocumentFields,\n isEditable,\n editor,\n nodeKey,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const [rowIndex, setRowIndex] = React.useState<number>(0)\n\n useEffect(() => {\n const updateIndex = () => {\n editor.getEditorState().read(() => {\n const root = $getRoot()\n const children = root.getChildren()\n let blockCount = 0\n for (const child of children) {\n if ($isBlockNode(child)) {\n if (child.getKey() === nodeKey) {\n setRowIndex(blockCount)\n return\n }\n blockCount++\n }\n }\n })\n }\n updateIndex()\n return editor.registerUpdateListener(() => {\n updateIndex()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences =\n currentDocPreferences?.fields?.[parentLexicalRichTextField.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(parentLexicalRichTextField.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, parentLexicalRichTextField.name, setDocFieldPreferences, formData.id],\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={(e) => {\n e.preventDefault()\n e.stopPropagation()\n toggleDrawer()\n return false\n }}\n onMouseDown={(e) => {\n // Needed to preserve lexical selection for toggleDrawer lexical selection restore.\n // I believe this is needed due to this button (usually) being inside of a collapsible.\n e.preventDefault()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, isEditable, t, blockDisplayName, toggleDrawer],\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 removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n ),\n [baseClass, isEditable, removeBlock],\n )\n\n const BlockCollapsible = useMemo(\n () =>\n function BlockCollapsible({\n Actions,\n children,\n className,\n collapsibleProps,\n disableBlockName,\n editButton,\n errorCount,\n fieldHasErrors,\n Label,\n Pill: CustomPill,\n removeButton,\n showDragHandle = true,\n showRowNumber = true,\n }: BlockCollapsibleWithErrorProps) {\n return (\n <BlockReordering editor={editor} nodeKey={nodeKey}>\n {({ isReordering, move, onBlur, onKeyDown, reorderInstructionsID, targetIndex }) => (\n <div\n className={`${baseClass}__container ${baseClass}-${blockType}`}\n onKeyDownCapture={(event) => {\n const target = event.target as HTMLElement\n\n if (\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n target.closest('.collapsible')?.parentElement !== event.currentTarget\n ) {\n return\n }\n // Handle controls before Lexical consumes keys using its retained text selection.\n if (\n target.matches('.collapsible__drag') &&\n (event.key !== 'Escape' || isReordering) &&\n [' ', 'ArrowDown', 'ArrowUp', 'Enter', 'Escape', 'Tab'].includes(event.key)\n ) {\n onKeyDown(event)\n event.stopPropagation()\n } else if (event.key === 'Tab' && target.matches('.collapsible__toggle')) {\n event.stopPropagation()\n }\n }}\n >\n <Collapsible\n actions={\n typeof Actions !== 'undefined' ? (\n Actions\n ) : isEditable ? (\n <Popup\n button={<MoreIcon />}\n buttonClassName={`${baseClass}__actions-button`}\n caret={false}\n horizontalAlign=\"right\"\n popupType=\"menu\"\n render={({ close }) => (\n <PopupList.ButtonGroup buttonSize=\"medium\">\n <PopupList.Button\n onClick={() => {\n close()\n move({ direction: -1 })\n }}\n >\n {t('general:moveUp')}\n </PopupList.Button>\n <PopupList.Button\n onClick={() => {\n close()\n move({ direction: 1 })\n }}\n >\n {t('general:moveDown')}\n </PopupList.Button>\n {((resolvedCustomBlock && editButton !== false) ||\n (!resolvedCustomBlock && editButton)) && (\n <PopupList.Button\n onClick={() => {\n toggleDrawer()\n close()\n }}\n >\n {t('general:edit')}\n </PopupList.Button>\n )}\n {removeButton !== false && (\n <PopupList.Button\n onClick={() => {\n removeBlock()\n close()\n }}\n >\n <XIcon />\n {t('general:remove')}\n </PopupList.Button>\n )}\n </PopupList.ButtonGroup>\n )}\n size=\"large\"\n />\n ) : null\n }\n className={[\n `${baseClass}__row`,\n fieldHasErrors\n ? `${baseClass}__row--has-errors`\n : `${baseClass}__row--no-errors`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n dragHandleProps={\n showDragHandle && isEditable\n ? {\n id: nodeKey,\n attributes: {\n 'aria-describedby': reorderInstructionsID,\n 'aria-pressed': isReordering,\n role: 'button',\n tabIndex: 0,\n },\n listeners: { onBlur },\n }\n : undefined\n }\n header={\n <div className={`${baseClass}__block-header`}>\n {typeof Label !== 'undefined' ? (\n Label\n ) : typeof resolvedCustomLabel !== 'undefined' ? (\n resolvedCustomLabel\n ) : (\n <div className={`${baseClass}__block-label`}>\n {showRowNumber && (\n <span className={`${baseClass}__block-number`}>\n {String(rowIndex + 1).padStart(2, '0')}\n </span>\n )}\n {typeof CustomPill !== 'undefined' ? (\n CustomPill\n ) : (\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`}\n pillStyle=\"white\"\n size=\"small\"\n >\n {blockDisplayName ?? blockType}\n </Pill>\n )}\n {!disableBlockName && !clientBlock?.admin?.disableBlockName && (\n <SectionTitle path=\"blockName\" readOnly={!isEditable} />\n )}\n\n {fieldHasErrors && (\n <ErrorPill count={errorCount ?? 0} i18n={i18n} withMessage />\n )}\n </div>\n )}\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n {...(collapsibleProps || {})}\n AfterCollapsible={\n <>\n {collapsibleProps?.AfterCollapsible}\n <span className=\"sr-only\" role=\"status\">\n {isReordering ? `${t('general:order')}: ${(targetIndex ?? 0) + 1}` : ''}\n </span>\n </>\n }\n >\n <span className=\"sr-only\" id={reorderInstructionsID}>\n Space / Enter · {t('general:moveUp')} ↑ · {t('general:moveDown')} ↓ ·{' '}\n {t('general:cancel')} Escape\n </span>\n {children}\n </Collapsible>\n </div>\n )}\n </BlockReordering>\n )\n },\n [\n editor,\n resolvedCustomBlock,\n resolvedCustomLabel,\n blockDisplayName,\n baseClass,\n clientBlock?.admin?.disableBlockName,\n blockType,\n i18n,\n isCollapsed,\n onCollapsedChange,\n isEditable,\n nodeKey,\n removeBlock,\n rowIndex,\n t,\n toggleDrawer,\n ],\n )\n\n const blockID = formData?.id\n\n const { headerActions, submitRef } = useDrawerSubmit()\n\n const BlockDrawer = useMemo(\n () => () => (\n <EditDepthProvider>\n <Drawer\n className={''}\n headerActions={headerActions}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${blockID ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <div className=\"fields-drawer\">\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 <RegisterFormSubmit submitRef={submitRef} />\n </div>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n ),\n [\n initialState,\n drawerSlug,\n blockID,\n blockDisplayName,\n t,\n isEditable,\n clientBlock?.fields,\n schemaFieldsPath,\n headerActions,\n submitRef,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\n ],\n )\n\n // Memoized Form JSX\n const Block = useMemo(() => {\n if (!initialState) {\n return null\n }\n return (\n <div data-block-drawer-slug={drawerSlug} style={{ display: 'contents' }}>\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n return await onChange({ formState, submit: true })\n },\n ]}\n el=\"div\"\n fields={clientBlock?.fields ?? []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={(formState, newData) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n newData.blockType = blockType\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n node.setFields(newData as BlockFields, 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 toggleDrawer()\n }}\n submitted={submitted}\n uuid={formUuid}\n >\n <BlockContent\n baseClass={baseClass}\n BlockDrawer={BlockDrawer}\n Collapsible={BlockCollapsible}\n CustomBlock={resolvedCustomBlock}\n CustomLabel={resolvedCustomLabel}\n EditButton={EditButton}\n errorCount={errorCount}\n formSchema={clientBlock?.fields ?? []}\n initialState={initialState}\n nodeKey={nodeKey}\n RemoveButton={RemoveButton}\n />\n </Form>\n </div>\n )\n }, [\n BlockCollapsible,\n BlockDrawer,\n resolvedCustomBlock,\n resolvedCustomLabel,\n blockType,\n drawerSlug,\n RemoveButton,\n EditButton,\n baseClass,\n editor,\n errorCount,\n toggleDrawer,\n clientBlock?.fields,\n formUuid,\n initialState,\n nodeKey,\n onChange,\n submitted,\n ])\n\n if (!clientBlock) {\n return (\n <BlockCollapsible disableBlockName={true} fieldHasErrors={true}>\n <div className={`${baseClass}-not-found`}>\n Error: Block '{blockType}' not found in the config but exists in the lexical data\n </div>\n </BlockCollapsible>\n )\n }\n\n return Block\n}\n"],"mappings":"AAAA;;;AAEA,SAASA,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AA,EACAgE,WAAA,EACAtJ,mBAAA,EACAI,mBAAA,EACAxC,SAAA,EACAR,UAAA,EACAiI,YAAA,EACAd,UAAA,EACA9I,SAAA,EACAiC,MAAA,EACAV,UAAA,EACAO,YAAA,EACAW,WAAA,EAAavB,MAAA,EACb8C,QAAA,EACAnB,YAAA,EACAvC,OAAA,EACA+F,QAAA,EACA9F,SAAA,CACD;EAED,IAAI,CAACkC,WAAA,EAAa;IAChB,oBACE+B,IAAA,CAACqF,gBAAA;MAAiBG,gBAAA,EAAkB;MAAME,cAAA,EAAgB;gBACxD,aAAAuB,KAAA,CAAC;QAAI1L,SAAA,EAAW,GAAGC,SAAA,YAAqB;mBAAE,kBACzBmC,SAAA,EAAU;;;EAIjC;EAEA,OAAOmC,KAAA;AACT","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ import type { LexicalEditor } from 'lexical';
2
+ import type { KeyboardEvent } from 'react';
3
+ export declare function useBlockReordering({ editor, nodeKey, }: {
4
+ editor: LexicalEditor;
5
+ nodeKey: string;
6
+ }): {
7
+ isReordering: boolean;
8
+ move: ({ direction, index }: {
9
+ direction?: -1 | 1;
10
+ index?: number;
11
+ }) => void;
12
+ onBlur: () => void;
13
+ onKeyDown: (event: KeyboardEvent) => void;
14
+ targetIndex: number | null;
15
+ };
16
+ //# sourceMappingURL=useBlockReordering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBlockReordering.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/useBlockReordering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAU1C,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;CAChB;;iCAmH0B;QAAE,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;uBA8CrD,aAAa;;EAoDxB"}