@payloadcms/richtext-lexical 4.0.0-internal.f11981a → 4.0.0-internal.f2a04f7

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 (371) hide show
  1. package/dist/exports/client/Field-W2ABOM7M.js +2 -0
  2. package/dist/exports/client/Field-W2ABOM7M.js.map +7 -0
  3. package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
  4. package/dist/exports/client/{chunk-LN6VX25I.js.map → chunk-3LRZDIIG.js.map} +2 -2
  5. package/dist/exports/client/chunk-E6LSRRP2.js +2 -0
  6. package/dist/exports/client/chunk-E6LSRRP2.js.map +7 -0
  7. package/dist/exports/client/chunk-ZQX5HXUL.js +2 -0
  8. package/dist/exports/client/{chunk-43E5QYAA.js.map → chunk-ZQX5HXUL.js.map} +3 -3
  9. package/dist/exports/client/{component-D5QLYS7W.js → component-6DQLENIE.js} +2 -2
  10. package/dist/exports/client/componentInline-HNE5G4TE.js +2 -0
  11. package/dist/exports/client/index.js +28 -28
  12. package/dist/exports/client/index.js.map +4 -4
  13. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  14. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  15. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  16. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  17. package/dist/features/blocks/client/component/index.d.ts +0 -6
  18. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  19. package/dist/features/blocks/client/component/index.js +196 -101
  20. package/dist/features/blocks/client/component/index.js.map +1 -1
  21. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  22. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  23. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  24. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  25. package/dist/features/blocks/client/componentInline/index.css +0 -1
  26. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  27. package/dist/features/blocks/client/componentInline/index.js +30 -22
  28. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  29. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts +9 -0
  30. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts.map +1 -0
  31. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js +95 -0
  32. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -0
  33. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  34. package/dist/features/blocks/client/nodes/BlocksNode.js +0 -10
  35. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  36. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  37. package/dist/features/blocks/server/nodes/BlocksNode.js +1 -12
  38. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  39. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +2 -2
  40. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  41. package/dist/features/blocks/server/schema.d.ts +2 -0
  42. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  43. package/dist/features/blocks/server/schema.js +7 -9
  44. package/dist/features/blocks/server/schema.js.map +1 -1
  45. package/dist/features/blocks/server/validate.js +1 -1
  46. package/dist/features/blocks/server/validate.js.map +1 -1
  47. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  48. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  49. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  50. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  51. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  52. package/dist/features/converters/lexicalToHtml/async/converters/upload.js +3 -3
  53. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  54. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  55. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  56. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  57. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  58. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  59. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  60. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  61. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  62. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +3 -3
  63. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  64. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  65. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  66. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  67. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  68. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  69. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  70. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  71. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  72. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  73. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +4 -5
  74. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  75. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  76. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  77. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  78. package/dist/features/heading/constants.d.ts +2 -0
  79. package/dist/features/heading/constants.d.ts.map +1 -0
  80. package/dist/features/heading/constants.js +2 -0
  81. package/dist/features/heading/constants.js.map +1 -0
  82. package/dist/features/heading/server/index.d.ts.map +1 -1
  83. package/dist/features/heading/server/index.js +5 -1
  84. package/dist/features/heading/server/index.js.map +1 -1
  85. package/dist/features/heading/server/validate.d.ts +6 -0
  86. package/dist/features/heading/server/validate.d.ts.map +1 -0
  87. package/dist/features/heading/server/validate.js +15 -0
  88. package/dist/features/heading/server/validate.js.map +1 -0
  89. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +11 -1
  90. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  91. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +17 -0
  92. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  93. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +2 -2
  94. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  95. package/dist/features/horizontalRule/server/schema.d.ts +1 -0
  96. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -1
  97. package/dist/features/horizontalRule/server/schema.js +6 -5
  98. package/dist/features/horizontalRule/server/schema.js.map +1 -1
  99. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  100. package/dist/features/indent/client/IndentPlugin.js +122 -1
  101. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  102. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  103. package/dist/features/indent/server/i18n.js +74 -37
  104. package/dist/features/indent/server/i18n.js.map +1 -1
  105. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  106. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +8 -5
  107. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  108. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
  109. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  110. package/dist/features/link/nodes/AutoLinkNode.js +2 -10
  111. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  112. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  113. package/dist/features/link/nodes/LinkNode.js +2 -15
  114. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  115. package/dist/features/link/server/validate.js +1 -1
  116. package/dist/features/link/server/validate.js.map +1 -1
  117. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  118. package/dist/features/lists/checklist/server/index.js +5 -2
  119. package/dist/features/lists/checklist/server/index.js.map +1 -1
  120. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  121. package/dist/features/lists/orderedList/server/index.js +5 -2
  122. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  123. package/dist/features/lists/shared/constants.d.ts +2 -0
  124. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  125. package/dist/features/lists/shared/constants.js +2 -0
  126. package/dist/features/lists/shared/constants.js.map +1 -0
  127. package/dist/features/lists/shared/schema.d.ts.map +1 -1
  128. package/dist/features/lists/shared/schema.js.map +1 -1
  129. package/dist/features/lists/shared/validate.d.ts +5 -0
  130. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  131. package/dist/features/lists/shared/validate.js +15 -0
  132. package/dist/features/lists/shared/validate.js.map +1 -0
  133. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  134. package/dist/features/lists/unorderedList/server/index.js +5 -2
  135. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  136. package/dist/features/relationship/client/components/index.css +3 -6
  137. package/dist/features/relationship/client/index.d.ts +2 -2
  138. package/dist/features/relationship/client/index.d.ts.map +1 -1
  139. package/dist/features/relationship/client/index.js.map +1 -1
  140. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  141. package/dist/features/relationship/client/nodes/RelationshipNode.js +0 -3
  142. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  143. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  144. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  145. package/dist/features/relationship/client/plugins/index.js +27 -31
  146. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  147. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  148. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  149. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  150. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  151. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  152. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  153. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  154. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  155. package/dist/features/relationship/server/index.d.ts +8 -1
  156. package/dist/features/relationship/server/index.d.ts.map +1 -1
  157. package/dist/features/relationship/server/index.js +28 -11
  158. package/dist/features/relationship/server/index.js.map +1 -1
  159. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  160. package/dist/features/relationship/server/nodes/RelationshipNode.js +1 -5
  161. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  162. package/dist/features/relationship/server/schema.d.ts +3 -2
  163. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  164. package/dist/features/relationship/server/schema.js +9 -12
  165. package/dist/features/relationship/server/schema.js.map +1 -1
  166. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  167. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  168. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  169. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  170. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  171. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  172. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  173. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  174. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.css +0 -1
  175. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  176. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js +17 -44
  177. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  178. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  179. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js +41 -18
  180. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  181. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.css +0 -3
  182. package/dist/features/textState/defaultColors.js +1 -1
  183. package/dist/features/textState/defaultColors.js.map +1 -1
  184. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  185. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  186. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  187. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  188. package/dist/features/toolbars/fixed/client/Toolbar/index.css +77 -3
  189. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  190. package/dist/features/toolbars/fixed/client/Toolbar/index.js +19 -1
  191. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  192. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  193. package/dist/features/toolbars/inline/client/Toolbar/index.js +17 -2
  194. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  195. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  196. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  197. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  198. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  199. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  200. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  201. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -12
  202. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts +5 -0
  203. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts.map +1 -0
  204. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js +79 -0
  205. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -0
  206. package/dist/features/typesServer.d.ts +16 -11
  207. package/dist/features/typesServer.d.ts.map +1 -1
  208. package/dist/features/typesServer.js.map +1 -1
  209. package/dist/features/upload/client/component/index.css +0 -2
  210. package/dist/features/upload/client/index.d.ts +3 -2
  211. package/dist/features/upload/client/index.d.ts.map +1 -1
  212. package/dist/features/upload/client/index.js.map +1 -1
  213. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  214. package/dist/features/upload/client/nodes/UploadNode.js +0 -7
  215. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  216. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  217. package/dist/features/upload/client/plugin/index.js +50 -53
  218. package/dist/features/upload/client/plugin/index.js.map +1 -1
  219. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  220. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  221. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  222. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  223. package/dist/features/upload/server/index.d.ts +7 -3
  224. package/dist/features/upload/server/index.d.ts.map +1 -1
  225. package/dist/features/upload/server/index.js +18 -14
  226. package/dist/features/upload/server/index.js.map +1 -1
  227. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  228. package/dist/features/upload/server/nodes/UploadNode.js +1 -9
  229. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  230. package/dist/features/upload/server/schema.d.ts +4 -16
  231. package/dist/features/upload/server/schema.d.ts.map +1 -1
  232. package/dist/features/upload/server/schema.js +8 -10
  233. package/dist/features/upload/server/schema.js.map +1 -1
  234. package/dist/features/upload/server/validate.d.ts +2 -2
  235. package/dist/features/upload/server/validate.d.ts.map +1 -1
  236. package/dist/features/upload/server/validate.js +4 -1
  237. package/dist/features/upload/server/validate.js.map +1 -1
  238. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  239. package/dist/field/Diff/converters/listitem/index.js +2 -1
  240. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  241. package/dist/field/Diff/converters/relationship/index.css +0 -1
  242. package/dist/field/Diff/converters/unknown/index.css +0 -1
  243. package/dist/field/Diff/converters/upload/index.css +0 -1
  244. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  245. package/dist/field/Diff/index.css +0 -2
  246. package/dist/field/Diff/index.d.ts +3 -2
  247. package/dist/field/Diff/index.d.ts.map +1 -1
  248. package/dist/field/Diff/index.js +3 -2
  249. package/dist/field/Diff/index.js.map +1 -1
  250. package/dist/field/Field.d.ts.map +1 -1
  251. package/dist/field/Field.js +8 -1
  252. package/dist/field/Field.js.map +1 -1
  253. package/dist/field/RenderLexical/index.d.ts +3 -1
  254. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  255. package/dist/field/RenderLexical/index.js +23 -23
  256. package/dist/field/RenderLexical/index.js.map +1 -1
  257. package/dist/field/ViewSelector.d.ts.map +1 -1
  258. package/dist/field/ViewSelector.js +1 -0
  259. package/dist/field/ViewSelector.js.map +1 -1
  260. package/dist/field/bundled.css +1 -1
  261. package/dist/field/index.css +10 -11
  262. package/dist/field/rscEntry.d.ts +2 -2
  263. package/dist/field/rscEntry.d.ts.map +1 -1
  264. package/dist/field/rscEntry.js.map +1 -1
  265. package/dist/index.d.ts +4 -4
  266. package/dist/index.d.ts.map +1 -1
  267. package/dist/index.js +23 -1
  268. package/dist/index.js.map +1 -1
  269. package/dist/lexical/LexicalEditor.css +21 -10
  270. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  271. package/dist/lexical/LexicalEditor.js +61 -64
  272. package/dist/lexical/LexicalEditor.js.map +1 -1
  273. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
  274. package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
  275. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  276. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +2 -1
  277. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +1 -1
  278. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  279. package/dist/lexical/plugins/SlashMenu/index.css +0 -1
  280. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
  281. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  282. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  283. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +1 -0
  284. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  285. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -2
  286. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  287. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  288. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  289. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  290. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  291. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  292. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  293. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  294. package/dist/lexical/theme/EditorTheme.css +0 -2
  295. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  296. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  297. package/dist/lexical/ui/ContentEditable.js +32 -11
  298. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  299. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  300. package/dist/lexical/ui/icons/H3/index.js +13 -6
  301. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  302. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  303. package/dist/lexical/ui/icons/H4/index.js +13 -6
  304. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  305. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  306. package/dist/lexical/ui/icons/H5/index.js +13 -6
  307. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  308. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  309. package/dist/lexical/ui/icons/H6/index.js +13 -6
  310. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  311. package/dist/presets/llmInstructions.d.ts +2 -0
  312. package/dist/presets/llmInstructions.d.ts.map +1 -0
  313. package/dist/presets/llmInstructions.js +13 -0
  314. package/dist/presets/llmInstructions.js.map +1 -0
  315. package/dist/types/builtInNodes.d.ts +1 -1
  316. package/dist/types/builtInNodes.d.ts.map +1 -1
  317. package/dist/types/builtInNodes.js +8 -3
  318. package/dist/types/builtInNodes.js.map +1 -1
  319. package/dist/types/index.d.ts +3 -6
  320. package/dist/types/index.d.ts.map +1 -1
  321. package/dist/types/index.js.map +1 -1
  322. package/dist/types/jsonSchemaHelpers.d.ts +5 -1
  323. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  324. package/dist/types/jsonSchemaHelpers.js +7 -2
  325. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  326. package/dist/types/nodeTypes.d.ts +5 -0
  327. package/dist/types/nodeTypes.d.ts.map +1 -1
  328. package/dist/types/nodeTypes.js.map +1 -1
  329. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  330. package/dist/utilities/buildEditorState.js.map +1 -1
  331. package/dist/utilities/buildInitialState.d.ts +3 -2
  332. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  333. package/dist/utilities/buildInitialState.js +1 -0
  334. package/dist/utilities/buildInitialState.js.map +1 -1
  335. package/dist/utilities/generateImportMap.d.ts +2 -2
  336. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  337. package/dist/utilities/generateImportMap.js.map +1 -1
  338. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  339. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  340. package/dist/validate/hasText.d.ts +2 -2
  341. package/dist/validate/hasText.d.ts.map +1 -1
  342. package/dist/validate/hasText.js.map +1 -1
  343. package/dist/validate/index.d.ts +1 -1
  344. package/dist/validate/index.d.ts.map +1 -1
  345. package/package.json +45 -45
  346. package/dist/dependencyChecker.spec.js +0 -16
  347. package/dist/dependencyChecker.spec.js.map +0 -1
  348. package/dist/exports/client/Field-F22V5L4V.js +0 -2
  349. package/dist/exports/client/Field-F22V5L4V.js.map +0 -7
  350. package/dist/exports/client/bundled.css +0 -1
  351. package/dist/exports/client/chunk-43E5QYAA.js +0 -2
  352. package/dist/exports/client/chunk-ESITTE3C.js +0 -2
  353. package/dist/exports/client/chunk-ESITTE3C.js.map +0 -7
  354. package/dist/exports/client/chunk-LN6VX25I.js +0 -2
  355. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  356. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts +0 -11
  357. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts.map +0 -1
  358. package/dist/features/blocks/client/component/removeEmptyArrayValues.js +0 -20
  359. package/dist/features/blocks/client/component/removeEmptyArrayValues.js.map +0 -1
  360. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  361. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  362. package/dist/features/link/markdownTransformer.spec.js +0 -195
  363. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  364. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  365. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  366. package/dist/lexical/utils/url.spec.js +0 -114
  367. package/dist/lexical/utils/url.spec.js.map +0 -1
  368. package/dist/utilities/jsx/jsx.spec.js +0 -178
  369. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  370. /package/dist/exports/client/{component-D5QLYS7W.js.map → component-6DQLENIE.js.map} +0 -0
  371. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-HNE5G4TE.js.map} +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;AAmBrD,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,CAgzBxD,CAAA"}
@@ -1,13 +1,14 @@
1
1
  'use client';
2
2
 
3
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { c as _c } from "react/compiler-runtime";
4
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
5
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
5
6
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
6
7
  import { getTranslation } from '@payloadcms/translations';
7
8
  import { Button, Collapsible, Drawer, EditDepthProvider, ErrorPill, Form, formatDrawerSlug, MoreIcon, Pill, Popup, PopupList, RenderFields, SectionTitle, useConfig, useDocumentForm, useDocumentInfo, useEditDepth, useFormSubmitted, useServerFunctions, useTranslation, XIcon } from '@payloadcms/ui';
8
9
  import { abortAndIgnore } from '@payloadcms/ui/shared';
9
10
  import { $getNodeByKey, $getRoot, SKIP_DOM_SELECTION_TAG } from 'lexical';
10
- import { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared';
11
+ import { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared';
11
12
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
12
13
  import { v4 as uuid } from 'uuid';
13
14
  import './index.css';
@@ -15,9 +16,10 @@ import '../../../../utilities/fieldsDrawer/index.css';
15
16
  import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
16
17
  import { RegisterFormSubmit, useDrawerSubmit } from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js';
17
18
  import { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js';
19
+ import { getCachedFormStateIfDataMatches, reduceFormStateToBlockData } from '../getCachedFormStateIfDataMatches.js';
18
20
  import { $isBlockNode } from '../nodes/BlocksNode.js';
19
21
  import { BlockContent, useBlockComponentContext } from './BlockContent.js';
20
- import { removeEmptyArrayValues } from './removeEmptyArrayValues.js';
22
+ import { BlockReordering } from './BlockReordering/index.js';
21
23
  export const BlockComponent = props => {
22
24
  const {
23
25
  cacheBuster,
@@ -68,31 +70,43 @@ export const BlockComponent = props => {
68
70
  const [editor] = useLexicalComposerContext();
69
71
  const isEditable = useLexicalEditable();
70
72
  const blockType = formData.blockType;
73
+ const formDataRef = useRef(formData);
74
+ formDataRef.current = formData;
75
+ const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`;
76
+ const clientSchemaMap = featureClientSchemaMap['blocks'];
77
+ const blocksField = clientSchemaMap?.[componentMapRenderedBlockPath]?.[0];
78
+ const blockOrSlug = blocksField?.blocks?.[0];
79
+ const clientBlock = typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug;
71
80
  const {
72
81
  getFormState
73
82
  } = useServerFunctions();
74
83
  const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}.fields`;
75
84
  const [initialState, setInitialState] = React.useState(() => {
76
85
  // Initial form state that was calculated server-side. May have stale values
77
- const cachedFormState = initialLexicalFormState?.[formData.id]?.formState;
86
+ const cachedState = initialLexicalFormState?.[formData.id];
87
+ const cachedFormState = cachedState?.formState;
78
88
  if (!cachedFormState) {
79
89
  return false;
80
90
  }
81
- // Merge current formData values into the cached form state
82
- // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits
83
- const mergedState = Object.fromEntries(Object.entries(cachedFormState).map(([fieldName, fieldState]) => [fieldName, fieldName in formData ? {
84
- ...fieldState,
85
- initialValue: formData[fieldName],
86
- value: formData[fieldName]
87
- } : fieldState]));
91
+ const matchingCachedState = getCachedFormStateIfDataMatches({
92
+ cachedFormState,
93
+ cachedSchemaPath: cachedState.schemaPath,
94
+ currentSchemaPath: schemaFieldsPath,
95
+ formData
96
+ });
97
+ if (!matchingCachedState) {
98
+ return false;
99
+ }
88
100
  // Manually add blockName, as it's not part of cachedFormState
89
- mergedState.blockName = {
90
- initialValue: formData.blockName,
91
- passesCondition: true,
92
- valid: true,
93
- value: formData.blockName
101
+ return {
102
+ ...matchingCachedState,
103
+ blockName: {
104
+ initialValue: formData.blockName,
105
+ passesCondition: true,
106
+ valid: true,
107
+ value: formData.blockName
108
+ }
94
109
  };
95
- return mergedState;
96
110
  });
97
111
  const hasMounted = useRef(false);
98
112
  const prevCacheBuster = useRef(cacheBuster);
@@ -191,9 +205,9 @@ export const BlockComponent = props => {
191
205
  valid: true,
192
206
  value: formData.blockName
193
207
  };
194
- const newFormStateData = reduceFieldsToValues(deepCopyObjectSimpleWithoutReactComponents(state, {
208
+ const newFormStateData = reduceFormStateToBlockData(deepCopyObjectSimpleWithoutReactComponents(state, {
195
209
  excludeFiles: true
196
- }), true);
210
+ }));
197
211
  // Things like default values may come back from the server => update the node with the new data
198
212
  editor.update(() => {
199
213
  const node = $getNodeByKey(nodeKey);
@@ -217,19 +231,14 @@ export const BlockComponent = props => {
217
231
  }
218
232
  }
219
233
  };
220
- if (formData && !initialState) {
234
+ if (clientBlock && formData && !initialState) {
221
235
  void awaitInitialState();
222
236
  }
223
237
  return () => {
224
238
  abortAndIgnore(abortController);
225
239
  };
226
- }, [getFormState, schemaFieldsPath, isEditable, id, CustomLabelFromProps, CustomBlockFromProps, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields, blockType]);
240
+ }, [getFormState, schemaFieldsPath, isEditable, id, CustomLabelFromProps, CustomBlockFromProps, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields, blockType, clientBlock]);
227
241
  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
242
  const {
234
243
  i18n,
235
244
  t
@@ -241,11 +250,15 @@ export const BlockComponent = props => {
241
250
  abortAndIgnore(onChangeAbortControllerRef.current);
242
251
  const controller = new AbortController();
243
252
  onChangeAbortControllerRef.current = controller;
253
+ const blockData = reduceFormStateToBlockData(deepCopyObjectSimpleWithoutReactComponents(prevFormState, {
254
+ excludeFiles: true
255
+ }), formDataRef.current);
244
256
  const {
245
257
  state: newFormState
246
258
  } = await getFormState({
247
259
  id,
248
260
  collectionSlug,
261
+ data: blockData,
249
262
  docPermissions: {
250
263
  fields: true
251
264
  },
@@ -255,7 +268,7 @@ export const BlockComponent = props => {
255
268
  }),
256
269
  formState: prevFormState,
257
270
  globalSlug,
258
- initialBlockFormState: prevFormState,
271
+ initialBlockData: blockData,
259
272
  operation: 'update',
260
273
  readOnly: !isEditable,
261
274
  renderAllFields: submit ? true : false,
@@ -268,11 +281,9 @@ export const BlockComponent = props => {
268
281
  if (prevFormState.blockName) {
269
282
  newFormState.blockName = prevFormState.blockName;
270
283
  }
271
- const newFormStateData_0 = reduceFieldsToValues(removeEmptyArrayValues({
272
- fields: deepCopyObjectSimpleWithoutReactComponents(newFormState, {
273
- excludeFiles: true
274
- })
275
- }), true);
284
+ const newFormStateData_0 = reduceFormStateToBlockData(deepCopyObjectSimpleWithoutReactComponents(newFormState, {
285
+ excludeFiles: true
286
+ }), blockData);
276
287
  setTimeout(() => {
277
288
  editor.update(() => {
278
289
  const node_0 = $getNodeByKey(nodeKey);
@@ -394,7 +405,7 @@ export const BlockComponent = props => {
394
405
  round: true,
395
406
  tooltip: "Remove Block"
396
407
  }), [baseClass, isEditable, removeBlock]);
397
- const BlockCollapsible = useMemo(() => ({
408
+ const BlockCollapsible = useMemo(() => function BlockCollapsible({
398
409
  Actions,
399
410
  children: children_0,
400
411
  className,
@@ -408,77 +419,132 @@ export const BlockComponent = props => {
408
419
  removeButton,
409
420
  showDragHandle = true,
410
421
  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
- })]
422
+ }) {
423
+ return /*#__PURE__*/_jsx(BlockReordering, {
424
+ editor: editor,
425
+ nodeKey: nodeKey,
426
+ children: ({
427
+ isReordering,
428
+ move,
429
+ onBlur,
430
+ onKeyDown,
431
+ reorderInstructionsID,
432
+ targetIndex
433
+ }) => /*#__PURE__*/_jsx("div", {
434
+ className: `${baseClass}__container ${baseClass}-${blockType}`,
435
+ onKeyDownCapture: event => {
436
+ const target = event.target;
437
+ if (event.altKey || event.ctrlKey || event.metaKey || target.closest('.collapsible')?.parentElement !== event.currentTarget) {
438
+ return;
439
+ }
440
+ // Handle controls before Lexical consumes keys using its retained text selection.
441
+ if (target.matches('.collapsible__drag') && (event.key !== 'Escape' || isReordering) && [' ', 'ArrowDown', 'ArrowUp', 'Enter', 'Escape', 'Tab'].includes(event.key)) {
442
+ onKeyDown(event);
443
+ event.stopPropagation();
444
+ } else if (event.key === 'Tab' && target.matches('.collapsible__toggle')) {
445
+ event.stopPropagation();
446
+ }
447
+ },
448
+ children: /*#__PURE__*/_jsxs(Collapsible, {
449
+ actions: typeof Actions !== 'undefined' ? Actions : isEditable ? /*#__PURE__*/_jsx(Popup, {
450
+ button: /*#__PURE__*/_jsx(MoreIcon, {}),
451
+ buttonAriaLabel: t('general:moreOptions'),
452
+ buttonClassName: `${baseClass}__actions-button`,
453
+ caret: false,
454
+ horizontalAlign: "right",
455
+ popupType: "menu",
456
+ render: ({
457
+ close
458
+ }) => /*#__PURE__*/_jsxs(PopupList.ButtonGroup, {
459
+ buttonSize: "medium",
460
+ children: [/*#__PURE__*/_jsx(PopupList.Button, {
461
+ onClick: () => {
462
+ close();
463
+ move({
464
+ direction: -1
465
+ });
466
+ },
467
+ children: t('general:moveUp')
468
+ }), /*#__PURE__*/_jsx(PopupList.Button, {
469
+ onClick: () => {
470
+ close();
471
+ move({
472
+ direction: 1
473
+ });
474
+ },
475
+ children: t('general:moveDown')
476
+ }), (resolvedCustomBlock && editButton !== false || !resolvedCustomBlock && editButton) && /*#__PURE__*/_jsx(PopupList.Button, {
477
+ onClick: () => {
478
+ toggleDrawer();
479
+ close();
480
+ },
481
+ children: t('general:edit')
482
+ }), removeButton !== false && /*#__PURE__*/_jsxs(PopupList.Button, {
483
+ onClick: () => {
484
+ removeBlock();
485
+ close();
486
+ },
487
+ children: [/*#__PURE__*/_jsx(XIcon, {}), t('general:remove')]
488
+ })]
489
+ }),
490
+ size: "large"
491
+ }) : null,
492
+ className: [`${baseClass}__row`, fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`, className].filter(Boolean).join(' '),
493
+ collapsibleStyle: fieldHasErrors ? 'error' : 'default',
494
+ dragHandleProps: showDragHandle && isEditable ? {
495
+ id: nodeKey,
496
+ attributes: {
497
+ 'aria-describedby': reorderInstructionsID,
498
+ 'aria-pressed': isReordering,
499
+ role: 'button',
500
+ tabIndex: 0
501
+ },
502
+ listeners: {
503
+ onBlur
504
+ }
505
+ } : undefined,
506
+ header: /*#__PURE__*/_jsx("div", {
507
+ className: `${baseClass}__block-header`,
508
+ children: typeof Label !== 'undefined' ? Label : typeof resolvedCustomLabel !== 'undefined' ? resolvedCustomLabel : /*#__PURE__*/_jsxs("div", {
509
+ className: `${baseClass}__block-label`,
510
+ children: [showRowNumber && /*#__PURE__*/_jsx("span", {
511
+ className: `${baseClass}__block-number`,
512
+ children: String(rowIndex + 1).padStart(2, '0')
513
+ }), typeof CustomPill !== 'undefined' ? CustomPill : /*#__PURE__*/_jsx(Pill, {
514
+ className: `${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`,
515
+ pillStyle: "white",
516
+ size: "small",
517
+ children: blockDisplayName ?? blockType
518
+ }), !disableBlockName && !clientBlock?.admin?.disableBlockName && /*#__PURE__*/_jsx(SectionTitle, {
519
+ path: "blockName",
520
+ readOnly: !isEditable
521
+ }), fieldHasErrors && /*#__PURE__*/_jsx(BlockErrorPill, {
522
+ count: errorCount_0 ?? 0
523
+ })]
524
+ })
437
525
  }),
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
526
+ isCollapsed: isCollapsed,
527
+ onToggle: incomingCollapsedState => {
528
+ onCollapsedChange(incomingCollapsedState);
529
+ setIsCollapsed(incomingCollapsedState);
447
530
  },
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
531
+ ...(collapsibleProps || {}),
532
+ AfterCollapsible: /*#__PURE__*/_jsxs(_Fragment, {
533
+ children: [collapsibleProps?.AfterCollapsible, /*#__PURE__*/_jsx("span", {
534
+ className: "sr-only",
535
+ role: "status",
536
+ children: isReordering ? `${t('general:order')}: ${(targetIndex ?? 0) + 1}` : ''
469
537
  })]
470
- })
471
- }),
472
- isCollapsed: isCollapsed,
473
- onToggle: incomingCollapsedState => {
474
- onCollapsedChange(incomingCollapsedState);
475
- setIsCollapsed(incomingCollapsedState);
476
- },
477
- ...(collapsibleProps || {}),
478
- children: children_0
479
- }, 0)
538
+ }),
539
+ children: [/*#__PURE__*/_jsxs("span", {
540
+ className: "sr-only",
541
+ id: reorderInstructionsID,
542
+ children: ["Space / Enter · ", t('general:moveUp'), " ↑ · ", t('general:moveDown'), " ↓ ·", ' ', t('general:cancel'), " Escape"]
543
+ }), children_0]
544
+ }, 0)
545
+ })
480
546
  });
481
- }, [resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, i18n, isCollapsed, onCollapsedChange, isEditable, nodeKey, removeBlock, rowIndex, t, toggleDrawer]);
547
+ }, [editor, resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, isCollapsed, onCollapsedChange, isEditable, nodeKey, removeBlock, rowIndex, t, toggleDrawer]);
482
548
  const blockID = formData?.id;
483
549
  const {
484
550
  headerActions,
@@ -532,8 +598,9 @@ export const BlockComponent = props => {
532
598
  fields: clientBlock?.fields ?? [],
533
599
  initialState: initialState,
534
600
  onChange: [onChange],
535
- onSubmit: (formState_0, newData_1) => {
601
+ onSubmit: formState_0 => {
536
602
  // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
603
+ const newData_1 = reduceFormStateToBlockData(formState_0, formDataRef.current);
537
604
  newData_1.blockType = blockType;
538
605
  editor.update(() => {
539
606
  const node_1 = $getNodeByKey(nodeKey);
@@ -578,4 +645,32 @@ export const BlockComponent = props => {
578
645
  }
579
646
  return Block;
580
647
  };
648
+ /**
649
+ * Reads `i18n` itself so `BlockCollapsible` does not depend on it. `BlockCollapsible` is created in
650
+ * a `useMemo`, so each new `i18n` object (e.g. once the date-fns locale is set after mount) would
651
+ * remount the whole block, closing its open menus and dropping focus.
652
+ */
653
+ const BlockErrorPill = t0 => {
654
+ const $ = _c(3);
655
+ const {
656
+ count
657
+ } = t0;
658
+ const {
659
+ i18n
660
+ } = useTranslation();
661
+ let t1;
662
+ if ($[0] !== count || $[1] !== i18n) {
663
+ t1 = _jsx(ErrorPill, {
664
+ count,
665
+ i18n,
666
+ withMessage: true
667
+ });
668
+ $[0] = count;
669
+ $[1] = i18n;
670
+ $[2] = t1;
671
+ } else {
672
+ t1 = $[2];
673
+ }
674
+ return t1;
675
+ };
581
676
  //# sourceMappingURL=index.js.map