@payloadcms/richtext-lexical 4.0.0-internal.167c7cd → 4.0.0-internal.16f218d

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 (538) 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-BEKGION5.js +2 -0
  5. package/dist/exports/client/chunk-BEKGION5.js.map +7 -0
  6. package/dist/exports/client/{chunk-WSAPGI3Z.js → chunk-EA5BHQ2T.js} +1 -1
  7. package/dist/exports/client/{chunk-WSAPGI3Z.js.map → chunk-EA5BHQ2T.js.map} +1 -1
  8. package/dist/exports/client/chunk-FAJJXXCW.js +2 -0
  9. package/dist/exports/client/chunk-FAJJXXCW.js.map +7 -0
  10. package/dist/exports/client/{chunk-5VIL27GI.js → chunk-IYBYNEKX.js} +1 -1
  11. package/dist/exports/client/{chunk-5VIL27GI.js.map → chunk-IYBYNEKX.js.map} +1 -1
  12. package/dist/exports/client/chunk-SE5IITBK.js +2 -0
  13. package/dist/exports/client/chunk-SE5IITBK.js.map +7 -0
  14. package/dist/exports/client/{component-D5QLYS7W.js → component-QENB4QTS.js} +2 -2
  15. package/dist/exports/client/componentInline-AU7IBNY7.js +2 -0
  16. package/dist/exports/client/index.d.ts +1 -1
  17. package/dist/exports/client/index.d.ts.map +1 -1
  18. package/dist/exports/client/index.js +26 -26
  19. package/dist/exports/client/index.js.map +4 -4
  20. package/dist/features/align/client/index.js.map +1 -1
  21. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  22. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  23. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  24. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  25. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  26. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  27. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  28. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  29. package/dist/features/blocks/client/component/index.d.ts +0 -6
  30. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  31. package/dist/features/blocks/client/component/index.js +199 -109
  32. package/dist/features/blocks/client/component/index.js.map +1 -1
  33. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  34. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  35. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  36. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  37. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  38. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  39. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  40. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  41. package/dist/features/blocks/client/componentInline/index.css +0 -1
  42. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  43. package/dist/features/blocks/client/componentInline/index.js +32 -30
  44. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  45. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts +9 -0
  46. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts.map +1 -0
  47. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js +95 -0
  48. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -0
  49. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  50. package/dist/features/blocks/client/nodes/BlocksNode.js +0 -10
  51. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  52. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  53. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +121 -78
  54. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  55. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +142 -87
  56. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  57. package/dist/features/blocks/server/index.js +2 -2
  58. package/dist/features/blocks/server/index.js.map +1 -1
  59. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  60. package/dist/features/blocks/server/nodes/BlocksNode.js +1 -12
  61. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  62. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +2 -2
  63. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  64. package/dist/features/blocks/server/schema.d.ts +2 -0
  65. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  66. package/dist/features/blocks/server/schema.js +7 -9
  67. package/dist/features/blocks/server/schema.js.map +1 -1
  68. package/dist/features/blocks/server/validate.js +1 -1
  69. package/dist/features/blocks/server/validate.js.map +1 -1
  70. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  71. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  72. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  73. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  74. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  75. package/dist/features/converters/lexicalToHtml/async/converters/upload.js +3 -3
  76. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  77. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  78. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  79. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  80. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  81. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  82. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  83. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  84. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  85. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +3 -3
  86. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  87. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  88. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  89. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  90. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  91. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  92. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  93. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  94. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  95. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  96. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +4 -5
  97. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  98. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  99. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  100. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  101. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  102. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  103. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  104. package/dist/features/heading/client/index.js.map +1 -1
  105. package/dist/features/heading/constants.d.ts +2 -0
  106. package/dist/features/heading/constants.d.ts.map +1 -0
  107. package/dist/features/heading/constants.js +2 -0
  108. package/dist/features/heading/constants.js.map +1 -0
  109. package/dist/features/heading/server/index.d.ts.map +1 -1
  110. package/dist/features/heading/server/index.js +5 -1
  111. package/dist/features/heading/server/index.js.map +1 -1
  112. package/dist/features/heading/server/validate.d.ts +6 -0
  113. package/dist/features/heading/server/validate.d.ts.map +1 -0
  114. package/dist/features/heading/server/validate.js +15 -0
  115. package/dist/features/heading/server/validate.js.map +1 -0
  116. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +11 -1
  117. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  118. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +17 -0
  119. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  120. package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
  121. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +2 -2
  122. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  123. package/dist/features/horizontalRule/server/schema.d.ts +1 -0
  124. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -1
  125. package/dist/features/horizontalRule/server/schema.js +6 -5
  126. package/dist/features/horizontalRule/server/schema.js.map +1 -1
  127. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  128. package/dist/features/indent/client/IndentPlugin.js +122 -1
  129. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  130. package/dist/features/indent/client/index.d.ts.map +1 -1
  131. package/dist/features/indent/client/index.js +0 -2
  132. package/dist/features/indent/client/index.js.map +1 -1
  133. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  134. package/dist/features/indent/server/i18n.js +74 -37
  135. package/dist/features/indent/server/i18n.js.map +1 -1
  136. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  137. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  138. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +18 -7
  139. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  140. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
  141. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  142. package/dist/features/link/markdownTransformer.js +2 -2
  143. package/dist/features/link/markdownTransformer.js.map +1 -1
  144. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  145. package/dist/features/link/nodes/AutoLinkNode.js +2 -10
  146. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  147. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  148. package/dist/features/link/nodes/LinkNode.js +2 -15
  149. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  150. package/dist/features/link/server/baseFields.js.map +1 -1
  151. package/dist/features/link/server/index.js +2 -2
  152. package/dist/features/link/server/index.js.map +1 -1
  153. package/dist/features/link/server/validate.js +1 -1
  154. package/dist/features/link/server/validate.js.map +1 -1
  155. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  156. package/dist/features/lists/checklist/server/index.js +5 -2
  157. package/dist/features/lists/checklist/server/index.js.map +1 -1
  158. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  159. package/dist/features/lists/orderedList/server/index.js +5 -2
  160. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  161. package/dist/features/lists/shared/constants.d.ts +2 -0
  162. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  163. package/dist/features/lists/shared/constants.js +2 -0
  164. package/dist/features/lists/shared/constants.js.map +1 -0
  165. package/dist/features/lists/shared/schema.d.ts.map +1 -1
  166. package/dist/features/lists/shared/schema.js.map +1 -1
  167. package/dist/features/lists/shared/validate.d.ts +5 -0
  168. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  169. package/dist/features/lists/shared/validate.js +15 -0
  170. package/dist/features/lists/shared/validate.js.map +1 -0
  171. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  172. package/dist/features/lists/unorderedList/server/index.js +5 -2
  173. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  174. package/dist/features/relationship/client/components/index.css +3 -6
  175. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  176. package/dist/features/relationship/client/index.d.ts +2 -2
  177. package/dist/features/relationship/client/index.d.ts.map +1 -1
  178. package/dist/features/relationship/client/index.js.map +1 -1
  179. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  180. package/dist/features/relationship/client/nodes/RelationshipNode.js +0 -3
  181. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  182. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  183. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  184. package/dist/features/relationship/client/plugins/index.js +27 -31
  185. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  186. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  187. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  188. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  189. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  190. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  191. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  192. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  193. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  194. package/dist/features/relationship/server/index.d.ts +8 -1
  195. package/dist/features/relationship/server/index.d.ts.map +1 -1
  196. package/dist/features/relationship/server/index.js +28 -11
  197. package/dist/features/relationship/server/index.js.map +1 -1
  198. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  199. package/dist/features/relationship/server/nodes/RelationshipNode.js +1 -5
  200. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  201. package/dist/features/relationship/server/schema.d.ts +3 -2
  202. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  203. package/dist/features/relationship/server/schema.js +9 -12
  204. package/dist/features/relationship/server/schema.js.map +1 -1
  205. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  206. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  207. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  208. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  209. package/dist/features/table/client/index.d.ts.map +1 -0
  210. package/dist/features/table/client/index.js.map +1 -0
  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/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +1 -2
  216. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  217. package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +17 -44
  218. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  219. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  220. package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +47 -24
  221. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  222. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  223. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  224. package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -3
  225. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  226. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  227. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  228. package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +54 -18
  229. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  230. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  231. package/dist/features/table/client/utils/debounce.js.map +1 -0
  232. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  233. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  234. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  235. package/dist/features/table/markdownTransformer.js.map +1 -0
  236. package/dist/features/table/server/index.d.ts +3 -0
  237. package/dist/features/table/server/index.d.ts.map +1 -0
  238. package/dist/features/{experimental_table → table}/server/index.js +4 -4
  239. package/dist/features/table/server/index.js.map +1 -0
  240. package/dist/features/table/server/schema.d.ts.map +1 -0
  241. package/dist/features/table/server/schema.js.map +1 -0
  242. package/dist/features/textState/defaultColors.js +1 -1
  243. package/dist/features/textState/defaultColors.js.map +1 -1
  244. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  245. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  246. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  247. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  248. package/dist/features/toolbars/fixed/client/Toolbar/index.css +77 -3
  249. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  250. package/dist/features/toolbars/fixed/client/Toolbar/index.js +145 -71
  251. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  252. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  253. package/dist/features/toolbars/inline/client/Toolbar/index.js +84 -37
  254. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  255. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  256. package/dist/features/toolbars/shared/ToolbarButton/index.js +27 -2
  257. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  258. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  259. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +199 -81
  260. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  261. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -12
  262. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  263. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +22 -6
  264. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  265. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts +5 -0
  266. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts.map +1 -0
  267. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js +109 -0
  268. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -0
  269. package/dist/features/typesServer.d.ts +17 -12
  270. package/dist/features/typesServer.d.ts.map +1 -1
  271. package/dist/features/typesServer.js.map +1 -1
  272. package/dist/features/upload/client/component/index.css +0 -2
  273. package/dist/features/upload/client/drawer/index.js.map +1 -1
  274. package/dist/features/upload/client/index.d.ts +3 -2
  275. package/dist/features/upload/client/index.d.ts.map +1 -1
  276. package/dist/features/upload/client/index.js.map +1 -1
  277. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  278. package/dist/features/upload/client/nodes/UploadNode.js +0 -7
  279. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  280. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  281. package/dist/features/upload/client/plugin/index.js +50 -53
  282. package/dist/features/upload/client/plugin/index.js.map +1 -1
  283. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  284. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  285. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  286. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  287. package/dist/features/upload/server/index.d.ts +7 -3
  288. package/dist/features/upload/server/index.d.ts.map +1 -1
  289. package/dist/features/upload/server/index.js +20 -16
  290. package/dist/features/upload/server/index.js.map +1 -1
  291. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  292. package/dist/features/upload/server/nodes/UploadNode.js +1 -9
  293. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  294. package/dist/features/upload/server/schema.d.ts +4 -16
  295. package/dist/features/upload/server/schema.d.ts.map +1 -1
  296. package/dist/features/upload/server/schema.js +8 -10
  297. package/dist/features/upload/server/schema.js.map +1 -1
  298. package/dist/features/upload/server/validate.d.ts +2 -2
  299. package/dist/features/upload/server/validate.d.ts.map +1 -1
  300. package/dist/features/upload/server/validate.js +4 -1
  301. package/dist/features/upload/server/validate.js.map +1 -1
  302. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  303. package/dist/field/Diff/converters/listitem/index.js +2 -1
  304. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  305. package/dist/field/Diff/converters/relationship/index.css +0 -1
  306. package/dist/field/Diff/converters/unknown/index.css +0 -1
  307. package/dist/field/Diff/converters/upload/index.css +0 -1
  308. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  309. package/dist/field/Diff/index.css +0 -2
  310. package/dist/field/Diff/index.d.ts +3 -2
  311. package/dist/field/Diff/index.d.ts.map +1 -1
  312. package/dist/field/Diff/index.js +3 -2
  313. package/dist/field/Diff/index.js.map +1 -1
  314. package/dist/field/Field.d.ts.map +1 -1
  315. package/dist/field/Field.js +8 -1
  316. package/dist/field/Field.js.map +1 -1
  317. package/dist/field/RenderLexical/index.d.ts +3 -1
  318. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  319. package/dist/field/RenderLexical/index.js +23 -23
  320. package/dist/field/RenderLexical/index.js.map +1 -1
  321. package/dist/field/ViewSelector.d.ts.map +1 -1
  322. package/dist/field/ViewSelector.js +13 -4
  323. package/dist/field/ViewSelector.js.map +1 -1
  324. package/dist/field/bundled.css +1 -1
  325. package/dist/field/index.css +10 -11
  326. package/dist/field/index.js.map +1 -1
  327. package/dist/field/rscEntry.d.ts +2 -2
  328. package/dist/field/rscEntry.d.ts.map +1 -1
  329. package/dist/field/rscEntry.js.map +1 -1
  330. package/dist/i18n.d.ts.map +1 -1
  331. package/dist/i18n.js +112 -0
  332. package/dist/i18n.js.map +1 -1
  333. package/dist/index.d.ts +5 -5
  334. package/dist/index.d.ts.map +1 -1
  335. package/dist/index.js +27 -5
  336. package/dist/index.js.map +1 -1
  337. package/dist/lexical/LexicalEditor.css +21 -10
  338. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  339. package/dist/lexical/LexicalEditor.js +61 -64
  340. package/dist/lexical/LexicalEditor.js.map +1 -1
  341. package/dist/lexical/config/server/loader.d.ts +1 -1
  342. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  343. package/dist/lexical/config/server/loader.js +2 -2
  344. package/dist/lexical/config/server/loader.js.map +1 -1
  345. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  346. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  347. package/dist/lexical/config/server/sanitize.js +2 -2
  348. package/dist/lexical/config/server/sanitize.js.map +1 -1
  349. package/dist/lexical/plugins/ClipboardPlugin/index.js.map +1 -1
  350. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
  351. package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
  352. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  353. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +18 -24
  354. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  355. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  356. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  357. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  358. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  359. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +235 -88
  360. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  361. package/dist/lexical/plugins/SlashMenu/index.css +0 -1
  362. package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js.map +1 -1
  363. package/dist/lexical/plugins/TextPlugin/index.js.map +1 -1
  364. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
  365. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  366. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  367. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +17 -0
  368. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  369. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +139 -37
  370. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  371. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts +7 -0
  372. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts.map +1 -0
  373. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js +15 -0
  374. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js.map +1 -0
  375. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  376. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  377. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +62 -0
  378. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  379. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  380. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  381. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  382. package/dist/lexical/theme/EditorTheme.css +0 -2
  383. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  384. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  385. package/dist/lexical/ui/ContentEditable.js +32 -11
  386. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  387. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  388. package/dist/lexical/ui/icons/H3/index.js +13 -6
  389. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  390. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  391. package/dist/lexical/ui/icons/H4/index.js +13 -6
  392. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  393. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  394. package/dist/lexical/ui/icons/H5/index.js +13 -6
  395. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  396. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  397. package/dist/lexical/ui/icons/H6/index.js +13 -6
  398. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  399. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  400. package/dist/lexical/utils/nodeFormat.js +0 -2
  401. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  402. package/dist/lexical/utils/url.d.ts.map +1 -1
  403. package/dist/lexical/utils/url.js +1 -1
  404. package/dist/lexical/utils/url.js.map +1 -1
  405. package/dist/populateGraphQL/populate.js.map +1 -1
  406. package/dist/presets/llmInstructions.d.ts +2 -0
  407. package/dist/presets/llmInstructions.d.ts.map +1 -0
  408. package/dist/presets/llmInstructions.js +13 -0
  409. package/dist/presets/llmInstructions.js.map +1 -0
  410. package/dist/types/builtInNodes.d.ts +1 -1
  411. package/dist/types/builtInNodes.d.ts.map +1 -1
  412. package/dist/types/builtInNodes.js +8 -3
  413. package/dist/types/builtInNodes.js.map +1 -1
  414. package/dist/types/index.d.ts +4 -7
  415. package/dist/types/index.d.ts.map +1 -1
  416. package/dist/types/index.js.map +1 -1
  417. package/dist/types/jsonSchemaHelpers.d.ts +5 -1
  418. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  419. package/dist/types/jsonSchemaHelpers.js +7 -2
  420. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  421. package/dist/types/nodeTypes.d.ts +6 -1
  422. package/dist/types/nodeTypes.d.ts.map +1 -1
  423. package/dist/types/nodeTypes.js.map +1 -1
  424. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  425. package/dist/utilities/buildEditorState.js.map +1 -1
  426. package/dist/utilities/buildInitialState.d.ts +3 -2
  427. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  428. package/dist/utilities/buildInitialState.js +1 -0
  429. package/dist/utilities/buildInitialState.js.map +1 -1
  430. package/dist/utilities/createServerFeature.d.ts +1 -1
  431. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  432. package/dist/utilities/createServerFeature.js +2 -2
  433. package/dist/utilities/createServerFeature.js.map +1 -1
  434. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  435. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  436. package/dist/utilities/editorConfigFactory.js +9 -9
  437. package/dist/utilities/editorConfigFactory.js.map +1 -1
  438. package/dist/utilities/fieldsDrawer/Drawer.js +36 -36
  439. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  440. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  441. package/dist/utilities/fieldsDrawer/DrawerContent.js +6 -9
  442. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  443. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -1
  444. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  445. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -1
  446. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  447. package/dist/utilities/generateImportMap.d.ts +2 -2
  448. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  449. package/dist/utilities/generateImportMap.js.map +1 -1
  450. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  451. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  452. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  453. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  454. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  455. package/dist/utilities/initLexicalFeatures.js +38 -4
  456. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  457. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  458. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  459. package/dist/utilities/useLexicalFeature.js +15 -6
  460. package/dist/utilities/useLexicalFeature.js.map +1 -1
  461. package/dist/utilities/useRunDeprioritized.js.map +1 -1
  462. package/dist/validate/hasText.d.ts +2 -2
  463. package/dist/validate/hasText.d.ts.map +1 -1
  464. package/dist/validate/hasText.js.map +1 -1
  465. package/dist/validate/index.d.ts +1 -1
  466. package/dist/validate/index.d.ts.map +1 -1
  467. package/package.json +50 -53
  468. package/dist/dependencyChecker.spec.js +0 -16
  469. package/dist/dependencyChecker.spec.js.map +0 -1
  470. package/dist/exports/client/Field-IZKDIUJY.js +0 -2
  471. package/dist/exports/client/Field-IZKDIUJY.js.map +0 -7
  472. package/dist/exports/client/bundled.css +0 -1
  473. package/dist/exports/client/chunk-43E5QYAA.js +0 -2
  474. package/dist/exports/client/chunk-43E5QYAA.js.map +0 -7
  475. package/dist/exports/client/chunk-ESITTE3C.js +0 -2
  476. package/dist/exports/client/chunk-ESITTE3C.js.map +0 -7
  477. package/dist/exports/client/chunk-SSMQFWCQ.js +0 -2
  478. package/dist/exports/client/chunk-SSMQFWCQ.js.map +0 -7
  479. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  480. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts +0 -11
  481. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts.map +0 -1
  482. package/dist/features/blocks/client/component/removeEmptyArrayValues.js +0 -20
  483. package/dist/features/blocks/client/component/removeEmptyArrayValues.js.map +0 -1
  484. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  485. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  486. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  487. package/dist/features/experimental_table/client/index.js.map +0 -1
  488. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  489. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  490. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  491. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  492. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  493. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  494. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  495. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  496. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  497. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  498. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  499. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  500. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  501. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  502. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  503. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  504. package/dist/features/experimental_table/server/index.d.ts +0 -3
  505. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  506. package/dist/features/experimental_table/server/index.js.map +0 -1
  507. package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
  508. package/dist/features/experimental_table/server/schema.js.map +0 -1
  509. package/dist/features/link/markdownTransformer.spec.js +0 -195
  510. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  511. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  512. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  513. package/dist/lexical/utils/url.spec.js +0 -114
  514. package/dist/lexical/utils/url.spec.js.map +0 -1
  515. package/dist/utilities/jsx/jsx.spec.js +0 -178
  516. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  517. /package/dist/exports/client/{RelationshipComponent-YCPAKOL7.js.map → RelationshipComponent-TVK6I4W4.js.map} +0 -0
  518. /package/dist/exports/client/{component-D5QLYS7W.js.map → component-QENB4QTS.js.map} +0 -0
  519. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-AU7IBNY7.js.map} +0 -0
  520. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  521. /package/dist/features/{experimental_table → table}/client/index.js +0 -0
  522. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  523. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  524. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  525. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  526. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  527. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  528. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  529. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  530. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  531. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  532. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  533. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  534. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
  535. /package/dist/features/{experimental_table → table}/markdownTransformer.d.ts +0 -0
  536. /package/dist/features/{experimental_table → table}/markdownTransformer.js +0 -0
  537. /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
  538. /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$isDecoratorBlockNode","$findMatchingParent","$getSelection","$isElementNode","$isNodeSelection","$isRangeSelection","COMMAND_PRIORITY_LOW","FORMAT_ELEMENT_COMMAND","useEffect","AlignCenterIcon","AlignJustifyIcon","AlignLeftIcon","AlignRightIcon","createClientFeature","toolbarAlignGroupWithItems","getFormatType","node","__format","toolbarGroups","ChildComponent","isActive","selection","getNodes","parent","getParent","key","label","i18n","t","onSelect","editor","dispatchCommand","order","AlignPlugin","$","t0","t1","registerCommand","_temp2","AlignFeatureClient","plugins","Component","position","toolbarFixed","groups","toolbarInline","_temp","parentNode","isInline","format","nodes","element","setFormat"],"sources":["../../../../src/features/align/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'\nimport type { ElementFormatType, ElementNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $isDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'\nimport { $findMatchingParent } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isNodeSelection,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n FORMAT_ELEMENT_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\n\nimport { AlignCenterIcon } from '../../../lexical/ui/icons/AlignCenter/index.js'\nimport { AlignJustifyIcon } from '../../../lexical/ui/icons/AlignJustify/index.js'\nimport { AlignLeftIcon } from '../../../lexical/ui/icons/AlignLeft/index.js'\nimport { AlignRightIcon } from '../../../lexical/ui/icons/AlignRight/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { toolbarAlignGroupWithItems } from './toolbarAlignGroup.js'\n\n// DecoratorBlockNode has format, but Lexical forgot\n// to add the getters like ElementNode does.\nconst getFormatType = (node: DecoratorBlockNode | ElementNode): ElementFormatType => {\n if ($isElementNode(node)) {\n return node.getFormatType()\n }\n return node.__format\n}\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarAlignGroupWithItems([\n {\n ChildComponent: AlignLeftIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'left') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'left') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignLeft',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignLeftLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left')\n },\n order: 1,\n },\n {\n ChildComponent: AlignCenterIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'center') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'center') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignCenter',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignCenterLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center')\n },\n order: 2,\n },\n {\n ChildComponent: AlignRightIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'right') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'right') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignRight',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignRightLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right')\n },\n order: 3,\n },\n {\n ChildComponent: AlignJustifyIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'justify') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'justify') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignJustify',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignJustifyLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify')\n },\n order: 4,\n },\n ]),\n]\n\nconst AlignPlugin = () => {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n // Just like the default Lexical configuration, but in\n // addition to ElementNode we also set DecoratorBlocks\n return editor.registerCommand(\n FORMAT_ELEMENT_COMMAND,\n (format) => {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) && !$isNodeSelection(selection)) {\n return false\n }\n const nodes = selection.getNodes()\n for (const node of nodes) {\n const element = $findMatchingParent(\n node,\n (parentNode): parentNode is DecoratorBlockNode | ElementNode =>\n ($isElementNode(parentNode) || $isDecoratorBlockNode(parentNode)) &&\n !parentNode.isInline(),\n )\n if (element !== null) {\n element.setFormat(format)\n }\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n }, [editor])\n return null\n}\n\nexport const AlignFeatureClient = createClientFeature({\n plugins: [\n {\n Component: AlignPlugin,\n position: 'normal',\n },\n ],\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n})\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAKA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,mBAAmB,QAAQ;AACpC,SACEC,aAAa,EACbC,cAAc,EACdC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,QACjB;AACP,SAASC,SAAS,QAAQ;AAI1B,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,0BAA0B,QAAQ;AAE3C;AACA;AACA,MAAMC,aAAA,GAAiBC,IAAA;EACrB,IAAIb,cAAA,CAAea,IAAA,GAAO;IACxB,OAAOA,IAAA,CAAKD,aAAa;EAC3B;EACA,OAAOC,IAAA,CAAKC,QAAQ;AACtB;AAEA,MAAMC,aAAA,GAAgC,CACpCJ,0BAAA,CAA2B,CACzB;EACEK,cAAA,EAAgBR,aAAA;EAChBS,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAI,CAAChB,iBAAA,CAAkBgB,SAAA,GAAY;MACjC,OAAO;IACT;IACA,KAAK,MAAML,IAAA,IAAQK,SAAA,CAAUC,QAAQ,IAAI;MACvC,IAAInB,cAAA,CAAea,IAAA,KAAShB,qBAAA,CAAsBgB,IAAA,GAAO;QACvD,IAAID,aAAA,CAAcC,IAAA,MAAU,QAAQ;UAClC;QACF;MACF;MAEA,MAAMO,MAAA,GAASP,IAAA,CAAKQ,SAAS;MAC7B,IAAIrB,cAAA,CAAeoB,MAAA,KAAWvB,qBAAA,CAAsBuB,MAAA,GAAS;QAC3D,IAAIR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AC,QAAA,CAAkB;EAAA,KAC3B,MAAAN,IAAM,IAAQkC,KAAA;IACjB,MAAAC,OAAA,GAAgBlD,mBAAA,CACde,IAAA,EAAA8B,KAGsB;IAAA,IAEpBK,OAAA,SAAY;MACdA,OAAA,CAAAC,SAAA,CAAkBH,MAAA;IAAA;EAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$isDecoratorBlockNode","$findMatchingParent","$getSelection","$isElementNode","$isNodeSelection","$isRangeSelection","COMMAND_PRIORITY_LOW","FORMAT_ELEMENT_COMMAND","useEffect","AlignCenterIcon","AlignJustifyIcon","AlignLeftIcon","AlignRightIcon","createClientFeature","toolbarAlignGroupWithItems","getFormatType","node","__format","toolbarGroups","ChildComponent","isActive","selection","getNodes","parent","getParent","key","label","i18n","t","onSelect","editor","dispatchCommand","order","AlignPlugin","$","t0","t1","registerCommand","_temp2","AlignFeatureClient","plugins","Component","position","toolbarFixed","groups","toolbarInline","_temp","parentNode","isInline","format","nodes","element","setFormat"],"sources":["../../../../src/features/align/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'\nimport type { ElementFormatType, ElementNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $isDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'\nimport { $findMatchingParent } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isNodeSelection,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n FORMAT_ELEMENT_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\n\nimport { AlignCenterIcon } from '../../../lexical/ui/icons/AlignCenter/index.js'\nimport { AlignJustifyIcon } from '../../../lexical/ui/icons/AlignJustify/index.js'\nimport { AlignLeftIcon } from '../../../lexical/ui/icons/AlignLeft/index.js'\nimport { AlignRightIcon } from '../../../lexical/ui/icons/AlignRight/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { toolbarAlignGroupWithItems } from './toolbarAlignGroup.js'\n\n// DecoratorBlockNode has format, but Lexical forgot\n// to add the getters like ElementNode does.\nconst getFormatType = (node: DecoratorBlockNode | ElementNode): ElementFormatType => {\n if ($isElementNode(node)) {\n return node.getFormatType()\n }\n return node.__format\n}\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarAlignGroupWithItems([\n {\n ChildComponent: AlignLeftIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'left') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'left') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignLeft',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignLeftLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left')\n },\n order: 1,\n },\n {\n ChildComponent: AlignCenterIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'center') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'center') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignCenter',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignCenterLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center')\n },\n order: 2,\n },\n {\n ChildComponent: AlignRightIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'right') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'right') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignRight',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignRightLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right')\n },\n order: 3,\n },\n {\n ChildComponent: AlignJustifyIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node) || $isDecoratorBlockNode(node)) {\n if (getFormatType(node) === 'justify') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent) || $isDecoratorBlockNode(parent)) {\n if (getFormatType(parent) === 'justify') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignJustify',\n label: ({ i18n }) => {\n return i18n.t('lexical:align:alignJustifyLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify')\n },\n order: 4,\n },\n ]),\n]\n\nconst AlignPlugin = () => {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n // Just like the default Lexical configuration, but in\n // addition to ElementNode we also set DecoratorBlocks\n return editor.registerCommand(\n FORMAT_ELEMENT_COMMAND,\n (format) => {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) && !$isNodeSelection(selection)) {\n return false\n }\n const nodes = selection.getNodes()\n for (const node of nodes) {\n const element = $findMatchingParent(\n node,\n (parentNode): parentNode is DecoratorBlockNode | ElementNode =>\n ($isElementNode(parentNode) || $isDecoratorBlockNode(parentNode)) &&\n !parentNode.isInline(),\n )\n if (element !== null) {\n element.setFormat(format)\n }\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n }, [editor])\n return null\n}\n\nexport const AlignFeatureClient = createClientFeature({\n plugins: [\n {\n Component: AlignPlugin,\n position: 'normal',\n },\n ],\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n})\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAKA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,mBAAmB,QAAQ;AACpC,SACEC,aAAa,EACbC,cAAc,EACdC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,QACjB;AACP,SAASC,SAAS,QAAQ;AAI1B,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,0BAA0B,QAAQ;AAE3C;AACA;AACA,MAAMC,aAAA,GAAiBC,IAAA;EACrB,IAAIb,cAAA,CAAea,IAAA,GAAO;IACxB,OAAOA,IAAA,CAAKD,aAAa;EAC3B;EACA,OAAOC,IAAA,CAAKC,QAAQ;AACtB;AAEA,MAAMC,aAAA,GAAgC,CACpCJ,0BAAA,CAA2B,CACzB;EACEK,cAAA,EAAgBR,aAAA;EAChBS,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAI,CAAChB,iBAAA,CAAkBgB,SAAA,GAAY;MACjC,OAAO;IACT;IACA,KAAK,MAAML,IAAA,IAAQK,SAAA,CAAUC,QAAQ,IAAI;MACvC,IAAInB,cAAA,CAAea,IAAA,KAAShB,qBAAA,CAAsBgB,IAAA,GAAO;QACvD,IAAID,aAAA,CAAcC,IAAA,MAAU,QAAQ;UAClC;QACF;MACF;MAEA,MAAMO,MAAA,GAASP,IAAA,CAAKQ,SAAS;MAC7B,IAAIrB,cAAA,CAAeoB,MAAA,KAAWvB,qBAAA,CAAsBuB,MAAA,GAAS;QAC3D,IAAIR,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9C;EAAA;EAET,MAAA6B,KAAA,GAAc7B,SAAA,CAAAC,QAAkB;EAChC,KAAK,MAAAN,IAAM,IAAQkC,KAAA;IACjB,MAAAC,OAAA,GAAgBlD,mBAAA,CACde,IAAA,EACA8B,KAEsB;IAExB,IAAIK,OAAA,KAAY;MACdA,OAAA,CAAAC,SAAiB,CAACH,MAAA;IAAA;EACpB;EACF,OACO;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BlockContent.js","names":["c","_c","useLexicalEditable","RenderFields","useFormSubmitted","React","createContext","useMemo","BlockComponentContext","baseClass","BlockCollapsible","BlockDrawer","EditButton","errorCount","formSchema","initialState","nodeKey","RemoveButton","useBlockComponentContext","use","BlockContent","props","$","Collapsible","CustomBlock","CustomLabel","contextProps","hasSubmitted","fieldHasErrors","isEditable","t0","collapsibleProps","children","rest","_jsx","CollapsibleWithErrorProps","blockContextValue","_jsxs","value","fields","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleProps } from '@payloadcms/ui/elements/Collapsible'\nimport type { ClientField, FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { RenderFields, useFormSubmitted } from '@payloadcms/ui'\nimport React, { createContext, useMemo } from 'react'\n\nexport type BlockCollapsibleProps = {\n /**\n * Replace the top-right portion of the header that renders the Edit and Remove buttons with custom content.\n * If this property is provided, the `removeButton` and `editButton` properties are ignored.\n */\n Actions?: React.ReactNode\n children?: React.ReactNode\n /**\n * Additional className to the collapsible wrapper\n */\n className?: string\n /**\n * Props to pass to the underlying Collapsible component. You could use this to override the `Header` entirely, for example.\n */\n collapsibleProps?: Partial<CollapsibleProps>\n /**\n * Whether to disable rendering the block name field in the header Label\n * @default false\n */\n disableBlockName?: boolean\n /**\n * Whether to show the Edit button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n editButton?: boolean\n /**\n * Replace the default Label component with a custom Label\n */\n Label?: React.ReactNode\n /**\n * Replace the default Pill component component that's rendered within the default Label component with a custom Pill.\n * This property has no effect if you provide a custom Label component via the `Label` property.\n */\n Pill?: React.ReactNode\n /**\n * Whether to show the Remove button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n removeButton?: boolean\n /**\n * Whether to show the drag handle icon\n * @default true\n */\n showDragHandle?: boolean\n /**\n * Whether to show the row number\n * @default true\n */\n showRowNumber?: boolean\n}\n\nexport type BlockCollapsibleWithErrorProps = {\n errorCount?: number\n fieldHasErrors?: boolean\n} & BlockCollapsibleProps\n\nexport type BlockContentProps = {\n baseClass: string\n BlockDrawer: React.FC\n Collapsible: React.FC<BlockCollapsibleWithErrorProps>\n /**\n * Custom block component (pre-rendered ReactNode).\n */\n CustomBlock?: React.ReactNode\n CustomLabel: React.ReactNode\n EditButton: React.FC\n errorCount: number\n formSchema: ClientField[]\n initialState: false | FormState | undefined\n\n nodeKey: string\n RemoveButton: React.FC\n}\n\nexport type BlockComponentContextType = {\n BlockCollapsible: React.FC<BlockCollapsibleProps>\n} & Omit<BlockContentProps, 'Collapsible' | 'CustomBlock' | 'CustomLabel'>\n\nconst BlockComponentContext = createContext<BlockComponentContextType>({\n baseClass: 'LexicalEditorTheme__block',\n BlockCollapsible: () => null,\n BlockDrawer: () => null,\n EditButton: () => null,\n errorCount: 0,\n formSchema: [],\n initialState: false,\n nodeKey: '',\n RemoveButton: () => null,\n})\n\nexport const useBlockComponentContext = () => React.use(BlockComponentContext)\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<BlockContentProps> = (props) => {\n const { Collapsible, CustomBlock, CustomLabel, ...contextProps } = props\n\n const { BlockDrawer, errorCount, formSchema } = contextProps\n\n const hasSubmitted = useFormSubmitted()\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n const isEditable = useLexicalEditable()\n\n const CollapsibleWithErrorProps = useMemo(\n () => (collapsibleProps: BlockCollapsibleProps) => {\n const { children, ...rest } = collapsibleProps\n return (\n <Collapsible errorCount={errorCount} fieldHasErrors={fieldHasErrors} {...rest}>\n {children}\n </Collapsible>\n )\n },\n [Collapsible, fieldHasErrors, errorCount],\n )\n\n const blockContextValue: BlockComponentContextType = {\n ...contextProps,\n BlockCollapsible: CollapsibleWithErrorProps,\n }\n\n // Provide context for useBlockComponentContext() hook\n return CustomBlock ? (\n <BlockComponentContext value={blockContextValue}>\n {CustomBlock}\n <BlockDrawer />\n </BlockComponentContext>\n ) : (\n <CollapsibleWithErrorProps>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </CollapsibleWithErrorProps>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,EAAEC,gBAAgB,QAAQ;AAC/C,OAAOC,KAAA,IAASC,aAAa,EAAEC,OAAO,QAAQ;AAkF9C,MAAMC,qBAAA,gBAAwBF,aAAA,CAAyC;EACrEG,SAAA,EAAW;EACXC,gBAAA,EAAkBA,CAAA,KAAM;EACxBC,WAAA,EAAaA,CAAA,KAAM;EACnBC,UAAA,EAAYA,CAAA,KAAM;EAClBC,UAAA,EAAY;EACZC,UAAA,EAAY,EAAE;EACdC,YAAA,EAAc;EACdC,OAAA,EAAS;EACTC,YAAA,EAAcA,CAAA,KAAM;AACtB;AAEA,OAAO,MAAMC,wBAAA,GAA2BA,CAAA,KAAMb,KAAA,CAAMc,GAAG,CAACX,qBAAA;AAExD;;;;;AAKA,OAAO,MAAMY,YAAA,GAA4CC,KAAA;EAAA,MAAAC,CAAA,GAAArB,EAAA;EACvD;IAAAsB,WAAA;IAAAC,WAAA;IAAAC,WAAA;IAAA,GAAAC;EAAA,IAAmEL,KAAA;EAEnE;IAAAV,WAAA;IAAAE,UAAA;IAAAC;EAAA,IAAgDY,YAAA;EAEhD,MAAAC,YAAA,GAAqBvB,gBAAA;EAErB,MAAAwB,cAAA,GAAuBD,YAAA,IAAgBd,UAAA,IAAa;EACpD,MAAAgB,UAAA,GAAmB3B,kBAAA;EAAA,IAAA4B,EAAA;EAAA,IAAAR,CAAA,QAAAC,WAAA,IAAAD,CAAA,QAAAT,UAAA,IAAAS,CAAA,QAAAM,cAAA;IAGXE,EAAA,GAAAC,gBAAA;MACJ;QAAAC,QAAA;QAAA,GAAAC;MAAA,IAA8BF,gBAAA;MAAA,OAE5BG,IAAA,CAACX,WAAA;QAAAV,UAAA;QAAAe,cAAA;QAAA,GAAwEK,IAAI;QAAAD;MAAA,C;;IAIjFV,CAAA,MAAAC,WAAA;IAAAD,CAAA,MAAAT,UAAA;IAAAS,CAAA,MAAAM,cAAA;IAAAN,CAAA,MAAAQ,EAAA;EAAA;IAAAA,EAAA,GAAAR,CAAA;EAAA;EARF,MAAAa,yBAAA,GACQL,EAON;EAIF,MAAAM,iBAAA;IAAA,GACKV,YAAY;IAAAhB,gBAAA,EACGyB;EAAA;EACpB,OAGOX,WAAA,GACLa,KAAA,CAAA7B,qBAAA;IAAA8B,KAAA,EAA8BF,iBAAA;IAAAJ,QAAA,GAC3BR,WAAA,EACDU,IAAA,CAACvB,WAAA;EAAA,C,IAGHuB,IAAA,CAACC,yBAAA;IAAAH,QAAA,EACCE,IAAA,CAAA/B,YAAA;MAAAoC,MAAA,EACUzB,UAAA;MAAA0B,WAAA;MAAAC,eAAA,EAEQ;MAAAC,UAAA,EACJ;MAAAC,gBAAA,EACK;MAAAC,WAAA;MAAAC,QAAA,GAENhB;IAAA,C;;CAInB","ignoreList":[]}
1
+ {"version":3,"file":"BlockContent.js","names":["c","_c","useLexicalEditable","RenderFields","useFormSubmitted","React","createContext","useMemo","BlockComponentContext","baseClass","BlockCollapsible","BlockDrawer","EditButton","errorCount","formSchema","initialState","nodeKey","RemoveButton","useBlockComponentContext","use","BlockContent","props","$","Collapsible","CustomBlock","CustomLabel","contextProps","hasSubmitted","fieldHasErrors","isEditable","t0","collapsibleProps","children","rest","_jsx","CollapsibleWithErrorProps","blockContextValue","_jsxs","value","fields","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleProps } from '@payloadcms/ui/elements/Collapsible'\nimport type { ClientField, FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { RenderFields, useFormSubmitted } from '@payloadcms/ui'\nimport React, { createContext, useMemo } from 'react'\n\nexport type BlockCollapsibleProps = {\n /**\n * Replace the top-right portion of the header that renders the Edit and Remove buttons with custom content.\n * If this property is provided, the `removeButton` and `editButton` properties are ignored.\n */\n Actions?: React.ReactNode\n children?: React.ReactNode\n /**\n * Additional className to the collapsible wrapper\n */\n className?: string\n /**\n * Props to pass to the underlying Collapsible component. You could use this to override the `Header` entirely, for example.\n */\n collapsibleProps?: Partial<CollapsibleProps>\n /**\n * Whether to disable rendering the block name field in the header Label\n * @default false\n */\n disableBlockName?: boolean\n /**\n * Whether to show the Edit button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n editButton?: boolean\n /**\n * Replace the default Label component with a custom Label\n */\n Label?: React.ReactNode\n /**\n * Replace the default Pill component component that's rendered within the default Label component with a custom Pill.\n * This property has no effect if you provide a custom Label component via the `Label` property.\n */\n Pill?: React.ReactNode\n /**\n * Whether to show the Remove button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n removeButton?: boolean\n /**\n * Whether to show the drag handle icon\n * @default true\n */\n showDragHandle?: boolean\n /**\n * Whether to show the row number\n * @default true\n */\n showRowNumber?: boolean\n}\n\nexport type BlockCollapsibleWithErrorProps = {\n errorCount?: number\n fieldHasErrors?: boolean\n} & BlockCollapsibleProps\n\nexport type BlockContentProps = {\n baseClass: string\n BlockDrawer: React.FC\n Collapsible: React.FC<BlockCollapsibleWithErrorProps>\n /**\n * Custom block component (pre-rendered ReactNode).\n */\n CustomBlock?: React.ReactNode\n CustomLabel: React.ReactNode\n EditButton: React.FC\n errorCount: number\n formSchema: ClientField[]\n initialState: false | FormState | undefined\n\n nodeKey: string\n RemoveButton: React.FC\n}\n\nexport type BlockComponentContextType = {\n BlockCollapsible: React.FC<BlockCollapsibleProps>\n} & Omit<BlockContentProps, 'Collapsible' | 'CustomBlock' | 'CustomLabel'>\n\nconst BlockComponentContext = createContext<BlockComponentContextType>({\n baseClass: 'LexicalEditorTheme__block',\n BlockCollapsible: () => null,\n BlockDrawer: () => null,\n EditButton: () => null,\n errorCount: 0,\n formSchema: [],\n initialState: false,\n nodeKey: '',\n RemoveButton: () => null,\n})\n\nexport const useBlockComponentContext = () => React.use(BlockComponentContext)\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<BlockContentProps> = (props) => {\n const { Collapsible, CustomBlock, CustomLabel, ...contextProps } = props\n\n const { BlockDrawer, errorCount, formSchema } = contextProps\n\n const hasSubmitted = useFormSubmitted()\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n const isEditable = useLexicalEditable()\n\n const CollapsibleWithErrorProps = useMemo(\n () => (collapsibleProps: BlockCollapsibleProps) => {\n const { children, ...rest } = collapsibleProps\n return (\n <Collapsible errorCount={errorCount} fieldHasErrors={fieldHasErrors} {...rest}>\n {children}\n </Collapsible>\n )\n },\n [Collapsible, fieldHasErrors, errorCount],\n )\n\n const blockContextValue: BlockComponentContextType = {\n ...contextProps,\n BlockCollapsible: CollapsibleWithErrorProps,\n }\n\n // Provide context for useBlockComponentContext() hook\n return CustomBlock ? (\n <BlockComponentContext value={blockContextValue}>\n {CustomBlock}\n <BlockDrawer />\n </BlockComponentContext>\n ) : (\n <CollapsibleWithErrorProps>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </CollapsibleWithErrorProps>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,EAAEC,gBAAgB,QAAQ;AAC/C,OAAOC,KAAA,IAASC,aAAa,EAAEC,OAAO,QAAQ;AAkF9C,MAAMC,qBAAA,gBAAwBF,aAAA,CAAyC;EACrEG,SAAA,EAAW;EACXC,gBAAA,EAAkBA,CAAA,KAAM;EACxBC,WAAA,EAAaA,CAAA,KAAM;EACnBC,UAAA,EAAYA,CAAA,KAAM;EAClBC,UAAA,EAAY;EACZC,UAAA,EAAY,EAAE;EACdC,YAAA,EAAc;EACdC,OAAA,EAAS;EACTC,YAAA,EAAcA,CAAA,KAAM;AACtB;AAEA,OAAO,MAAMC,wBAAA,GAA2BA,CAAA,KAAMb,KAAA,CAAMc,GAAG,CAACX,qBAAA;AAExD;;;;;AAKA,OAAO,MAAMY,YAAA,GAA4CC,KAAA;EAAA,MAAAC,CAAA,GAAArB,EAAA;EACvD;IAAAsB,WAAA;IAAAC,WAAA;IAAAC,WAAA;IAAA,GAAAC;EAAA,IAAmEL,KAAA;EAEnE;IAAAV,WAAA;IAAAE,UAAA;IAAAC;EAAA,IAAgDY,YAAA;EAEhD,MAAAC,YAAA,GAAqBvB,gBAAA;EAErB,MAAAwB,cAAA,GAAuBD,YAA6B,IAAbd,UAAA,GAAa;EACpD,MAAAgB,UAAA,GAAmB3B,kBAAA;EAAA,IAAA4B,EAAA;EAAA,IAAAR,CAAA,QAAAC,WAAA,IAAAD,CAAA,QAAAT,UAAA,IAAAS,CAAA,QAAAM,cAAA;IAGXE,EAAA,GAAAC,gBAAA;MACJ;QAAAC,QAAA;QAAA,GAAAC;MAAA,IAA8BF,gBAAA;MAAA,OAE5BG,IAAA,CAACX,WAAA;QAAAV,UAAA;QAAAe,cAAA;QAAA,GAAwEK,IAAI;QAAAD;;KAIjF;IAAAV,CAAA,MAAAC,WAAA;IAAAD,CAAA,MAAAT,UAAA;IAAAS,CAAA,MAAAM,cAAA;IAAAN,CAAA,MAAAQ,EAAA;EAAA;IAAAA,EAAA,GAAAR,CAAA;EAAA;EARF,MAAAa,yBAAA,GACQL,EAON;EAIF,MAAAM,iBAAA,GAAqD;IAAA,GAChDV,YAAY;IAAAhB,gBAAA,EACGyB;EACpB;EAAA,OAGOX,WAAA,GACLa,KAAA,CAAC7B,qBAAA;IAAA8B,KAAA,EAA6BF,iBAAA;IAAAJ,QAAA,E,CAC3BR,WAAA,EACDU,IAAA,CAACvB,WAAA;OAGHuB,IAAA,CAACC,yBAAA;IAAAH,QAAA,EACCE,IAAA,CAAC/B,YAAA;MAAAoC,MAAA,EACSzB,UAAA;MAAA0B,WAAA,EACK;MAAAC,eAAA,EACG;MAAAC,UAAA,EACJ;MAAAC,gBAAA,EACK;MAAAC,WAAA,EACJ;MAAAC,QAAA,EACH,CAAChB;;;CAInB","ignoreList":[]}
@@ -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":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BlockCollapsible.js","names":["React","useBlockComponentContext","BlockCollapsible","props","children","rest","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockCollapsible.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { type BlockCollapsibleProps, useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockCollapsible: React.FC<BlockCollapsibleProps> = (props) => {\n const { children, ...rest } = props\n const { BlockCollapsible } = useBlockComponentContext()\n\n return BlockCollapsible ? <BlockCollapsible {...rest}>{children}</BlockCollapsible> : null\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,SAAqCC,wBAAwB,QAAQ;AAErE,OAAO,MAAMC,gBAAA,GAAoDC,KAAA;EAC/D;IAAAC,QAAA;IAAA,GAAAC;EAAA,IAA8BF,KAAA;EAC9B;IAAAD;EAAA,IAA6BD,wBAAA;EAAA,OAEtBC,gBAAA,GAAmBI,IAAA,CAACJ,gBAAA;IAAA,GAAqBG,IAAI;IAAAD;EAAA,C,QAAkC;AAAA,CACxF","ignoreList":[]}
1
+ {"version":3,"file":"BlockCollapsible.js","names":["React","useBlockComponentContext","BlockCollapsible","props","children","rest","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockCollapsible.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { type BlockCollapsibleProps, useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockCollapsible: React.FC<BlockCollapsibleProps> = (props) => {\n const { children, ...rest } = props\n const { BlockCollapsible } = useBlockComponentContext()\n\n return BlockCollapsible ? <BlockCollapsible {...rest}>{children}</BlockCollapsible> : null\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,SAAqCC,wBAAwB,QAAQ;AAErE,OAAO,MAAMC,gBAAA,GAAoDC,KAAA;EAC/D;IAAAC,QAAA;IAAA,GAAAC;EAAA,IAA8BF,KAAA;EAC9B;IAAAD;EAAA,IAA6BD,wBAAA;EAAA,OAEtBC,gBAAA,GAAmBI,IAAA,CAACJ,gBAAA;IAAA,GAAqBG,IAAI;IAAAD;GAAkC,IAA/E,IAA+E;AAAA,CACxF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BlockEditButton.js","names":["c","_c","React","useBlockComponentContext","BlockEditButton","$","EditButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockEditButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockEditButton = () => {\n const { EditButton } = useBlockComponentContext()\n\n return EditButton ? <EditButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,eAAA,GAAkBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EAC7B;IAAAK;EAAA,IAAuBH,wBAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,UAAA;IAEhBC,EAAA,GAAAD,UAAA,GAAaE,IAAA,CAACF,UAAA,YAAgB;IAAAD,CAAA,MAAAC,UAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAA9BE,EAA8B;AAAA,CACvC","ignoreList":[]}
1
+ {"version":3,"file":"BlockEditButton.js","names":["c","_c","React","useBlockComponentContext","BlockEditButton","$","EditButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockEditButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockEditButton = () => {\n const { EditButton } = useBlockComponentContext()\n\n return EditButton ? <EditButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,eAAA,GAAkBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EAC7B;IAAAK;EAAA,IAAuBH,wBAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,UAAA;IAEhBC,EAAA,GAAAD,UAAA,GAAaE,IAAA,CAACF,UAAA,IAAgB,IAA9B,IAA8B;IAAAD,CAAA,MAAAC,UAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAA9BE,EAA8B;AAAA,CACvC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BlockRemoveButton.js","names":["c","_c","React","useBlockComponentContext","BlockRemoveButton","$","RemoveButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockRemoveButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockRemoveButton = () => {\n const { RemoveButton } = useBlockComponentContext()\n\n return RemoveButton ? <RemoveButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,iBAAA,GAAoBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EAC/B;IAAAK;EAAA,IAAyBH,wBAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,YAAA;IAElBC,EAAA,GAAAD,YAAA,GAAeE,IAAA,CAACF,YAAA,YAAkB;IAAAD,CAAA,MAAAC,YAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAAlCE,EAAkC;AAAA,CAC3C","ignoreList":[]}
1
+ {"version":3,"file":"BlockRemoveButton.js","names":["c","_c","React","useBlockComponentContext","BlockRemoveButton","$","RemoveButton","t0","_jsx"],"sources":["../../../../../../src/features/blocks/client/component/components/BlockRemoveButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockRemoveButton = () => {\n const { RemoveButton } = useBlockComponentContext()\n\n return RemoveButton ? <RemoveButton /> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,iBAAA,GAAoBA,CAAA;EAAA,MAAAC,CAAA,GAAAJ,EAAA;EAC/B;IAAAK;EAAA,IAAyBH,wBAAA;EAAA,IAAAI,EAAA;EAAA,IAAAF,CAAA,QAAAC,YAAA;IAElBC,EAAA,GAAAD,YAAA,GAAeE,IAAA,CAACF,YAAA,IAAkB,IAAlC,IAAkC;IAAAD,CAAA,MAAAC,YAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAAlCE,EAAkC;AAAA,CAC3C","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,O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AAS,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,CA0yBxD,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);
@@ -134,7 +148,7 @@ export const BlockComponent = props => {
134
148
  isEditor: true,
135
149
  isJSXConverter: false,
136
150
  nodeKey: nodeKey,
137
- // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call
151
+ // eslint-disable-next-line react-hooks/hooks -- intentionally passed as a prop for custom block components to call
138
152
  useBlockComponentContext: useBlockComponentContext
139
153
  });
140
154
  }
@@ -148,7 +162,7 @@ export const BlockComponent = props => {
148
162
  isEditor: true,
149
163
  isJSXConverter: false,
150
164
  nodeKey: nodeKey,
151
- // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call
165
+ // eslint-disable-next-line react-hooks/hooks -- intentionally passed as a prop for custom block components to call
152
166
  useBlockComponentContext: useBlockComponentContext
153
167
  });
154
168
  }
@@ -173,9 +187,7 @@ export const BlockComponent = props => {
173
187
  fields: true
174
188
  },
175
189
  docPreferences: await getDocPreferences(),
176
- documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {
177
- excludeFiles: true
178
- }),
190
+ documentFormState: parentDocumentFields,
179
191
  globalSlug,
180
192
  initialBlockData: formData,
181
193
  operation: 'update',
@@ -191,9 +203,9 @@ export const BlockComponent = props => {
191
203
  valid: true,
192
204
  value: formData.blockName
193
205
  };
194
- const newFormStateData = reduceFieldsToValues(deepCopyObjectSimpleWithoutReactComponents(state, {
206
+ const newFormStateData = reduceFormStateToBlockData(deepCopyObjectSimpleWithoutReactComponents(state, {
195
207
  excludeFiles: true
196
- }), true);
208
+ }));
197
209
  // Things like default values may come back from the server => update the node with the new data
198
210
  editor.update(() => {
199
211
  const node = $getNodeByKey(nodeKey);
@@ -217,19 +229,14 @@ export const BlockComponent = props => {
217
229
  }
218
230
  }
219
231
  };
220
- if (formData && !initialState) {
232
+ if (clientBlock && formData && !initialState) {
221
233
  void awaitInitialState();
222
234
  }
223
235
  return () => {
224
236
  abortAndIgnore(abortController);
225
237
  };
226
- }, [getFormState, schemaFieldsPath, isEditable, id, CustomLabelFromProps, CustomBlockFromProps, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields, blockType]);
238
+ }, [getFormState, schemaFieldsPath, isEditable, id, CustomLabelFromProps, CustomBlockFromProps, formData, editor, nodeKey, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields, blockType, clientBlock]);
227
239
  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
240
  const {
234
241
  i18n,
235
242
  t
@@ -241,21 +248,21 @@ export const BlockComponent = props => {
241
248
  abortAndIgnore(onChangeAbortControllerRef.current);
242
249
  const controller = new AbortController();
243
250
  onChangeAbortControllerRef.current = controller;
251
+ const blockData = reduceFormStateToBlockData(prevFormState, formDataRef.current);
244
252
  const {
245
253
  state: newFormState
246
254
  } = await getFormState({
247
255
  id,
248
256
  collectionSlug,
257
+ data: blockData,
249
258
  docPermissions: {
250
259
  fields: true
251
260
  },
252
261
  docPreferences: await getDocPreferences(),
253
- documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {
254
- excludeFiles: true
255
- }),
262
+ documentFormState: parentDocumentFields,
256
263
  formState: prevFormState,
257
264
  globalSlug,
258
- initialBlockFormState: prevFormState,
265
+ initialBlockData: blockData,
259
266
  operation: 'update',
260
267
  readOnly: !isEditable,
261
268
  renderAllFields: submit ? true : false,
@@ -268,11 +275,9 @@ export const BlockComponent = props => {
268
275
  if (prevFormState.blockName) {
269
276
  newFormState.blockName = prevFormState.blockName;
270
277
  }
271
- const newFormStateData_0 = reduceFieldsToValues(removeEmptyArrayValues({
272
- fields: deepCopyObjectSimpleWithoutReactComponents(newFormState, {
273
- excludeFiles: true
274
- })
275
- }), true);
278
+ const newFormStateData_0 = reduceFormStateToBlockData(deepCopyObjectSimpleWithoutReactComponents(newFormState, {
279
+ excludeFiles: true
280
+ }), blockData);
276
281
  setTimeout(() => {
277
282
  editor.update(() => {
278
283
  const node_0 = $getNodeByKey(nodeKey);
@@ -394,7 +399,7 @@ export const BlockComponent = props => {
394
399
  round: true,
395
400
  tooltip: "Remove Block"
396
401
  }), [baseClass, isEditable, removeBlock]);
397
- const BlockCollapsible = useMemo(() => ({
402
+ const BlockCollapsible = useMemo(() => function BlockCollapsible({
398
403
  Actions,
399
404
  children: children_0,
400
405
  className,
@@ -408,77 +413,133 @@ export const BlockComponent = props => {
408
413
  removeButton,
409
414
  showDragHandle = true,
410
415
  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
- })]
416
+ }) {
417
+ return /*#__PURE__*/_jsx(BlockReordering, {
418
+ editor: editor,
419
+ nodeKey: nodeKey,
420
+ children: ({
421
+ isReordering,
422
+ move,
423
+ onBlur,
424
+ onKeyDown,
425
+ reorderInstructionsID,
426
+ targetIndex
427
+ }) => /*#__PURE__*/_jsx("div", {
428
+ className: `${baseClass}__container ${baseClass}-${blockType}`,
429
+ onKeyDownCapture: event => {
430
+ const target = event.target;
431
+ if (event.altKey || event.ctrlKey || event.metaKey || target.closest('.collapsible')?.parentElement !== event.currentTarget) {
432
+ return;
433
+ }
434
+ // Handle controls before Lexical consumes keys using its retained text selection.
435
+ if (target.matches('.collapsible__drag') && (event.key !== 'Escape' || isReordering) && [' ', 'ArrowDown', 'ArrowUp', 'Enter', 'Escape', 'Tab'].includes(event.key)) {
436
+ onKeyDown(event);
437
+ event.stopPropagation();
438
+ } else if (event.key === 'Tab' && target.matches('.collapsible__toggle')) {
439
+ event.stopPropagation();
440
+ }
441
+ },
442
+ children: /*#__PURE__*/_jsxs(Collapsible, {
443
+ actions: typeof Actions !== 'undefined' ? Actions : isEditable ? /*#__PURE__*/_jsx(Popup, {
444
+ button: /*#__PURE__*/_jsx(MoreIcon, {}),
445
+ buttonAriaLabel: t('general:moreOptions'),
446
+ buttonClassName: `${baseClass}__actions-button`,
447
+ caret: false,
448
+ horizontalAlign: "right",
449
+ popupType: "menu",
450
+ render: ({
451
+ close
452
+ }) => /*#__PURE__*/_jsxs(PopupList.ButtonGroup, {
453
+ buttonSize: "medium",
454
+ children: [/*#__PURE__*/_jsx(PopupList.Button, {
455
+ onClick: () => {
456
+ close();
457
+ move({
458
+ direction: -1
459
+ });
460
+ },
461
+ children: t('general:moveUp')
462
+ }), /*#__PURE__*/_jsx(PopupList.Button, {
463
+ onClick: () => {
464
+ close();
465
+ move({
466
+ direction: 1
467
+ });
468
+ },
469
+ children: t('general:moveDown')
470
+ }), (resolvedCustomBlock && editButton !== false || !resolvedCustomBlock && editButton) && /*#__PURE__*/_jsx(PopupList.Button, {
471
+ onClick: () => {
472
+ toggleDrawer();
473
+ close();
474
+ },
475
+ children: t('general:edit')
476
+ }), removeButton !== false && /*#__PURE__*/_jsxs(PopupList.Button, {
477
+ onClick: () => {
478
+ removeBlock();
479
+ close();
480
+ },
481
+ children: [/*#__PURE__*/_jsx(XIcon, {}), t('general:remove')]
482
+ })]
483
+ }),
484
+ size: "large"
485
+ }) : null,
486
+ className: [`${baseClass}__row`, fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`, className].filter(Boolean).join(' '),
487
+ collapsibleStyle: fieldHasErrors ? 'error' : 'default',
488
+ dragHandleProps: showDragHandle && isEditable ? {
489
+ id: nodeKey,
490
+ attributes: {
491
+ 'aria-describedby': reorderInstructionsID,
492
+ 'aria-pressed': isReordering,
493
+ role: 'button',
494
+ tabIndex: 0
495
+ },
496
+ draggable: true,
497
+ listeners: {
498
+ onBlur
499
+ }
500
+ } : undefined,
501
+ header: /*#__PURE__*/_jsx("div", {
502
+ className: `${baseClass}__block-header`,
503
+ children: typeof Label !== 'undefined' ? Label : typeof resolvedCustomLabel !== 'undefined' ? resolvedCustomLabel : /*#__PURE__*/_jsxs("div", {
504
+ className: `${baseClass}__block-label`,
505
+ children: [showRowNumber && /*#__PURE__*/_jsx("span", {
506
+ className: `${baseClass}__block-number`,
507
+ children: String(rowIndex + 1).padStart(2, '0')
508
+ }), typeof CustomPill !== 'undefined' ? CustomPill : /*#__PURE__*/_jsx(Pill, {
509
+ className: `${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`,
510
+ pillStyle: "white",
511
+ size: "small",
512
+ children: blockDisplayName ?? blockType
513
+ }), !disableBlockName && !clientBlock?.admin?.disableBlockName && /*#__PURE__*/_jsx(SectionTitle, {
514
+ path: "blockName",
515
+ readOnly: !isEditable
516
+ }), fieldHasErrors && /*#__PURE__*/_jsx(BlockErrorPill, {
517
+ count: errorCount_0 ?? 0
518
+ })]
519
+ })
437
520
  }),
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
521
+ isCollapsed: isCollapsed,
522
+ onToggle: incomingCollapsedState => {
523
+ onCollapsedChange(incomingCollapsedState);
524
+ setIsCollapsed(incomingCollapsedState);
447
525
  },
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
526
+ ...(collapsibleProps || {}),
527
+ AfterCollapsible: /*#__PURE__*/_jsxs(_Fragment, {
528
+ children: [collapsibleProps?.AfterCollapsible, /*#__PURE__*/_jsx("span", {
529
+ className: "sr-only",
530
+ role: "status",
531
+ children: isReordering ? `${t('general:order')}: ${(targetIndex ?? 0) + 1}` : ''
469
532
  })]
470
- })
471
- }),
472
- isCollapsed: isCollapsed,
473
- onToggle: incomingCollapsedState => {
474
- onCollapsedChange(incomingCollapsedState);
475
- setIsCollapsed(incomingCollapsedState);
476
- },
477
- ...(collapsibleProps || {}),
478
- children: children_0
479
- }, 0)
533
+ }),
534
+ children: [/*#__PURE__*/_jsxs("span", {
535
+ className: "sr-only",
536
+ id: reorderInstructionsID,
537
+ children: ["Space / Enter · ", t('general:moveUp'), " ↑ · ", t('general:moveDown'), " ↓ ·", ' ', t('general:cancel'), " Escape"]
538
+ }), children_0]
539
+ }, 0)
540
+ })
480
541
  });
481
- }, [resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, i18n, isCollapsed, onCollapsedChange, isEditable, nodeKey, removeBlock, rowIndex, t, toggleDrawer]);
542
+ }, [editor, resolvedCustomBlock, resolvedCustomLabel, blockDisplayName, baseClass, clientBlock?.admin?.disableBlockName, blockType, isCollapsed, onCollapsedChange, isEditable, nodeKey, removeBlock, rowIndex, t, toggleDrawer]);
482
543
  const blockID = formData?.id;
483
544
  const {
484
545
  headerActions,
@@ -532,8 +593,9 @@ export const BlockComponent = props => {
532
593
  fields: clientBlock?.fields ?? [],
533
594
  initialState: initialState,
534
595
  onChange: [onChange],
535
- onSubmit: (formState_0, newData_1) => {
596
+ onSubmit: formState_0 => {
536
597
  // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
598
+ const newData_1 = reduceFormStateToBlockData(formState_0, formDataRef.current);
537
599
  newData_1.blockType = blockType;
538
600
  editor.update(() => {
539
601
  const node_1 = $getNodeByKey(nodeKey);
@@ -578,4 +640,32 @@ export const BlockComponent = props => {
578
640
  }
579
641
  return Block;
580
642
  };
643
+ /**
644
+ * Reads `i18n` itself so `BlockCollapsible` does not depend on it. `BlockCollapsible` is created in
645
+ * a `useMemo`, so each new `i18n` object (e.g. once the date-fns locale is set after mount) would
646
+ * remount the whole block, closing its open menus and dropping focus.
647
+ */
648
+ const BlockErrorPill = t0 => {
649
+ const $ = _c(3);
650
+ const {
651
+ count
652
+ } = t0;
653
+ const {
654
+ i18n
655
+ } = useTranslation();
656
+ let t1;
657
+ if ($[0] !== count || $[1] !== i18n) {
658
+ t1 = _jsx(ErrorPill, {
659
+ count,
660
+ i18n,
661
+ withMessage: true
662
+ });
663
+ $[0] = count;
664
+ $[1] = i18n;
665
+ $[2] = t1;
666
+ } else {
667
+ t1 = $[2];
668
+ }
669
+ return t1;
670
+ };
581
671
  //# sourceMappingURL=index.js.map