@wordpress/block-editor 14.6.0 → 14.7.1-next.082ed6819.0

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 (332) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-controls/slot.js +6 -3
  3. package/build/components/block-controls/slot.js.map +1 -1
  4. package/build/components/block-inspector/index.js +1 -2
  5. package/build/components/block-inspector/index.js.map +1 -1
  6. package/build/components/block-list/block.js +14 -28
  7. package/build/components/block-list/block.js.map +1 -1
  8. package/build/components/block-lock/modal.js +1 -1
  9. package/build/components/block-lock/modal.js.map +1 -1
  10. package/build/components/block-manager/category.js +79 -0
  11. package/build/components/block-manager/category.js.map +1 -0
  12. package/build/components/block-manager/checklist.js +40 -0
  13. package/build/components/block-manager/checklist.js.map +1 -0
  14. package/build/components/block-manager/index.js +108 -0
  15. package/build/components/block-manager/index.js.map +1 -0
  16. package/build/components/block-patterns-list/index.js +23 -26
  17. package/build/components/block-patterns-list/index.js.map +1 -1
  18. package/build/components/block-popover/index.js +1 -1
  19. package/build/components/block-popover/index.js.map +1 -1
  20. package/build/components/block-preview/async.js +51 -0
  21. package/build/components/block-preview/async.js.map +1 -0
  22. package/build/components/block-preview/index.js +4 -1
  23. package/build/components/block-preview/index.js.map +1 -1
  24. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  25. package/build/components/block-settings-menu/index.js.map +1 -1
  26. package/build/components/block-toolbar/change-design.js +1 -4
  27. package/build/components/block-toolbar/change-design.js.map +1 -1
  28. package/build/components/block-toolbar/index.js +7 -2
  29. package/build/components/block-toolbar/index.js.map +1 -1
  30. package/build/components/block-toolbar/switch-section-style.js +105 -0
  31. package/build/components/block-toolbar/switch-section-style.js.map +1 -0
  32. package/build/components/block-tools/index.js +12 -9
  33. package/build/components/block-tools/index.js.map +1 -1
  34. package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  35. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  36. package/build/components/block-tools/use-show-block-tools.js +4 -1
  37. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  38. package/build/components/collab/block-comment-icon-slot.js +2 -6
  39. package/build/components/collab/block-comment-icon-slot.js.map +1 -1
  40. package/build/components/collab/block-comment-icon-toolbar-slot.js +2 -6
  41. package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -1
  42. package/build/components/color-palette/with-color-context.js +4 -2
  43. package/build/components/color-palette/with-color-context.js.map +1 -1
  44. package/build/components/font-family/index.js +14 -13
  45. package/build/components/font-family/index.js.map +1 -1
  46. package/build/components/global-styles/dimensions-panel.js +26 -14
  47. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  48. package/build/components/global-styles/use-global-styles-output.js +1 -1
  49. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  50. package/build/components/iframe/get-compatibility-styles.js +4 -4
  51. package/build/components/iframe/get-compatibility-styles.js.map +1 -1
  52. package/build/components/iframe/index.js +156 -23
  53. package/build/components/iframe/index.js.map +1 -1
  54. package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  55. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  56. package/build/components/inserter/block-patterns-tab/index.js +1 -2
  57. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  58. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -6
  59. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  60. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +3 -0
  61. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  62. package/build/components/inserter/block-patterns-tab/utils.js +5 -1
  63. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  64. package/build/components/inserter/category-tabs/index.js +7 -8
  65. package/build/components/inserter/category-tabs/index.js.map +1 -1
  66. package/build/components/inserter/hooks/use-block-types-state.js +1 -1
  67. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  68. package/build/components/inserter/hooks/use-patterns-paging.js +0 -5
  69. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  70. package/build/components/inserter/search-results.js +0 -2
  71. package/build/components/inserter/search-results.js.map +1 -1
  72. package/build/components/inserter-draggable-blocks/index.js +2 -1
  73. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  74. package/build/components/inspector-controls/slot.js +7 -4
  75. package/build/components/inspector-controls/slot.js.map +1 -1
  76. package/build/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  77. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  78. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -4
  79. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  80. package/build/components/media-placeholder/index.js +33 -25
  81. package/build/components/media-placeholder/index.js.map +1 -1
  82. package/build/components/rich-text/index.js +1 -1
  83. package/build/components/rich-text/index.js.map +1 -1
  84. package/build/components/tabbed-sidebar/index.js +1 -1
  85. package/build/components/tabbed-sidebar/index.js.map +1 -1
  86. package/build/components/url-input/index.js +3 -1
  87. package/build/components/url-input/index.js.map +1 -1
  88. package/build/components/use-block-commands/index.js +5 -6
  89. package/build/components/use-block-commands/index.js.map +1 -1
  90. package/build/hooks/border.js +3 -3
  91. package/build/hooks/border.js.map +1 -1
  92. package/build/hooks/color.js +1 -1
  93. package/build/hooks/color.js.map +1 -1
  94. package/build/hooks/dimensions.js +2 -2
  95. package/build/hooks/dimensions.js.map +1 -1
  96. package/build/hooks/font-family.js +1 -1
  97. package/build/hooks/font-family.js.map +1 -1
  98. package/build/hooks/style.js +6 -6
  99. package/build/hooks/style.js.map +1 -1
  100. package/build/hooks/supports.js +7 -7
  101. package/build/hooks/supports.js.map +1 -1
  102. package/build/hooks/typography.js +6 -6
  103. package/build/hooks/typography.js.map +1 -1
  104. package/build/hooks/utils.js +3 -3
  105. package/build/hooks/utils.js.map +1 -1
  106. package/build/layouts/flex.js +11 -9
  107. package/build/layouts/flex.js.map +1 -1
  108. package/build/lock-unlock.js.map +1 -1
  109. package/build/private-apis.js +4 -4
  110. package/build/private-apis.js.map +1 -1
  111. package/build/store/private-selectors.js +3 -3
  112. package/build/store/private-selectors.js.map +1 -1
  113. package/build/store/selectors.js +12 -8
  114. package/build/store/selectors.js.map +1 -1
  115. package/build/store/utils.js +5 -4
  116. package/build/store/utils.js.map +1 -1
  117. package/build/utils/dom.js +27 -22
  118. package/build/utils/dom.js.map +1 -1
  119. package/build-module/components/block-controls/slot.js +6 -3
  120. package/build-module/components/block-controls/slot.js.map +1 -1
  121. package/build-module/components/block-inspector/index.js +1 -2
  122. package/build-module/components/block-inspector/index.js.map +1 -1
  123. package/build-module/components/block-list/block.js +15 -27
  124. package/build-module/components/block-list/block.js.map +1 -1
  125. package/build-module/components/block-lock/modal.js +1 -1
  126. package/build-module/components/block-lock/modal.js.map +1 -1
  127. package/build-module/components/block-manager/category.js +71 -0
  128. package/build-module/components/block-manager/category.js.map +1 -0
  129. package/build-module/components/block-manager/checklist.js +32 -0
  130. package/build-module/components/block-manager/checklist.js.map +1 -0
  131. package/build-module/components/block-manager/index.js +102 -0
  132. package/build-module/components/block-manager/index.js.map +1 -0
  133. package/build-module/components/block-patterns-list/index.js +23 -26
  134. package/build-module/components/block-patterns-list/index.js.map +1 -1
  135. package/build-module/components/block-popover/index.js +2 -2
  136. package/build-module/components/block-popover/index.js.map +1 -1
  137. package/build-module/components/block-preview/async.js +44 -0
  138. package/build-module/components/block-preview/async.js.map +1 -0
  139. package/build-module/components/block-preview/index.js +4 -1
  140. package/build-module/components/block-preview/index.js.map +1 -1
  141. package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
  142. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  143. package/build-module/components/block-settings-menu/index.js +2 -2
  144. package/build-module/components/block-settings-menu/index.js.map +1 -1
  145. package/build-module/components/block-toolbar/change-design.js +1 -4
  146. package/build-module/components/block-toolbar/change-design.js.map +1 -1
  147. package/build-module/components/block-toolbar/index.js +7 -2
  148. package/build-module/components/block-toolbar/index.js.map +1 -1
  149. package/build-module/components/block-toolbar/switch-section-style.js +97 -0
  150. package/build-module/components/block-toolbar/switch-section-style.js.map +1 -0
  151. package/build-module/components/block-tools/index.js +13 -10
  152. package/build-module/components/block-tools/index.js.map +1 -1
  153. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  154. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  155. package/build-module/components/block-tools/use-show-block-tools.js +4 -1
  156. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  157. package/build-module/components/collab/block-comment-icon-slot.js +2 -6
  158. package/build-module/components/collab/block-comment-icon-slot.js.map +1 -1
  159. package/build-module/components/collab/block-comment-icon-toolbar-slot.js +2 -6
  160. package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -1
  161. package/build-module/components/color-palette/with-color-context.js +4 -2
  162. package/build-module/components/color-palette/with-color-context.js.map +1 -1
  163. package/build-module/components/font-family/index.js +15 -14
  164. package/build-module/components/font-family/index.js.map +1 -1
  165. package/build-module/components/global-styles/dimensions-panel.js +26 -14
  166. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  167. package/build-module/components/global-styles/use-global-styles-output.js +1 -1
  168. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  169. package/build-module/components/iframe/get-compatibility-styles.js +4 -4
  170. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
  171. package/build-module/components/iframe/index.js +157 -24
  172. package/build-module/components/iframe/index.js.map +1 -1
  173. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  174. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  175. package/build-module/components/inserter/block-patterns-tab/index.js +1 -2
  176. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  177. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +5 -7
  178. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  179. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +4 -1
  180. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  181. package/build-module/components/inserter/block-patterns-tab/utils.js +4 -0
  182. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  183. package/build-module/components/inserter/category-tabs/index.js +8 -9
  184. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  185. package/build-module/components/inserter/hooks/use-block-types-state.js +1 -1
  186. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  187. package/build-module/components/inserter/hooks/use-patterns-paging.js +1 -6
  188. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  189. package/build-module/components/inserter/search-results.js +0 -2
  190. package/build-module/components/inserter/search-results.js.map +1 -1
  191. package/build-module/components/inserter-draggable-blocks/index.js +2 -1
  192. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  193. package/build-module/components/inspector-controls/slot.js +7 -4
  194. package/build-module/components/inspector-controls/slot.js.map +1 -1
  195. package/build-module/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  196. package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  197. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -4
  198. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  199. package/build-module/components/media-placeholder/index.js +33 -25
  200. package/build-module/components/media-placeholder/index.js.map +1 -1
  201. package/build-module/components/rich-text/index.js +1 -1
  202. package/build-module/components/rich-text/index.js.map +1 -1
  203. package/build-module/components/tabbed-sidebar/index.js +1 -1
  204. package/build-module/components/tabbed-sidebar/index.js.map +1 -1
  205. package/build-module/components/url-input/index.js +3 -1
  206. package/build-module/components/url-input/index.js.map +1 -1
  207. package/build-module/components/use-block-commands/index.js +4 -4
  208. package/build-module/components/use-block-commands/index.js.map +1 -1
  209. package/build-module/hooks/border.js +3 -3
  210. package/build-module/hooks/border.js.map +1 -1
  211. package/build-module/hooks/color.js +1 -1
  212. package/build-module/hooks/color.js.map +1 -1
  213. package/build-module/hooks/dimensions.js +2 -2
  214. package/build-module/hooks/dimensions.js.map +1 -1
  215. package/build-module/hooks/font-family.js +1 -1
  216. package/build-module/hooks/font-family.js.map +1 -1
  217. package/build-module/hooks/style.js +6 -6
  218. package/build-module/hooks/style.js.map +1 -1
  219. package/build-module/hooks/supports.js +7 -7
  220. package/build-module/hooks/supports.js.map +1 -1
  221. package/build-module/hooks/typography.js +6 -6
  222. package/build-module/hooks/typography.js.map +1 -1
  223. package/build-module/hooks/utils.js +3 -3
  224. package/build-module/hooks/utils.js.map +1 -1
  225. package/build-module/layouts/flex.js +11 -9
  226. package/build-module/layouts/flex.js.map +1 -1
  227. package/build-module/lock-unlock.js.map +1 -1
  228. package/build-module/private-apis.js +6 -6
  229. package/build-module/private-apis.js.map +1 -1
  230. package/build-module/store/private-selectors.js +3 -3
  231. package/build-module/store/private-selectors.js.map +1 -1
  232. package/build-module/store/selectors.js +12 -8
  233. package/build-module/store/selectors.js.map +1 -1
  234. package/build-module/store/utils.js +3 -3
  235. package/build-module/store/utils.js.map +1 -1
  236. package/build-module/utils/dom.js +25 -21
  237. package/build-module/utils/dom.js.map +1 -1
  238. package/build-style/content-rtl.css +30 -15
  239. package/build-style/content.css +30 -15
  240. package/build-style/style-rtl.css +92 -3
  241. package/build-style/style.css +92 -3
  242. package/build-types/utils/dom.d.ts +7 -9
  243. package/build-types/utils/dom.d.ts.map +1 -1
  244. package/package.json +32 -31
  245. package/src/components/block-canvas/style.scss +1 -1
  246. package/src/components/block-controls/slot.js +5 -3
  247. package/src/components/block-inspector/index.js +0 -2
  248. package/src/components/block-inspector/style.scss +2 -1
  249. package/src/components/block-list/block.js +28 -48
  250. package/src/components/block-lock/modal.js +1 -1
  251. package/src/components/block-manager/category.js +102 -0
  252. package/src/components/block-manager/checklist.js +34 -0
  253. package/src/components/block-manager/index.js +127 -0
  254. package/src/components/block-manager/style.scss +82 -0
  255. package/src/components/block-mover/README.md +15 -8
  256. package/src/components/block-mover/stories/index.story.js +73 -71
  257. package/src/components/block-mover/style.scss +3 -0
  258. package/src/components/block-patterns-list/README.md +8 -8
  259. package/src/components/block-patterns-list/index.js +35 -51
  260. package/src/components/block-patterns-list/stories/index.story.js +2 -19
  261. package/src/components/block-popover/index.js +4 -4
  262. package/src/components/block-preview/async.js +43 -0
  263. package/src/components/block-preview/index.js +6 -1
  264. package/src/components/block-settings-menu/block-settings-dropdown.js +2 -2
  265. package/src/components/block-settings-menu/index.js +2 -2
  266. package/src/components/block-toolbar/change-design.js +1 -7
  267. package/src/components/block-toolbar/index.js +6 -0
  268. package/src/components/block-toolbar/switch-section-style.js +115 -0
  269. package/src/components/block-tools/index.js +26 -10
  270. package/src/components/block-tools/style.scss +12 -0
  271. package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  272. package/src/components/block-tools/use-show-block-tools.js +3 -1
  273. package/src/components/collab/block-comment-icon-slot.js +2 -6
  274. package/src/components/collab/block-comment-icon-toolbar-slot.js +3 -5
  275. package/src/components/color-palette/with-color-context.js +25 -7
  276. package/src/components/default-block-appender/content.scss +13 -19
  277. package/src/components/font-family/index.js +13 -13
  278. package/src/components/global-styles/dimensions-panel.js +22 -16
  279. package/src/components/global-styles/test/use-global-styles-output.js +1 -1
  280. package/src/components/global-styles/use-global-styles-output.js +1 -1
  281. package/src/components/iframe/content.scss +16 -3
  282. package/src/components/iframe/get-compatibility-styles.js +4 -9
  283. package/src/components/iframe/index.js +204 -44
  284. package/src/components/inserter/block-patterns-explorer/pattern-list.js +3 -6
  285. package/src/components/inserter/block-patterns-tab/index.js +0 -1
  286. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -17
  287. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +8 -0
  288. package/src/components/inserter/block-patterns-tab/utils.js +5 -0
  289. package/src/components/inserter/category-tabs/index.js +8 -9
  290. package/src/components/inserter/hooks/use-block-types-state.js +6 -1
  291. package/src/components/inserter/hooks/use-patterns-paging.js +1 -6
  292. package/src/components/inserter/search-results.js +0 -6
  293. package/src/components/inserter-draggable-blocks/index.js +10 -1
  294. package/src/components/inspector-controls/README.md +2 -0
  295. package/src/components/inspector-controls/slot.js +6 -4
  296. package/src/components/inspector-controls-tabs/position-controls-panel.js +1 -3
  297. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +10 -10
  298. package/src/components/media-placeholder/index.js +41 -37
  299. package/src/components/provider/test/use-block-sync.js +3 -1
  300. package/src/components/rich-text/content.scss +15 -10
  301. package/src/components/rich-text/index.js +8 -1
  302. package/src/components/tabbed-sidebar/index.js +1 -1
  303. package/src/components/tabbed-sidebar/style.scss +1 -1
  304. package/src/components/url-input/index.js +3 -4
  305. package/src/components/use-block-commands/index.js +245 -234
  306. package/src/hooks/border.js +3 -9
  307. package/src/hooks/color.js +1 -1
  308. package/src/hooks/dimensions.js +2 -2
  309. package/src/hooks/font-family.js +1 -1
  310. package/src/hooks/style.js +6 -12
  311. package/src/hooks/supports.js +7 -7
  312. package/src/hooks/test/style.js +1 -2
  313. package/src/hooks/typography.js +6 -6
  314. package/src/hooks/utils.js +8 -3
  315. package/src/layouts/flex.js +26 -18
  316. package/src/private-apis.js +6 -6
  317. package/src/store/private-selectors.js +6 -7
  318. package/src/store/selectors.js +60 -45
  319. package/src/store/test/private-selectors.js +5 -0
  320. package/src/store/test/selectors.js +87 -58
  321. package/src/store/utils.js +12 -11
  322. package/src/style.scss +1 -0
  323. package/src/utils/dom.js +26 -21
  324. package/src/utils/test/dom.js +224 -0
  325. package/tsconfig.json +1 -0
  326. package/tsconfig.tsbuildinfo +1 -1
  327. package/build/components/block-info-slot-fill/index.js +0 -39
  328. package/build/components/block-info-slot-fill/index.js.map +0 -1
  329. package/build-module/components/block-info-slot-fill/index.js +0 -32
  330. package/build-module/components/block-info-slot-fill/index.js.map +0 -1
  331. package/src/components/block-info-slot-fill/index.js +0 -27
  332. /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
@@ -24,275 +24,286 @@ import {
24
24
  import BlockIcon from '../block-icon';
25
25
  import { store as blockEditorStore } from '../../store';
26
26
 
27
- export const useTransformCommands = () => {
28
- const { replaceBlocks, multiSelect } = useDispatch( blockEditorStore );
29
- const {
30
- blocks,
31
- clientIds,
32
- canRemove,
33
- possibleBlockTransformations,
34
- invalidSelection,
35
- } = useSelect( ( select ) => {
27
+ const getTransformCommands = () =>
28
+ function useTransformCommands() {
29
+ const { replaceBlocks, multiSelect } = useDispatch( blockEditorStore );
36
30
  const {
37
- getBlockRootClientId,
38
- getBlockTransformItems,
39
- getSelectedBlockClientIds,
40
- getBlocksByClientId,
41
- canRemoveBlocks,
42
- } = select( blockEditorStore );
31
+ blocks,
32
+ clientIds,
33
+ canRemove,
34
+ possibleBlockTransformations,
35
+ invalidSelection,
36
+ } = useSelect( ( select ) => {
37
+ const {
38
+ getBlockRootClientId,
39
+ getBlockTransformItems,
40
+ getSelectedBlockClientIds,
41
+ getBlocksByClientId,
42
+ canRemoveBlocks,
43
+ } = select( blockEditorStore );
44
+
45
+ const selectedBlockClientIds = getSelectedBlockClientIds();
46
+ const selectedBlocks = getBlocksByClientId(
47
+ selectedBlockClientIds
48
+ );
49
+
50
+ // selectedBlocks can have `null`s when something tries to call `selectBlock` with an inexistent clientId.
51
+ // These nulls will cause fatal errors down the line.
52
+ // In order to prevent discrepancies between selectedBlockClientIds and selectedBlocks, we effectively treat the entire selection as invalid.
53
+ // @see https://github.com/WordPress/gutenberg/pull/59410#issuecomment-2006304536
54
+ if ( selectedBlocks.filter( ( block ) => ! block ).length > 0 ) {
55
+ return {
56
+ invalidSelection: true,
57
+ };
58
+ }
43
59
 
44
- const selectedBlockClientIds = getSelectedBlockClientIds();
45
- const selectedBlocks = getBlocksByClientId( selectedBlockClientIds );
60
+ const rootClientId = getBlockRootClientId(
61
+ selectedBlockClientIds[ 0 ]
62
+ );
63
+ return {
64
+ blocks: selectedBlocks,
65
+ clientIds: selectedBlockClientIds,
66
+ possibleBlockTransformations: getBlockTransformItems(
67
+ selectedBlocks,
68
+ rootClientId
69
+ ),
70
+ canRemove: canRemoveBlocks( selectedBlockClientIds ),
71
+ invalidSelection: false,
72
+ };
73
+ }, [] );
46
74
 
47
- // selectedBlocks can have `null`s when something tries to call `selectBlock` with an inexistent clientId.
48
- // These nulls will cause fatal errors down the line.
49
- // In order to prevent discrepancies between selectedBlockClientIds and selectedBlocks, we effectively treat the entire selection as invalid.
50
- // @see https://github.com/WordPress/gutenberg/pull/59410#issuecomment-2006304536
51
- if ( selectedBlocks.filter( ( block ) => ! block ).length > 0 ) {
75
+ if ( invalidSelection ) {
52
76
  return {
53
- invalidSelection: true,
77
+ isLoading: false,
78
+ commands: [],
54
79
  };
55
80
  }
81
+ const isTemplate = blocks.length === 1 && isTemplatePart( blocks[ 0 ] );
82
+
83
+ function selectForMultipleBlocks( insertedBlocks ) {
84
+ if ( insertedBlocks.length > 1 ) {
85
+ multiSelect(
86
+ insertedBlocks[ 0 ].clientId,
87
+ insertedBlocks[ insertedBlocks.length - 1 ].clientId
88
+ );
89
+ }
90
+ }
56
91
 
57
- const rootClientId = getBlockRootClientId(
58
- selectedBlockClientIds[ 0 ]
59
- );
60
- return {
61
- blocks: selectedBlocks,
62
- clientIds: selectedBlockClientIds,
63
- possibleBlockTransformations: getBlockTransformItems(
64
- selectedBlocks,
65
- rootClientId
66
- ),
67
- canRemove: canRemoveBlocks( selectedBlockClientIds ),
68
- invalidSelection: false,
69
- };
70
- }, [] );
92
+ // Simple block tranformation based on the `Block Transforms` API.
93
+ function onBlockTransform( name ) {
94
+ const newBlocks = switchToBlockType( blocks, name );
95
+ replaceBlocks( clientIds, newBlocks );
96
+ selectForMultipleBlocks( newBlocks );
97
+ }
71
98
 
72
- if ( invalidSelection ) {
73
- return {
74
- isLoading: false,
75
- commands: [],
76
- };
77
- }
78
- const isTemplate = blocks.length === 1 && isTemplatePart( blocks[ 0 ] );
79
-
80
- function selectForMultipleBlocks( insertedBlocks ) {
81
- if ( insertedBlocks.length > 1 ) {
82
- multiSelect(
83
- insertedBlocks[ 0 ].clientId,
84
- insertedBlocks[ insertedBlocks.length - 1 ].clientId
85
- );
99
+ /**
100
+ * The `isTemplate` check is a stopgap solution here.
101
+ * Ideally, the Transforms API should handle this
102
+ * by allowing to exclude blocks from wildcard transformations.
103
+ */
104
+ const hasPossibleBlockTransformations =
105
+ !! possibleBlockTransformations.length && canRemove && ! isTemplate;
106
+
107
+ if (
108
+ ! clientIds ||
109
+ clientIds.length < 1 ||
110
+ ! hasPossibleBlockTransformations
111
+ ) {
112
+ return { isLoading: false, commands: [] };
86
113
  }
87
- }
88
-
89
- // Simple block tranformation based on the `Block Transforms` API.
90
- function onBlockTransform( name ) {
91
- const newBlocks = switchToBlockType( blocks, name );
92
- replaceBlocks( clientIds, newBlocks );
93
- selectForMultipleBlocks( newBlocks );
94
- }
95
-
96
- /**
97
- * The `isTemplate` check is a stopgap solution here.
98
- * Ideally, the Transforms API should handle this
99
- * by allowing to exclude blocks from wildcard transformations.
100
- */
101
- const hasPossibleBlockTransformations =
102
- !! possibleBlockTransformations.length && canRemove && ! isTemplate;
103
-
104
- if (
105
- ! clientIds ||
106
- clientIds.length < 1 ||
107
- ! hasPossibleBlockTransformations
108
- ) {
109
- return { isLoading: false, commands: [] };
110
- }
111
-
112
- const commands = possibleBlockTransformations.map( ( transformation ) => {
113
- const { name, title, icon } = transformation;
114
- return {
115
- name: 'core/block-editor/transform-to-' + name.replace( '/', '-' ),
116
- /* translators: %s: Block or block variation name. */
117
- label: sprintf( __( 'Transform to %s' ), title ),
118
- icon: <BlockIcon icon={ icon } />,
119
- callback: ( { close } ) => {
120
- onBlockTransform( name );
121
- close();
114
+
115
+ const commands = possibleBlockTransformations.map(
116
+ ( transformation ) => {
117
+ const { name, title, icon } = transformation;
118
+ return {
119
+ name:
120
+ 'core/block-editor/transform-to-' +
121
+ name.replace( '/', '-' ),
122
+ /* translators: %s: Block or block variation name. */
123
+ label: sprintf( __( 'Transform to %s' ), title ),
124
+ icon: <BlockIcon icon={ icon } />,
125
+ callback: ( { close } ) => {
126
+ onBlockTransform( name );
127
+ close();
128
+ },
129
+ };
130
+ }
131
+ );
132
+
133
+ return { isLoading: false, commands };
134
+ };
135
+
136
+ const getQuickActionsCommands = () =>
137
+ function useQuickActionsCommands() {
138
+ const { clientIds, isUngroupable, isGroupable } = useSelect(
139
+ ( select ) => {
140
+ const {
141
+ getSelectedBlockClientIds,
142
+ isUngroupable: _isUngroupable,
143
+ isGroupable: _isGroupable,
144
+ } = select( blockEditorStore );
145
+ const selectedBlockClientIds = getSelectedBlockClientIds();
146
+
147
+ return {
148
+ clientIds: selectedBlockClientIds,
149
+ isUngroupable: _isUngroupable(),
150
+ isGroupable: _isGroupable(),
151
+ };
122
152
  },
123
- };
124
- } );
153
+ []
154
+ );
155
+ const {
156
+ canInsertBlockType,
157
+ getBlockRootClientId,
158
+ getBlocksByClientId,
159
+ canRemoveBlocks,
160
+ } = useSelect( blockEditorStore );
161
+ const { getDefaultBlockName, getGroupingBlockName } =
162
+ useSelect( blocksStore );
125
163
 
126
- return { isLoading: false, commands };
127
- };
164
+ const blocks = getBlocksByClientId( clientIds );
128
165
 
129
- const useQuickActionsCommands = () => {
130
- const { clientIds, isUngroupable, isGroupable } = useSelect( ( select ) => {
131
166
  const {
132
- getSelectedBlockClientIds,
133
- isUngroupable: _isUngroupable,
134
- isGroupable: _isGroupable,
135
- } = select( blockEditorStore );
136
- const selectedBlockClientIds = getSelectedBlockClientIds();
167
+ removeBlocks,
168
+ replaceBlocks,
169
+ duplicateBlocks,
170
+ insertAfterBlock,
171
+ insertBeforeBlock,
172
+ } = useDispatch( blockEditorStore );
173
+
174
+ const onGroup = () => {
175
+ if ( ! blocks.length ) {
176
+ return;
177
+ }
137
178
 
138
- return {
139
- clientIds: selectedBlockClientIds,
140
- isUngroupable: _isUngroupable(),
141
- isGroupable: _isGroupable(),
179
+ const groupingBlockName = getGroupingBlockName();
180
+
181
+ // Activate the `transform` on `core/group` which does the conversion.
182
+ const newBlocks = switchToBlockType( blocks, groupingBlockName );
183
+
184
+ if ( ! newBlocks ) {
185
+ return;
186
+ }
187
+ replaceBlocks( clientIds, newBlocks );
142
188
  };
143
- }, [] );
144
- const {
145
- canInsertBlockType,
146
- getBlockRootClientId,
147
- getBlocksByClientId,
148
- canRemoveBlocks,
149
- } = useSelect( blockEditorStore );
150
- const { getDefaultBlockName, getGroupingBlockName } =
151
- useSelect( blocksStore );
152
-
153
- const blocks = getBlocksByClientId( clientIds );
154
-
155
- const {
156
- removeBlocks,
157
- replaceBlocks,
158
- duplicateBlocks,
159
- insertAfterBlock,
160
- insertBeforeBlock,
161
- } = useDispatch( blockEditorStore );
162
-
163
- const onGroup = () => {
164
- if ( ! blocks.length ) {
165
- return;
166
- }
189
+ const onUngroup = () => {
190
+ if ( ! blocks.length ) {
191
+ return;
192
+ }
167
193
 
168
- const groupingBlockName = getGroupingBlockName();
194
+ const innerBlocks = blocks[ 0 ].innerBlocks;
169
195
 
170
- // Activate the `transform` on `core/group` which does the conversion.
171
- const newBlocks = switchToBlockType( blocks, groupingBlockName );
196
+ if ( ! innerBlocks.length ) {
197
+ return;
198
+ }
172
199
 
173
- if ( ! newBlocks ) {
174
- return;
175
- }
176
- replaceBlocks( clientIds, newBlocks );
177
- };
178
- const onUngroup = () => {
179
- if ( ! blocks.length ) {
180
- return;
200
+ replaceBlocks( clientIds, innerBlocks );
201
+ };
202
+
203
+ if ( ! clientIds || clientIds.length < 1 ) {
204
+ return { isLoading: false, commands: [] };
181
205
  }
182
206
 
183
- const innerBlocks = blocks[ 0 ].innerBlocks;
207
+ const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
208
+ const canInsertDefaultBlock = canInsertBlockType(
209
+ getDefaultBlockName(),
210
+ rootClientId
211
+ );
212
+ const canDuplicate = blocks.every( ( block ) => {
213
+ return (
214
+ !! block &&
215
+ hasBlockSupport( block.name, 'multiple', true ) &&
216
+ canInsertBlockType( block.name, rootClientId )
217
+ );
218
+ } );
219
+ const canRemove = canRemoveBlocks( clientIds );
184
220
 
185
- if ( ! innerBlocks.length ) {
186
- return;
221
+ const commands = [];
222
+
223
+ if ( canDuplicate ) {
224
+ commands.push( {
225
+ name: 'duplicate',
226
+ label: __( 'Duplicate' ),
227
+ callback: () => duplicateBlocks( clientIds, true ),
228
+ icon: copy,
229
+ } );
187
230
  }
188
231
 
189
- replaceBlocks( clientIds, innerBlocks );
190
- };
232
+ if ( canInsertDefaultBlock ) {
233
+ commands.push(
234
+ {
235
+ name: 'add-before',
236
+ label: __( 'Add before' ),
237
+ callback: () => {
238
+ const clientId = Array.isArray( clientIds )
239
+ ? clientIds[ 0 ]
240
+ : clientId;
241
+ insertBeforeBlock( clientId );
242
+ },
243
+ icon: add,
244
+ },
245
+ {
246
+ name: 'add-after',
247
+ label: __( 'Add after' ),
248
+ callback: () => {
249
+ const clientId = Array.isArray( clientIds )
250
+ ? clientIds[ clientIds.length - 1 ]
251
+ : clientId;
252
+ insertAfterBlock( clientId );
253
+ },
254
+ icon: add,
255
+ }
256
+ );
257
+ }
191
258
 
192
- if ( ! clientIds || clientIds.length < 1 ) {
193
- return { isLoading: false, commands: [] };
194
- }
195
-
196
- const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
197
- const canInsertDefaultBlock = canInsertBlockType(
198
- getDefaultBlockName(),
199
- rootClientId
200
- );
201
- const canDuplicate = blocks.every( ( block ) => {
202
- return (
203
- !! block &&
204
- hasBlockSupport( block.name, 'multiple', true ) &&
205
- canInsertBlockType( block.name, rootClientId )
206
- );
207
- } );
208
- const canRemove = canRemoveBlocks( clientIds );
259
+ if ( isGroupable ) {
260
+ commands.push( {
261
+ name: 'Group',
262
+ label: __( 'Group' ),
263
+ callback: onGroup,
264
+ icon: group,
265
+ } );
266
+ }
209
267
 
210
- const commands = [];
268
+ if ( isUngroupable ) {
269
+ commands.push( {
270
+ name: 'ungroup',
271
+ label: __( 'Ungroup' ),
272
+ callback: onUngroup,
273
+ icon: ungroup,
274
+ } );
275
+ }
211
276
 
212
- if ( canDuplicate ) {
213
- commands.push( {
214
- name: 'duplicate',
215
- label: __( 'Duplicate' ),
216
- callback: () => duplicateBlocks( clientIds, true ),
217
- icon: copy,
218
- } );
219
- }
220
-
221
- if ( canInsertDefaultBlock ) {
222
- commands.push(
223
- {
224
- name: 'add-before',
225
- label: __( 'Add before' ),
226
- callback: () => {
227
- const clientId = Array.isArray( clientIds )
228
- ? clientIds[ 0 ]
229
- : clientId;
230
- insertBeforeBlock( clientId );
231
- },
232
- icon: add,
233
- },
234
- {
235
- name: 'add-after',
236
- label: __( 'Add after' ),
237
- callback: () => {
238
- const clientId = Array.isArray( clientIds )
239
- ? clientIds[ clientIds.length - 1 ]
240
- : clientId;
241
- insertAfterBlock( clientId );
277
+ if ( canRemove ) {
278
+ commands.push( {
279
+ name: 'remove',
280
+ label: __( 'Delete' ),
281
+ callback: () => removeBlocks( clientIds, true ),
282
+ icon: remove,
283
+ } );
284
+ }
285
+
286
+ return {
287
+ isLoading: false,
288
+ commands: commands.map( ( command ) => ( {
289
+ ...command,
290
+ name: 'core/block-editor/action-' + command.name,
291
+ callback: ( { close } ) => {
292
+ command.callback();
293
+ close();
242
294
  },
243
- icon: add,
244
- }
245
- );
246
- }
247
-
248
- if ( isGroupable ) {
249
- commands.push( {
250
- name: 'Group',
251
- label: __( 'Group' ),
252
- callback: onGroup,
253
- icon: group,
254
- } );
255
- }
256
-
257
- if ( isUngroupable ) {
258
- commands.push( {
259
- name: 'ungroup',
260
- label: __( 'Ungroup' ),
261
- callback: onUngroup,
262
- icon: ungroup,
263
- } );
264
- }
265
-
266
- if ( canRemove ) {
267
- commands.push( {
268
- name: 'remove',
269
- label: __( 'Delete' ),
270
- callback: () => removeBlocks( clientIds, true ),
271
- icon: remove,
272
- } );
273
- }
274
-
275
- return {
276
- isLoading: false,
277
- commands: commands.map( ( command ) => ( {
278
- ...command,
279
- name: 'core/block-editor/action-' + command.name,
280
- callback: ( { close } ) => {
281
- command.callback();
282
- close();
283
- },
284
- } ) ),
295
+ } ) ),
296
+ };
285
297
  };
286
- };
287
298
 
288
299
  export const useBlockCommands = () => {
289
300
  useCommandLoader( {
290
301
  name: 'core/block-editor/blockTransforms',
291
- hook: useTransformCommands,
302
+ hook: getTransformCommands(),
292
303
  } );
293
304
  useCommandLoader( {
294
305
  name: 'core/block-editor/blockQuickActions',
295
- hook: useQuickActionsCommands,
306
+ hook: getQuickActionsCommands(),
296
307
  context: 'block-selection-edit',
297
308
  } );
298
309
  };
@@ -31,7 +31,7 @@ import {
31
31
  import { store as blockEditorStore } from '../store';
32
32
  import { __ } from '@wordpress/i18n';
33
33
 
34
- export const BORDER_SUPPORT_KEY = '__experimentalBorder';
34
+ export const BORDER_SUPPORT_KEY = 'border';
35
35
  export const SHADOW_SUPPORT_KEY = 'shadow';
36
36
 
37
37
  const getColorByProperty = ( colors, property, value ) => {
@@ -161,14 +161,8 @@ export function BorderPanel( { clientId, name, setAttributes, settings } ) {
161
161
  }
162
162
 
163
163
  const defaultControls = {
164
- ...getBlockSupport( name, [
165
- BORDER_SUPPORT_KEY,
166
- '__experimentalDefaultControls',
167
- ] ),
168
- ...getBlockSupport( name, [
169
- SHADOW_SUPPORT_KEY,
170
- '__experimentalDefaultControls',
171
- ] ),
164
+ ...getBlockSupport( name, [ BORDER_SUPPORT_KEY, 'defaultControls' ] ),
165
+ ...getBlockSupport( name, [ SHADOW_SUPPORT_KEY, 'defaultControls' ] ),
172
166
  };
173
167
 
174
168
  return (
@@ -290,7 +290,7 @@ export function ColorEdit( { clientId, name, setAttributes, settings } ) {
290
290
 
291
291
  const defaultControls = getBlockSupport( name, [
292
292
  COLOR_SUPPORT_KEY,
293
- '__experimentalDefaultControls',
293
+ 'defaultControls',
294
294
  ] );
295
295
 
296
296
  const enableContrastChecking =
@@ -88,11 +88,11 @@ export function DimensionsPanel( { clientId, name, setAttributes, settings } ) {
88
88
 
89
89
  const defaultDimensionsControls = getBlockSupport( name, [
90
90
  DIMENSIONS_SUPPORT_KEY,
91
- '__experimentalDefaultControls',
91
+ 'defaultControls',
92
92
  ] );
93
93
  const defaultSpacingControls = getBlockSupport( name, [
94
94
  SPACING_SUPPORT_KEY,
95
- '__experimentalDefaultControls',
95
+ 'defaultControls',
96
96
  ] );
97
97
  const defaultControls = {
98
98
  ...defaultDimensionsControls,
@@ -13,7 +13,7 @@ import { shouldSkipSerialization } from './utils';
13
13
  import { TYPOGRAPHY_SUPPORT_KEY } from './typography';
14
14
  import { unlock } from '../lock-unlock';
15
15
 
16
- export const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
16
+ export const FONT_FAMILY_SUPPORT_KEY = 'typography.fontFamily';
17
17
  const { kebabCase } = unlock( componentsPrivateApis );
18
18
 
19
19
  /**
@@ -98,22 +98,16 @@ function addAttribute( settings ) {
98
98
  * @type {Record<string, string[]>}
99
99
  */
100
100
  const skipSerializationPathsEdit = {
101
- [ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],
102
- [ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
103
- COLOR_SUPPORT_KEY,
104
- ],
105
- [ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
101
+ [ `${ BORDER_SUPPORT_KEY }.skipSerialization` ]: [ 'border' ],
102
+ [ `${ COLOR_SUPPORT_KEY }.skipSerialization` ]: [ COLOR_SUPPORT_KEY ],
103
+ [ `${ TYPOGRAPHY_SUPPORT_KEY }.skipSerialization` ]: [
106
104
  TYPOGRAPHY_SUPPORT_KEY,
107
105
  ],
108
- [ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
106
+ [ `${ DIMENSIONS_SUPPORT_KEY }.skipSerialization` ]: [
109
107
  DIMENSIONS_SUPPORT_KEY,
110
108
  ],
111
- [ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
112
- SPACING_SUPPORT_KEY,
113
- ],
114
- [ `${ SHADOW_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
115
- SHADOW_SUPPORT_KEY,
116
- ],
109
+ [ `${ SPACING_SUPPORT_KEY }.skipSerialization` ]: [ SPACING_SUPPORT_KEY ],
110
+ [ `${ SHADOW_SUPPORT_KEY }.skipSerialization` ]: [ SHADOW_SUPPORT_KEY ],
117
111
  };
118
112
 
119
113
  /**
@@ -6,20 +6,20 @@ import { Platform } from '@wordpress/element';
6
6
 
7
7
  const ALIGN_SUPPORT_KEY = 'align';
8
8
  const ALIGN_WIDE_SUPPORT_KEY = 'alignWide';
9
- const BORDER_SUPPORT_KEY = '__experimentalBorder';
9
+ const BORDER_SUPPORT_KEY = 'border';
10
10
  const COLOR_SUPPORT_KEY = 'color';
11
11
  const CUSTOM_CLASS_NAME_SUPPORT_KEY = 'customClassName';
12
- const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
12
+ const FONT_FAMILY_SUPPORT_KEY = 'typography.fontFamily';
13
13
  const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';
14
14
  const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';
15
15
  /**
16
16
  * Key within block settings' support array indicating support for font style.
17
17
  */
18
- const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
18
+ const FONT_STYLE_SUPPORT_KEY = 'typography.fontStyle';
19
19
  /**
20
20
  * Key within block settings' support array indicating support for font weight.
21
21
  */
22
- const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
22
+ const FONT_WEIGHT_SUPPORT_KEY = 'typography.fontWeight';
23
23
  /**
24
24
  * Key within block settings' supports array indicating support for text
25
25
  * align e.g. settings found in `block.json`.
@@ -34,7 +34,7 @@ const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
34
34
  * Key within block settings' supports array indicating support for text
35
35
  * decorations e.g. settings found in `block.json`.
36
36
  */
37
- const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
37
+ const TEXT_DECORATION_SUPPORT_KEY = 'typography.textDecoration';
38
38
  /**
39
39
  * Key within block settings' supports array indicating support for writing mode
40
40
  * e.g. settings found in `block.json`.
@@ -44,13 +44,13 @@ const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
44
44
  * Key within block settings' supports array indicating support for text
45
45
  * transforms e.g. settings found in `block.json`.
46
46
  */
47
- const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
47
+ const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.textTransform';
48
48
 
49
49
  /**
50
50
  * Key within block settings' supports array indicating support for letter-spacing
51
51
  * e.g. settings found in `block.json`.
52
52
  */
53
- const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
53
+ const LETTER_SPACING_SUPPORT_KEY = 'typography.letterSpacing';
54
54
  const LAYOUT_SUPPORT_KEY = 'layout';
55
55
  const TYPOGRAPHY_SUPPORT_KEYS = [
56
56
  LINE_HEIGHT_SUPPORT_KEY,
@@ -133,8 +133,7 @@ describe( 'addSaveProps', () => {
133
133
  const applySkipSerialization = ( features ) => {
134
134
  const updatedSettings = { ...blockSettings };
135
135
  Object.keys( features ).forEach( ( key ) => {
136
- updatedSettings.supports[ key ].__experimentalSkipSerialization =
137
- features[ key ];
136
+ updatedSettings.supports[ key ].skipSerialization = features[ key ];
138
137
  } );
139
138
  return updatedSettings;
140
139
  };