@payloadcms/richtext-lexical 4.0.0-internal.9496957 → 4.0.0-internal.94ef095

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 (470) hide show
  1. package/dist/exports/client/Field-334JNLRF.js +2 -0
  2. package/dist/exports/client/Field-334JNLRF.js.map +7 -0
  3. package/dist/exports/client/{RelationshipComponent-YCPAKOL7.js → RelationshipComponent-TVK6I4W4.js} +2 -2
  4. package/dist/exports/client/chunk-3V7KW5XF.js +2 -0
  5. package/dist/exports/client/chunk-3V7KW5XF.js.map +7 -0
  6. package/dist/exports/client/chunk-A7DZCL6D.js +2 -0
  7. package/dist/exports/client/chunk-A7DZCL6D.js.map +7 -0
  8. package/dist/exports/client/{chunk-WSAPGI3Z.js → chunk-EA5BHQ2T.js} +1 -1
  9. package/dist/exports/client/{chunk-WSAPGI3Z.js.map → chunk-EA5BHQ2T.js.map} +1 -1
  10. package/dist/exports/client/chunk-FAJJXXCW.js +2 -0
  11. package/dist/exports/client/chunk-FAJJXXCW.js.map +7 -0
  12. package/dist/exports/client/{chunk-5VIL27GI.js → chunk-IYBYNEKX.js} +1 -1
  13. package/dist/exports/client/{chunk-5VIL27GI.js.map → chunk-IYBYNEKX.js.map} +1 -1
  14. package/dist/exports/client/{component-D5QLYS7W.js → component-FCCSBBZG.js} +2 -2
  15. package/dist/exports/client/componentInline-7FQV2X7Z.js +2 -0
  16. package/dist/exports/client/index.js +28 -28
  17. package/dist/exports/client/index.js.map +4 -4
  18. package/dist/features/align/client/index.js.map +1 -1
  19. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  20. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  21. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  22. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  23. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  24. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  25. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  26. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  27. package/dist/features/blocks/client/component/index.d.ts +0 -6
  28. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  29. package/dist/features/blocks/client/component/index.js +209 -164
  30. package/dist/features/blocks/client/component/index.js.map +1 -1
  31. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  32. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  33. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  34. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  35. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  36. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  37. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  38. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  39. package/dist/features/blocks/client/componentInline/index.css +0 -1
  40. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  41. package/dist/features/blocks/client/componentInline/index.js +37 -76
  42. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  43. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts +8 -0
  44. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts.map +1 -0
  45. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js +72 -0
  46. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -0
  47. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  48. package/dist/features/blocks/client/nodes/BlocksNode.js +0 -10
  49. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  50. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  51. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +121 -78
  52. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  53. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +142 -87
  54. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  55. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  56. package/dist/features/blocks/server/nodes/BlocksNode.js +1 -12
  57. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  58. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +2 -2
  59. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  60. package/dist/features/blocks/server/schema.d.ts +2 -0
  61. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  62. package/dist/features/blocks/server/schema.js +7 -9
  63. package/dist/features/blocks/server/schema.js.map +1 -1
  64. package/dist/features/blocks/server/validate.js +1 -1
  65. package/dist/features/blocks/server/validate.js.map +1 -1
  66. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  67. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  68. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  69. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  70. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  71. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts.map +1 -1
  72. package/dist/features/converters/lexicalToHtml/async/converters/table.js +6 -4
  73. package/dist/features/converters/lexicalToHtml/async/converters/table.js.map +1 -1
  74. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts.map +1 -1
  75. package/dist/features/converters/lexicalToHtml/async/converters/upload.js +5 -4
  76. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  77. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  78. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  79. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  80. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  81. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  82. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts.map +1 -1
  83. package/dist/features/converters/lexicalToHtml/sync/converters/table.js +6 -4
  84. package/dist/features/converters/lexicalToHtml/sync/converters/table.js.map +1 -1
  85. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts.map +1 -1
  86. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +5 -4
  87. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  88. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  89. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  90. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  91. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  92. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  93. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  94. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  95. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  96. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts.map +1 -1
  97. package/dist/features/converters/lexicalToJSX/converter/converters/table.js +3 -2
  98. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  99. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  100. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +4 -5
  101. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  102. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  103. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  104. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  105. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  106. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  107. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  108. package/dist/features/heading/client/index.js.map +1 -1
  109. package/dist/features/heading/constants.d.ts +2 -0
  110. package/dist/features/heading/constants.d.ts.map +1 -0
  111. package/dist/features/heading/constants.js +2 -0
  112. package/dist/features/heading/constants.js.map +1 -0
  113. package/dist/features/heading/server/index.d.ts.map +1 -1
  114. package/dist/features/heading/server/index.js +5 -1
  115. package/dist/features/heading/server/index.js.map +1 -1
  116. package/dist/features/heading/server/validate.d.ts +6 -0
  117. package/dist/features/heading/server/validate.d.ts.map +1 -0
  118. package/dist/features/heading/server/validate.js +15 -0
  119. package/dist/features/heading/server/validate.js.map +1 -0
  120. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +11 -1
  121. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  122. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +17 -0
  123. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  124. package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
  125. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +2 -2
  126. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  127. package/dist/features/horizontalRule/server/schema.d.ts +1 -0
  128. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -1
  129. package/dist/features/horizontalRule/server/schema.js +6 -5
  130. package/dist/features/horizontalRule/server/schema.js.map +1 -1
  131. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  132. package/dist/features/indent/client/IndentPlugin.js +122 -1
  133. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  134. package/dist/features/indent/client/index.d.ts.map +1 -1
  135. package/dist/features/indent/client/index.js +0 -2
  136. package/dist/features/indent/client/index.js.map +1 -1
  137. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  138. package/dist/features/indent/server/i18n.js +74 -37
  139. package/dist/features/indent/server/i18n.js.map +1 -1
  140. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  141. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  142. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +20 -9
  143. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  144. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
  145. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  146. package/dist/features/link/markdownTransformer.js +2 -2
  147. package/dist/features/link/markdownTransformer.js.map +1 -1
  148. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  149. package/dist/features/link/nodes/AutoLinkNode.js +2 -10
  150. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  151. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  152. package/dist/features/link/nodes/LinkNode.js +2 -15
  153. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  154. package/dist/features/link/server/baseFields.js.map +1 -1
  155. package/dist/features/link/server/validate.js +1 -1
  156. package/dist/features/link/server/validate.js.map +1 -1
  157. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  158. package/dist/features/lists/checklist/server/index.js +5 -2
  159. package/dist/features/lists/checklist/server/index.js.map +1 -1
  160. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  161. package/dist/features/lists/orderedList/server/index.js +5 -2
  162. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  163. package/dist/features/lists/shared/constants.d.ts +2 -0
  164. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  165. package/dist/features/lists/shared/constants.js +2 -0
  166. package/dist/features/lists/shared/constants.js.map +1 -0
  167. package/dist/features/lists/shared/schema.d.ts.map +1 -1
  168. package/dist/features/lists/shared/schema.js.map +1 -1
  169. package/dist/features/lists/shared/validate.d.ts +5 -0
  170. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  171. package/dist/features/lists/shared/validate.js +15 -0
  172. package/dist/features/lists/shared/validate.js.map +1 -0
  173. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  174. package/dist/features/lists/unorderedList/server/index.js +5 -2
  175. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  176. package/dist/features/relationship/client/components/index.css +3 -6
  177. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  178. package/dist/features/relationship/client/index.d.ts +2 -2
  179. package/dist/features/relationship/client/index.d.ts.map +1 -1
  180. package/dist/features/relationship/client/index.js.map +1 -1
  181. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  182. package/dist/features/relationship/client/nodes/RelationshipNode.js +0 -3
  183. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  184. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  185. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  186. package/dist/features/relationship/client/plugins/index.js +27 -31
  187. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  188. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  189. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  190. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  191. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  192. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  193. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  194. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  195. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  196. package/dist/features/relationship/server/index.d.ts +8 -1
  197. package/dist/features/relationship/server/index.d.ts.map +1 -1
  198. package/dist/features/relationship/server/index.js +28 -11
  199. package/dist/features/relationship/server/index.js.map +1 -1
  200. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  201. package/dist/features/relationship/server/nodes/RelationshipNode.js +1 -5
  202. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  203. package/dist/features/relationship/server/schema.d.ts +3 -2
  204. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  205. package/dist/features/relationship/server/schema.js +9 -12
  206. package/dist/features/relationship/server/schema.js.map +1 -1
  207. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  208. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  209. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  210. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  211. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  212. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  213. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  214. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  215. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.css +1 -2
  216. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  217. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js +17 -44
  218. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  219. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  220. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js +48 -25
  221. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  222. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  223. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.css +0 -3
  224. package/dist/features/table/client/plugins/TablePlugin/index.js +54 -18
  225. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -1
  226. package/dist/features/table/client/utils/useDebounce.js.map +1 -1
  227. package/dist/features/table/server/index.d.ts.map +1 -1
  228. package/dist/features/table/server/index.js +3 -1
  229. package/dist/features/table/server/index.js.map +1 -1
  230. package/dist/features/table/server/validate.d.ts +4 -0
  231. package/dist/features/table/server/validate.d.ts.map +1 -0
  232. package/dist/features/table/server/validate.js +15 -0
  233. package/dist/features/table/server/validate.js.map +1 -0
  234. package/dist/features/textState/defaultColors.js +1 -1
  235. package/dist/features/textState/defaultColors.js.map +1 -1
  236. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -1
  237. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  238. package/dist/features/toolbars/fixed/client/Toolbar/index.js +141 -70
  239. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  240. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  241. package/dist/features/toolbars/inline/client/Toolbar/index.js +84 -37
  242. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  243. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  244. package/dist/features/toolbars/shared/ToolbarButton/index.js +27 -2
  245. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  246. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  247. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +199 -81
  248. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  249. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -12
  250. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  251. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +22 -6
  252. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  253. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts +5 -0
  254. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts.map +1 -0
  255. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js +109 -0
  256. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -0
  257. package/dist/features/typesServer.d.ts +16 -11
  258. package/dist/features/typesServer.d.ts.map +1 -1
  259. package/dist/features/typesServer.js.map +1 -1
  260. package/dist/features/upload/client/component/index.css +0 -2
  261. package/dist/features/upload/client/drawer/index.js.map +1 -1
  262. package/dist/features/upload/client/index.d.ts +3 -2
  263. package/dist/features/upload/client/index.d.ts.map +1 -1
  264. package/dist/features/upload/client/index.js.map +1 -1
  265. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  266. package/dist/features/upload/client/nodes/UploadNode.js +0 -7
  267. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  268. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  269. package/dist/features/upload/client/plugin/index.js +50 -53
  270. package/dist/features/upload/client/plugin/index.js.map +1 -1
  271. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  272. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  273. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  274. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  275. package/dist/features/upload/server/index.d.ts +7 -3
  276. package/dist/features/upload/server/index.d.ts.map +1 -1
  277. package/dist/features/upload/server/index.js +18 -14
  278. package/dist/features/upload/server/index.js.map +1 -1
  279. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  280. package/dist/features/upload/server/nodes/UploadNode.js +1 -9
  281. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  282. package/dist/features/upload/server/schema.d.ts +4 -16
  283. package/dist/features/upload/server/schema.d.ts.map +1 -1
  284. package/dist/features/upload/server/schema.js +8 -10
  285. package/dist/features/upload/server/schema.js.map +1 -1
  286. package/dist/features/upload/server/validate.d.ts +2 -2
  287. package/dist/features/upload/server/validate.d.ts.map +1 -1
  288. package/dist/features/upload/server/validate.js +4 -1
  289. package/dist/features/upload/server/validate.js.map +1 -1
  290. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  291. package/dist/field/Diff/converters/listitem/index.js +2 -1
  292. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  293. package/dist/field/Diff/converters/relationship/index.css +0 -1
  294. package/dist/field/Diff/converters/unknown/index.css +0 -1
  295. package/dist/field/Diff/converters/upload/index.css +0 -1
  296. package/dist/field/Diff/converters/upload/index.d.ts.map +1 -1
  297. package/dist/field/Diff/converters/upload/index.js +8 -7
  298. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  299. package/dist/field/Diff/index.css +0 -2
  300. package/dist/field/Diff/index.d.ts +3 -2
  301. package/dist/field/Diff/index.d.ts.map +1 -1
  302. package/dist/field/Diff/index.js +4 -2
  303. package/dist/field/Diff/index.js.map +1 -1
  304. package/dist/field/Field.d.ts.map +1 -1
  305. package/dist/field/Field.js +8 -1
  306. package/dist/field/Field.js.map +1 -1
  307. package/dist/field/RenderLexical/index.d.ts +3 -1
  308. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  309. package/dist/field/RenderLexical/index.js +23 -23
  310. package/dist/field/RenderLexical/index.js.map +1 -1
  311. package/dist/field/ViewSelector.d.ts.map +1 -1
  312. package/dist/field/ViewSelector.js +13 -4
  313. package/dist/field/ViewSelector.js.map +1 -1
  314. package/dist/field/bundled.css +1 -1
  315. package/dist/field/index.css +0 -1
  316. package/dist/field/index.js.map +1 -1
  317. package/dist/field/rscEntry.d.ts +2 -2
  318. package/dist/field/rscEntry.d.ts.map +1 -1
  319. package/dist/field/rscEntry.js.map +1 -1
  320. package/dist/i18n.d.ts.map +1 -1
  321. package/dist/i18n.js +44 -0
  322. package/dist/i18n.js.map +1 -1
  323. package/dist/index.d.ts +4 -4
  324. package/dist/index.d.ts.map +1 -1
  325. package/dist/index.js +23 -1
  326. package/dist/index.js.map +1 -1
  327. package/dist/lexical/LexicalEditor.css +21 -10
  328. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  329. package/dist/lexical/LexicalEditor.js +61 -64
  330. package/dist/lexical/LexicalEditor.js.map +1 -1
  331. package/dist/lexical/plugins/ClipboardPlugin/index.js.map +1 -1
  332. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
  333. package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
  334. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  335. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +2 -1
  336. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  337. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  338. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  339. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +235 -88
  340. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  341. package/dist/lexical/plugins/SlashMenu/index.css +0 -1
  342. package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js.map +1 -1
  343. package/dist/lexical/plugins/TextPlugin/index.js.map +1 -1
  344. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
  345. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  346. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  347. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +17 -0
  348. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  349. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +139 -37
  350. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  351. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts +7 -0
  352. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts.map +1 -0
  353. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js +15 -0
  354. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js.map +1 -0
  355. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  356. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  357. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +62 -0
  358. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  359. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  360. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  361. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  362. package/dist/lexical/theme/EditorTheme.css +0 -2
  363. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  364. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  365. package/dist/lexical/ui/ContentEditable.js +32 -11
  366. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  367. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  368. package/dist/lexical/ui/icons/H3/index.js +13 -6
  369. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  370. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  371. package/dist/lexical/ui/icons/H4/index.js +13 -6
  372. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  373. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  374. package/dist/lexical/ui/icons/H5/index.js +13 -6
  375. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  376. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  377. package/dist/lexical/ui/icons/H6/index.js +13 -6
  378. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  379. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  380. package/dist/lexical/utils/nodeFormat.js +0 -2
  381. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  382. package/dist/lexical/utils/url.d.ts.map +1 -1
  383. package/dist/lexical/utils/url.js +1 -1
  384. package/dist/lexical/utils/url.js.map +1 -1
  385. package/dist/populateGraphQL/populate.d.ts.map +1 -1
  386. package/dist/populateGraphQL/populate.js +4 -1
  387. package/dist/populateGraphQL/populate.js.map +1 -1
  388. package/dist/presets/llmInstructions.d.ts +2 -0
  389. package/dist/presets/llmInstructions.d.ts.map +1 -0
  390. package/dist/presets/llmInstructions.js +13 -0
  391. package/dist/presets/llmInstructions.js.map +1 -0
  392. package/dist/types/builtInNodes.d.ts +1 -1
  393. package/dist/types/builtInNodes.d.ts.map +1 -1
  394. package/dist/types/builtInNodes.js +8 -3
  395. package/dist/types/builtInNodes.js.map +1 -1
  396. package/dist/types/index.d.ts +3 -6
  397. package/dist/types/index.d.ts.map +1 -1
  398. package/dist/types/index.js.map +1 -1
  399. package/dist/types/jsonSchemaHelpers.d.ts +5 -1
  400. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  401. package/dist/types/jsonSchemaHelpers.js +7 -2
  402. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  403. package/dist/types/nodeTypes.d.ts +5 -0
  404. package/dist/types/nodeTypes.d.ts.map +1 -1
  405. package/dist/types/nodeTypes.js.map +1 -1
  406. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  407. package/dist/utilities/buildEditorState.js.map +1 -1
  408. package/dist/utilities/buildInitialState.d.ts +3 -2
  409. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  410. package/dist/utilities/buildInitialState.js +1 -0
  411. package/dist/utilities/buildInitialState.js.map +1 -1
  412. package/dist/utilities/fieldsDrawer/Drawer.js +36 -36
  413. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  414. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  415. package/dist/utilities/fieldsDrawer/DrawerContent.js +127 -107
  416. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  417. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -1
  418. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  419. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -1
  420. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  421. package/dist/utilities/generateImportMap.d.ts +2 -2
  422. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  423. package/dist/utilities/generateImportMap.js.map +1 -1
  424. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  425. package/dist/utilities/initLexicalFeatures.js +38 -4
  426. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  427. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  428. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  429. package/dist/utilities/useLexicalFeature.js +15 -6
  430. package/dist/utilities/useLexicalFeature.js.map +1 -1
  431. package/dist/utilities/useRunDeprioritized.js.map +1 -1
  432. package/dist/validate/hasText.d.ts +2 -2
  433. package/dist/validate/hasText.d.ts.map +1 -1
  434. package/dist/validate/hasText.js.map +1 -1
  435. package/dist/validate/index.d.ts +1 -1
  436. package/dist/validate/index.d.ts.map +1 -1
  437. package/package.json +51 -54
  438. package/dist/dependencyChecker.spec.js +0 -16
  439. package/dist/dependencyChecker.spec.js.map +0 -1
  440. package/dist/exports/client/Field-F22V5L4V.js +0 -2
  441. package/dist/exports/client/Field-F22V5L4V.js.map +0 -7
  442. package/dist/exports/client/bundled.css +0 -1
  443. package/dist/exports/client/chunk-43E5QYAA.js +0 -2
  444. package/dist/exports/client/chunk-43E5QYAA.js.map +0 -7
  445. package/dist/exports/client/chunk-ESITTE3C.js +0 -2
  446. package/dist/exports/client/chunk-ESITTE3C.js.map +0 -7
  447. package/dist/exports/client/chunk-LN6VX25I.js +0 -2
  448. package/dist/exports/client/chunk-LN6VX25I.js.map +0 -7
  449. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  450. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts +0 -11
  451. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts.map +0 -1
  452. package/dist/features/blocks/client/component/removeEmptyArrayValues.js +0 -20
  453. package/dist/features/blocks/client/component/removeEmptyArrayValues.js.map +0 -1
  454. package/dist/features/converters/lexicalToHtml/sync/alignment.spec.js +0 -92
  455. package/dist/features/converters/lexicalToHtml/sync/alignment.spec.js.map +0 -1
  456. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  457. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  458. package/dist/features/link/markdownTransformer.spec.js +0 -195
  459. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  460. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js +0 -65
  461. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js.map +0 -1
  462. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  463. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  464. package/dist/lexical/utils/url.spec.js +0 -114
  465. package/dist/lexical/utils/url.spec.js.map +0 -1
  466. package/dist/utilities/jsx/jsx.spec.js +0 -178
  467. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  468. /package/dist/exports/client/{RelationshipComponent-YCPAKOL7.js.map → RelationshipComponent-TVK6I4W4.js.map} +0 -0
  469. /package/dist/exports/client/{component-D5QLYS7W.js.map → component-FCCSBBZG.js.map} +0 -0
  470. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-7FQV2X7Z.js.map} +0 -0
@@ -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
- 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
+ import { Button, Collapsible, Drawer, EditDepthProvider, ErrorPill, Form, formatDrawerSlug, MoreIcon, Pill, Popup, PopupList, RenderFields, SectionTitle, useConfig, useDocumentForm, useDocumentInfo, useEditDepth, useFormSubmitted, useOperation, 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, getDataFromFormState } 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 } 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,
@@ -45,7 +47,6 @@ export const BlockComponent = props => {
45
47
  const {
46
48
  fields: parentDocumentFields
47
49
  } = useDocumentForm();
48
- const onChangeAbortControllerRef = useRef(new AbortController());
49
50
  const editDepth = useEditDepth();
50
51
  const [errorCount, setErrorCount] = React.useState(0);
51
52
  const {
@@ -67,32 +68,43 @@ export const BlockComponent = props => {
67
68
  } = useDocumentInfo();
68
69
  const [editor] = useLexicalComposerContext();
69
70
  const isEditable = useLexicalEditable();
71
+ const operation = useOperation();
70
72
  const blockType = formData.blockType;
73
+ const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`;
74
+ const clientSchemaMap = featureClientSchemaMap['blocks'];
75
+ const blocksField = clientSchemaMap?.[componentMapRenderedBlockPath]?.[0];
76
+ const blockOrSlug = blocksField?.blocks?.[0];
77
+ const clientBlock = typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug;
71
78
  const {
72
79
  getFormState
73
80
  } = useServerFunctions();
74
81
  const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}.fields`;
75
82
  const [initialState, setInitialState] = React.useState(() => {
76
83
  // Initial form state that was calculated server-side. May have stale values
77
- const cachedFormState = initialLexicalFormState?.[formData.id]?.formState;
84
+ const cachedState = initialLexicalFormState?.[formData.id];
85
+ const cachedFormState = cachedState?.formState;
78
86
  if (!cachedFormState) {
79
87
  return false;
80
88
  }
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]));
89
+ const matchingCachedState = getCachedFormStateIfDataMatches({
90
+ cachedFormState,
91
+ cachedSchemaPath: cachedState.schemaPath,
92
+ currentSchemaPath: schemaFieldsPath,
93
+ formData
94
+ });
95
+ if (!matchingCachedState) {
96
+ return false;
97
+ }
88
98
  // 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
99
+ return {
100
+ ...matchingCachedState,
101
+ blockName: {
102
+ initialValue: formData.blockName,
103
+ passesCondition: true,
104
+ valid: true,
105
+ value: formData.blockName
106
+ }
94
107
  };
95
- return mergedState;
96
108
  });
97
109
  const hasMounted = useRef(false);
98
110
  const prevCacheBuster = useRef(cacheBuster);
@@ -134,7 +146,7 @@ export const BlockComponent = props => {
134
146
  isEditor: true,
135
147
  isJSXConverter: false,
136
148
  nodeKey: nodeKey,
137
- // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call
149
+ // eslint-disable-next-line react-hooks/hooks -- intentionally passed as a prop for custom block components to call
138
150
  useBlockComponentContext: useBlockComponentContext
139
151
  });
140
152
  }
@@ -148,7 +160,7 @@ export const BlockComponent = props => {
148
160
  isEditor: true,
149
161
  isJSXConverter: false,
150
162
  nodeKey: nodeKey,
151
- // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call
163
+ // eslint-disable-next-line react-hooks/hooks -- intentionally passed as a prop for custom block components to call
152
164
  useBlockComponentContext: useBlockComponentContext
153
165
  });
154
166
  }
@@ -173,12 +185,10 @@ export const BlockComponent = props => {
173
185
  fields: true
174
186
  },
175
187
  docPreferences: await getDocPreferences(),
176
- documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {
177
- excludeFiles: true
178
- }),
188
+ documentFormState: parentDocumentFields,
179
189
  globalSlug,
180
190
  initialBlockData: formData,
181
- operation: 'update',
191
+ operation,
182
192
  readOnly: !isEditable,
183
193
  renderAllFields: true,
184
194
  schemaPath: schemaFieldsPath,
@@ -191,7 +201,7 @@ export const BlockComponent = props => {
191
201
  valid: true,
192
202
  value: formData.blockName
193
203
  };
194
- const newFormStateData = reduceFieldsToValues(deepCopyObjectSimpleWithoutReactComponents(state, {
204
+ const newFormStateData = getDataFromFormState(deepCopyObjectSimpleWithoutReactComponents(state, {
195
205
  excludeFiles: true
196
206
  }), true);
197
207
  // Things like default values may come back from the server => update the node with the new data
@@ -217,61 +227,24 @@ export const BlockComponent = props => {
217
227
  }
218
228
  }
219
229
  };
220
- if (formData && !initialState) {
230
+ if (clientBlock && formData && !initialState) {
221
231
  void awaitInitialState();
222
232
  }
223
233
  return () => {
224
234
  abortAndIgnore(abortController);
225
235
  };
226
- }, [getFormState, schemaFieldsPath, isEditable, id, CustomLabelFromProps, CustomBlockFromProps, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields, blockType]);
236
+ }, [getFormState, schemaFieldsPath, isEditable, id, CustomLabelFromProps, CustomBlockFromProps, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, operation, parentDocumentFields, blockType, clientBlock]);
227
237
  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
238
  const {
234
239
  i18n,
235
240
  t
236
241
  } = useTranslation();
237
- const onChange = useCallback(async ({
238
- formState: prevFormState,
239
- submit
240
- }) => {
241
- abortAndIgnore(onChangeAbortControllerRef.current);
242
- const controller = new AbortController();
243
- onChangeAbortControllerRef.current = controller;
244
- const {
245
- state: newFormState
246
- } = await getFormState({
247
- id,
248
- collectionSlug,
249
- docPermissions: {
250
- fields: true
251
- },
252
- docPreferences: await getDocPreferences(),
253
- documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {
254
- excludeFiles: true
255
- }),
256
- formState: prevFormState,
257
- globalSlug,
258
- initialBlockFormState: prevFormState,
259
- operation: 'update',
260
- readOnly: !isEditable,
261
- renderAllFields: submit ? true : false,
262
- schemaPath: schemaFieldsPath,
263
- signal: controller.signal
264
- });
265
- if (!newFormState) {
266
- return prevFormState;
267
- }
242
+ const applyServerState = useCallback((newFormState, prevFormState) => {
268
243
  if (prevFormState.blockName) {
269
244
  newFormState.blockName = prevFormState.blockName;
270
245
  }
271
- const newFormStateData_0 = reduceFieldsToValues(removeEmptyArrayValues({
272
- fields: deepCopyObjectSimpleWithoutReactComponents(newFormState, {
273
- excludeFiles: true
274
- })
246
+ const newFormStateData_0 = getDataFromFormState(deepCopyObjectSimpleWithoutReactComponents(newFormState, {
247
+ excludeFiles: true
275
248
  }), true);
276
249
  setTimeout(() => {
277
250
  editor.update(() => {
@@ -288,28 +261,22 @@ export const BlockComponent = props => {
288
261
  tag: SKIP_DOM_SELECTION_TAG
289
262
  });
290
263
  }, 0);
291
- if (submit) {
264
+ }, [blockType, editor, nodeKey]);
265
+ const onChange = useCallback(({
266
+ formState,
267
+ submitted: submitted_0
268
+ }) => {
269
+ applyServerState(formState, formState);
270
+ if (submitted_0) {
292
271
  if (!CustomLabelFromProps) {
293
- setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined);
272
+ setCustomLabel(formState._components?.customComponents?.BlockLabel ?? undefined);
294
273
  }
295
274
  if (!CustomBlockFromProps) {
296
- setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined);
297
- }
298
- let rowErrorCount = 0;
299
- for (const formField of Object.values(newFormState)) {
300
- if (formField?.valid === false) {
301
- rowErrorCount++;
302
- }
275
+ setCustomBlock(formState._components?.customComponents?.Block ?? undefined);
303
276
  }
304
- setErrorCount(rowErrorCount);
277
+ setErrorCount(Object.values(formState).filter(field => field.valid === false).length);
305
278
  }
306
- return newFormState;
307
- }, [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath, blockType, parentDocumentFields, isEditable, editor, nodeKey, CustomBlockFromProps, CustomLabelFromProps]);
308
- useEffect(() => {
309
- return () => {
310
- abortAndIgnore(onChangeAbortControllerRef.current);
311
- };
312
- }, []);
279
+ }, [applyServerState, CustomLabelFromProps, CustomBlockFromProps]);
313
280
  const removeBlock = useCallback(() => {
314
281
  editor.update(() => {
315
282
  $getNodeByKey(nodeKey)?.remove();
@@ -394,7 +361,7 @@ export const BlockComponent = props => {
394
361
  round: true,
395
362
  tooltip: "Remove Block"
396
363
  }), [baseClass, isEditable, removeBlock]);
397
- const BlockCollapsible = useMemo(() => ({
364
+ const BlockCollapsible = useMemo(() => function BlockCollapsible({
398
365
  Actions,
399
366
  children: children_0,
400
367
  className,
@@ -408,77 +375,133 @@ export const BlockComponent = props => {
408
375
  removeButton,
409
376
  showDragHandle = true,
410
377
  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
- })]
378
+ }) {
379
+ return /*#__PURE__*/_jsx(BlockReordering, {
380
+ editor: editor,
381
+ nodeKey: nodeKey,
382
+ children: ({
383
+ isReordering,
384
+ move,
385
+ onBlur,
386
+ onKeyDown,
387
+ reorderInstructionsID,
388
+ targetIndex
389
+ }) => /*#__PURE__*/_jsx("div", {
390
+ className: `${baseClass}__container ${baseClass}-${blockType}`,
391
+ onKeyDownCapture: event => {
392
+ const target = event.target;
393
+ if (event.altKey || event.ctrlKey || event.metaKey || target.closest('.collapsible')?.parentElement !== event.currentTarget) {
394
+ return;
395
+ }
396
+ // Handle controls before Lexical consumes keys using its retained text selection.
397
+ if (target.matches('.collapsible__drag') && (event.key !== 'Escape' || isReordering) && [' ', 'ArrowDown', 'ArrowUp', 'Enter', 'Escape', 'Tab'].includes(event.key)) {
398
+ onKeyDown(event);
399
+ event.stopPropagation();
400
+ } else if (event.key === 'Tab' && target.matches('.collapsible__toggle')) {
401
+ event.stopPropagation();
402
+ }
403
+ },
404
+ children: /*#__PURE__*/_jsxs(Collapsible, {
405
+ actions: typeof Actions !== 'undefined' ? Actions : isEditable ? /*#__PURE__*/_jsx(Popup, {
406
+ button: /*#__PURE__*/_jsx(MoreIcon, {}),
407
+ buttonAriaLabel: t('general:moreOptions'),
408
+ buttonClassName: `${baseClass}__actions-button`,
409
+ caret: false,
410
+ horizontalAlign: "right",
411
+ popupType: "menu",
412
+ render: ({
413
+ close
414
+ }) => /*#__PURE__*/_jsxs(PopupList.ButtonGroup, {
415
+ buttonSize: "medium",
416
+ children: [/*#__PURE__*/_jsx(PopupList.Button, {
417
+ onClick: () => {
418
+ close();
419
+ move({
420
+ direction: -1
421
+ });
422
+ },
423
+ children: t('general:moveUp')
424
+ }), /*#__PURE__*/_jsx(PopupList.Button, {
425
+ onClick: () => {
426
+ close();
427
+ move({
428
+ direction: 1
429
+ });
430
+ },
431
+ children: t('general:moveDown')
432
+ }), (resolvedCustomBlock && editButton !== false || !resolvedCustomBlock && editButton) && /*#__PURE__*/_jsx(PopupList.Button, {
433
+ onClick: () => {
434
+ toggleDrawer();
435
+ close();
436
+ },
437
+ children: t('general:edit')
438
+ }), removeButton !== false && /*#__PURE__*/_jsxs(PopupList.Button, {
439
+ onClick: () => {
440
+ removeBlock();
441
+ close();
442
+ },
443
+ children: [/*#__PURE__*/_jsx(XIcon, {}), t('general:remove')]
444
+ })]
445
+ }),
446
+ size: "large"
447
+ }) : null,
448
+ className: [`${baseClass}__row`, fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`, className].filter(Boolean).join(' '),
449
+ collapsibleStyle: fieldHasErrors ? 'error' : 'default',
450
+ dragHandleProps: showDragHandle && isEditable ? {
451
+ id: nodeKey,
452
+ attributes: {
453
+ 'aria-describedby': reorderInstructionsID,
454
+ 'aria-pressed': isReordering,
455
+ role: 'button',
456
+ tabIndex: 0
457
+ },
458
+ draggable: true,
459
+ listeners: {
460
+ onBlur
461
+ }
462
+ } : undefined,
463
+ header: /*#__PURE__*/_jsx("div", {
464
+ className: `${baseClass}__block-header`,
465
+ children: typeof Label !== 'undefined' ? Label : typeof resolvedCustomLabel !== 'undefined' ? resolvedCustomLabel : /*#__PURE__*/_jsxs("div", {
466
+ className: `${baseClass}__block-label`,
467
+ children: [showRowNumber && /*#__PURE__*/_jsx("span", {
468
+ className: `${baseClass}__block-number`,
469
+ children: String(rowIndex + 1).padStart(2, '0')
470
+ }), typeof CustomPill !== 'undefined' ? CustomPill : /*#__PURE__*/_jsx(Pill, {
471
+ className: `${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`,
472
+ pillStyle: "white",
473
+ size: "small",
474
+ children: blockDisplayName ?? blockType
475
+ }), !disableBlockName && !clientBlock?.admin?.disableBlockName && /*#__PURE__*/_jsx(SectionTitle, {
476
+ path: "blockName",
477
+ readOnly: !isEditable
478
+ }), fieldHasErrors && /*#__PURE__*/_jsx(BlockErrorPill, {
479
+ count: errorCount_0 ?? 0
480
+ })]
481
+ })
437
482
  }),
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
483
+ isCollapsed: isCollapsed,
484
+ onToggle: incomingCollapsedState => {
485
+ onCollapsedChange(incomingCollapsedState);
486
+ setIsCollapsed(incomingCollapsedState);
447
487
  },
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
488
+ ...(collapsibleProps || {}),
489
+ AfterCollapsible: /*#__PURE__*/_jsxs(_Fragment, {
490
+ children: [collapsibleProps?.AfterCollapsible, /*#__PURE__*/_jsx("span", {
491
+ className: "sr-only",
492
+ role: "status",
493
+ children: isReordering ? `${t('general:order')}: ${(targetIndex ?? 0) + 1}` : ''
469
494
  })]
470
- })
471
- }),
472
- isCollapsed: isCollapsed,
473
- onToggle: incomingCollapsedState => {
474
- onCollapsedChange(incomingCollapsedState);
475
- setIsCollapsed(incomingCollapsedState);
476
- },
477
- ...(collapsibleProps || {}),
478
- children: children_0
479
- }, 0)
495
+ }),
496
+ children: [/*#__PURE__*/_jsxs("span", {
497
+ className: "sr-only",
498
+ id: reorderInstructionsID,
499
+ children: ["Space / Enter · ", t('general:moveUp'), " ↑ · ", t('general:moveDown'), " ↓ ·", ' ', t('general:cancel'), " Escape"]
500
+ }), children_0]
501
+ }, 0)
502
+ })
480
503
  });
481
- }, [resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, i18n, isCollapsed, onCollapsedChange, isEditable, nodeKey, removeBlock, rowIndex, t, toggleDrawer]);
504
+ }, [editor, resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, isCollapsed, onCollapsedChange, isEditable, nodeKey, removeBlock, rowIndex, t, toggleDrawer]);
482
505
  const blockID = formData?.id;
483
506
  const {
484
507
  headerActions,
@@ -519,21 +542,13 @@ export const BlockComponent = props => {
519
542
  display: 'contents'
520
543
  },
521
544
  children: /*#__PURE__*/_jsx(Form, {
522
- beforeSubmit: [async ({
523
- formState
524
- }) => {
525
- // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
526
- return await onChange({
527
- formState,
528
- submit: true
529
- });
530
- }],
531
545
  el: "div",
532
546
  fields: clientBlock?.fields ?? [],
533
547
  initialState: initialState,
534
548
  onChange: [onChange],
535
- onSubmit: (formState_0, newData_1) => {
549
+ onSubmit: formState_0 => {
536
550
  // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
551
+ const newData_1 = getDataFromFormState(formState_0, true);
537
552
  newData_1.blockType = blockType;
538
553
  editor.update(() => {
539
554
  const node_1 = $getNodeByKey(nodeKey);
@@ -548,6 +563,8 @@ export const BlockComponent = props => {
548
563
  });
549
564
  toggleDrawer();
550
565
  },
566
+ readOnly: !isEditable,
567
+ schemaPath: schemaFieldsPath,
551
568
  submitted: submitted,
552
569
  uuid: formUuid,
553
570
  children: /*#__PURE__*/_jsx(BlockContent, {
@@ -565,7 +582,7 @@ export const BlockComponent = props => {
565
582
  })
566
583
  })
567
584
  });
568
- }, [BlockCollapsible, BlockDrawer, resolvedCustomBlock, resolvedCustomLabel, blockType, drawerSlug, RemoveButton, EditButton, baseClass, editor, errorCount, toggleDrawer, clientBlock?.fields, formUuid, initialState, nodeKey, onChange, submitted]);
585
+ }, [BlockCollapsible, BlockDrawer, resolvedCustomBlock, resolvedCustomLabel, blockType, drawerSlug, RemoveButton, EditButton, baseClass, editor, errorCount, toggleDrawer, clientBlock?.fields, formUuid, initialState, nodeKey, schemaFieldsPath, isEditable, onChange, submitted]);
569
586
  if (!clientBlock) {
570
587
  return /*#__PURE__*/_jsx(BlockCollapsible, {
571
588
  disableBlockName: true,
@@ -578,4 +595,32 @@ export const BlockComponent = props => {
578
595
  }
579
596
  return Block;
580
597
  };
598
+ /**
599
+ * Reads `i18n` itself so `BlockCollapsible` does not depend on it. `BlockCollapsible` is created in
600
+ * a `useMemo`, so each new `i18n` object (e.g. once the date-fns locale is set after mount) would
601
+ * remount the whole block, closing its open menus and dropping focus.
602
+ */
603
+ const BlockErrorPill = t0 => {
604
+ const $ = _c(3);
605
+ const {
606
+ count
607
+ } = t0;
608
+ const {
609
+ i18n
610
+ } = useTranslation();
611
+ let t1;
612
+ if ($[0] !== count || $[1] !== i18n) {
613
+ t1 = _jsx(ErrorPill, {
614
+ count,
615
+ i18n,
616
+ withMessage: true
617
+ });
618
+ $[0] = count;
619
+ $[1] = i18n;
620
+ $[2] = t1;
621
+ } else {
622
+ t1 = $[2];
623
+ }
624
+ return t1;
625
+ };
581
626
  //# sourceMappingURL=index.js.map