@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
@@ -10,7 +10,6 @@ import {
10
10
  import { __ } from '@wordpress/i18n';
11
11
  import { cloneBlock } from '@wordpress/blocks';
12
12
  import { useMemo } from '@wordpress/element';
13
- import { useAsyncList } from '@wordpress/compose';
14
13
  import { useSelect, useDispatch } from '@wordpress/data';
15
14
 
16
15
  /**
@@ -81,10 +80,6 @@ export default function ChangeDesign( { clientId } ) {
81
80
  .slice( 0, MAX_PATTERNS_TO_SHOW );
82
81
  }, [ categories, currentPatternName, patterns ] );
83
82
 
84
- const currentShownPatterns = useAsyncList(
85
- sameCategoryPatternsWithSingleWrapper
86
- );
87
-
88
83
  if ( sameCategoryPatternsWithSingleWrapper.length < 2 ) {
89
84
  return null;
90
85
  }
@@ -121,10 +116,9 @@ export default function ChangeDesign( { clientId } ) {
121
116
  paddingSize="none"
122
117
  >
123
118
  <BlockPatternsList
124
- shownPatterns={ currentShownPatterns }
125
119
  blockPatterns={ sameCategoryPatternsWithSingleWrapper }
126
120
  onClickPattern={ onClickPattern }
127
- showTitle={ false }
121
+ showTitlesAsTooltip
128
122
  />
129
123
  </DropdownContentWrapper>
130
124
  ) }
@@ -36,6 +36,7 @@ import __unstableBlockNameContext from './block-name-context';
36
36
  import NavigableToolbar from '../navigable-toolbar';
37
37
  import { useHasBlockToolbar } from './use-has-block-toolbar';
38
38
  import ChangeDesign from './change-design';
39
+ import SwitchSectionStyle from './switch-section-style';
39
40
  import { unlock } from '../../lock-unlock';
40
41
 
41
42
  /**
@@ -72,6 +73,7 @@ export function PrivateBlockToolbar( {
72
73
  showSlots,
73
74
  showGroupButtons,
74
75
  showLockButtons,
76
+ showSwitchSectionStyleButton,
75
77
  } = useSelect( ( select ) => {
76
78
  const {
77
79
  getBlockName,
@@ -141,6 +143,7 @@ export function PrivateBlockToolbar( {
141
143
  showSlots: ! isZoomOut(),
142
144
  showGroupButtons: ! isZoomOut(),
143
145
  showLockButtons: ! isZoomOut(),
146
+ showSwitchSectionStyleButton: isZoomOut(),
144
147
  };
145
148
  }, [] );
146
149
 
@@ -222,6 +225,9 @@ export function PrivateBlockToolbar( {
222
225
  { showShuffleButton && (
223
226
  <ChangeDesign clientId={ blockClientIds[ 0 ] } />
224
227
  ) }
228
+ { showSwitchSectionStyleButton && (
229
+ <SwitchSectionStyle clientId={ blockClientIds[ 0 ] } />
230
+ ) }
225
231
  { shouldShowVisualToolbar && showSlots && (
226
232
  <>
227
233
  <BlockControls.Slot
@@ -0,0 +1,115 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ ToolbarButton,
6
+ ToolbarGroup,
7
+ Icon,
8
+ Path,
9
+ SVG,
10
+ } from '@wordpress/components';
11
+ import { __ } from '@wordpress/i18n';
12
+ import { useDispatch, useSelect } from '@wordpress/data';
13
+ import { useContext } from '@wordpress/element';
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import useStylesForBlocks from '../block-styles/use-styles-for-block';
19
+ import { replaceActiveStyle } from '../block-styles/utils';
20
+ import { store as blockEditorStore } from '../../store';
21
+ import { GlobalStylesContext } from '../global-styles';
22
+ import { globalStylesDataKey } from '../../store/private-keys';
23
+ import { getVariationStylesWithRefValues } from '../../hooks/block-style-variation';
24
+
25
+ const styleIcon = (
26
+ <SVG
27
+ viewBox="0 0 24 24"
28
+ xmlns="http://www.w3.org/2000/svg"
29
+ width="24"
30
+ height="24"
31
+ aria-hidden="true"
32
+ focusable="false"
33
+ >
34
+ <Path d="M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3z" />
35
+ <Path
36
+ stroke="currentColor"
37
+ strokeWidth="1.5"
38
+ d="M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3z"
39
+ />
40
+ </SVG>
41
+ );
42
+
43
+ function SwitchSectionStyle( { clientId } ) {
44
+ const { stylesToRender, activeStyle, className } = useStylesForBlocks( {
45
+ clientId,
46
+ } );
47
+ const { updateBlockAttributes } = useDispatch( blockEditorStore );
48
+
49
+ // Get global styles data
50
+ const { merged: mergedConfig } = useContext( GlobalStylesContext );
51
+ const { globalSettings, globalStyles, blockName } = useSelect(
52
+ ( select ) => {
53
+ const settings = select( blockEditorStore ).getSettings();
54
+ return {
55
+ globalSettings: settings.__experimentalFeatures,
56
+ globalStyles: settings[ globalStylesDataKey ],
57
+ blockName: select( blockEditorStore ).getBlockName( clientId ),
58
+ };
59
+ },
60
+ [ clientId ]
61
+ );
62
+
63
+ // Get the background color for the active style
64
+ const activeStyleBackground = activeStyle?.name
65
+ ? getVariationStylesWithRefValues(
66
+ {
67
+ settings: mergedConfig?.settings ?? globalSettings,
68
+ styles: mergedConfig?.styles ?? globalStyles,
69
+ },
70
+ blockName,
71
+ activeStyle.name
72
+ )?.color?.background
73
+ : undefined;
74
+
75
+ if ( ! stylesToRender || stylesToRender.length === 0 ) {
76
+ return null;
77
+ }
78
+
79
+ const handleStyleSwitch = () => {
80
+ const currentIndex = stylesToRender.findIndex(
81
+ ( style ) => style.name === activeStyle.name
82
+ );
83
+
84
+ const nextIndex = ( currentIndex + 1 ) % stylesToRender.length;
85
+ const nextStyle = stylesToRender[ nextIndex ];
86
+
87
+ const styleClassName = replaceActiveStyle(
88
+ className,
89
+ activeStyle,
90
+ nextStyle
91
+ );
92
+
93
+ updateBlockAttributes( clientId, {
94
+ className: styleClassName,
95
+ } );
96
+ };
97
+
98
+ return (
99
+ <ToolbarGroup>
100
+ <ToolbarButton
101
+ onClick={ handleStyleSwitch }
102
+ label={ __( 'Shuffle styles' ) }
103
+ >
104
+ <Icon
105
+ icon={ styleIcon }
106
+ style={ {
107
+ fill: activeStyleBackground || 'transparent',
108
+ } }
109
+ />
110
+ </ToolbarButton>
111
+ </ToolbarGroup>
112
+ );
113
+ }
114
+
115
+ export default SwitchSectionStyle;
@@ -8,7 +8,7 @@ import { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordp
8
8
  import { useRef } from '@wordpress/element';
9
9
  import { switchToBlockType, store as blocksStore } from '@wordpress/blocks';
10
10
  import { speak } from '@wordpress/a11y';
11
- import { __ } from '@wordpress/i18n';
11
+ import { __, sprintf, _n } from '@wordpress/i18n';
12
12
 
13
13
  /**
14
14
  * Internal dependencies
@@ -92,19 +92,35 @@ export default function BlockTools( {
92
92
  return;
93
93
  }
94
94
 
95
- if ( isMatch( 'core/block-editor/move-up', event ) ) {
95
+ if (
96
+ isMatch( 'core/block-editor/move-up', event ) ||
97
+ isMatch( 'core/block-editor/move-down', event )
98
+ ) {
96
99
  const clientIds = getSelectedBlockClientIds();
97
100
  if ( clientIds.length ) {
98
101
  event.preventDefault();
99
102
  const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
100
- moveBlocksUp( clientIds, rootClientId );
101
- }
102
- } else if ( isMatch( 'core/block-editor/move-down', event ) ) {
103
- const clientIds = getSelectedBlockClientIds();
104
- if ( clientIds.length ) {
105
- event.preventDefault();
106
- const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
107
- moveBlocksDown( clientIds, rootClientId );
103
+ const direction = isMatch( 'core/block-editor/move-up', event )
104
+ ? 'up'
105
+ : 'down';
106
+ if ( direction === 'up' ) {
107
+ moveBlocksUp( clientIds, rootClientId );
108
+ } else {
109
+ moveBlocksDown( clientIds, rootClientId );
110
+ }
111
+ const blockLength = Array.isArray( clientIds )
112
+ ? clientIds.length
113
+ : 1;
114
+ const message = sprintf(
115
+ // translators: %d: the name of the block that has been moved
116
+ _n(
117
+ '%d block moved.',
118
+ '%d blocks moved.',
119
+ clientIds.length
120
+ ),
121
+ blockLength
122
+ );
123
+ speak( message );
108
124
  }
109
125
  } else if ( isMatch( 'core/block-editor/duplicate', event ) ) {
110
126
  const clientIds = getSelectedBlockClientIds();
@@ -57,6 +57,18 @@
57
57
  }
58
58
  }
59
59
 
60
+ // The black plus that shows up on the right side of an empty paragraph block.
61
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter {
62
+ position: absolute;
63
+ top: 0;
64
+ right: 0;
65
+ line-height: 0;
66
+
67
+ &:disabled {
68
+ display: none;
69
+ }
70
+ }
71
+
60
72
  // Sibling inserter / "inbetweenserter".
61
73
  .block-editor-block-list__empty-block-inserter,
62
74
  .block-editor-block-list__insertion-point-inserter {
@@ -17,7 +17,7 @@ import {
17
17
  import { store as blockEditorStore } from '../../store';
18
18
  import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
19
19
  import { hasStickyOrFixedPositionValue } from '../../hooks/position';
20
- import { getVisibleElementBounds } from '../../utils/dom';
20
+ import { getElementBounds } from '../../utils/dom';
21
21
 
22
22
  const COMMON_PROPS = {
23
23
  placement: 'top-start',
@@ -68,7 +68,7 @@ function getProps(
68
68
  // Get how far the content area has been scrolled.
69
69
  const scrollTop = scrollContainer?.scrollTop || 0;
70
70
 
71
- const blockRect = getVisibleElementBounds( selectedBlockElement );
71
+ const blockRect = getElementBounds( selectedBlockElement );
72
72
  const contentRect = contentElement.getBoundingClientRect();
73
73
 
74
74
  // Get the vertical position of top of the visible content area.
@@ -40,7 +40,9 @@ export function useShowBlockTools() {
40
40
  const _showEmptyBlockSideInserter =
41
41
  clientId &&
42
42
  ! isTyping() &&
43
- editorMode === 'edit' &&
43
+ // Hide the block inserter on the navigation mode.
44
+ // See https://github.com/WordPress/gutenberg/pull/66636#discussion_r1824728483.
45
+ editorMode !== 'navigation' &&
44
46
  isEmptyDefaultBlock;
45
47
  const _showBlockToolbarPopover =
46
48
  ! getSettings().hasFixedToolbar &&
@@ -3,10 +3,6 @@
3
3
  */
4
4
  import { createSlotFill } from '@wordpress/components';
5
5
 
6
- const { Fill: __unstableCommentIconFill, Slot } = createSlotFill(
7
- '__unstableCommentIconFill'
8
- );
6
+ const CommentIconSlotFill = createSlotFill( Symbol( 'CommentIconSlotFill' ) );
9
7
 
10
- __unstableCommentIconFill.Slot = Slot;
11
-
12
- export default __unstableCommentIconFill;
8
+ export default CommentIconSlotFill;
@@ -3,10 +3,8 @@
3
3
  */
4
4
  import { createSlotFill } from '@wordpress/components';
5
5
 
6
- const { Fill: __unstableCommentIconToolbarFill, Slot } = createSlotFill(
7
- '__unstableCommentIconToolbarFill'
6
+ const CommentIconToolbarSlotFill = createSlotFill(
7
+ Symbol( 'CommentIconToolbarSlotFill' )
8
8
  );
9
9
 
10
- __unstableCommentIconToolbarFill.Slot = Slot;
11
-
12
- export default __unstableCommentIconToolbarFill;
10
+ export default CommentIconToolbarSlotFill;
@@ -10,14 +10,32 @@ import { useSettings } from '../use-settings';
10
10
 
11
11
  export default createHigherOrderComponent( ( WrappedComponent ) => {
12
12
  return ( props ) => {
13
- const [ colorsFeature, enableCustomColors ] = useSettings(
14
- 'color.palette',
15
- 'color.custom'
13
+ // Get the default colors, theme colors, and custom colors
14
+ const [
15
+ defaultColors,
16
+ themeColors,
17
+ customColors,
18
+ enableCustomColors,
19
+ enableDefaultColors,
20
+ ] = useSettings(
21
+ 'color.palette.default',
22
+ 'color.palette.theme',
23
+ 'color.palette.custom',
24
+ 'color.custom',
25
+ 'color.defaultPalette'
16
26
  );
17
- const {
18
- colors = colorsFeature,
19
- disableCustomColors = ! enableCustomColors,
20
- } = props;
27
+
28
+ const _colors = enableDefaultColors
29
+ ? [
30
+ ...( themeColors || [] ),
31
+ ...( defaultColors || [] ),
32
+ ...( customColors || [] ),
33
+ ]
34
+ : [ ...( themeColors || [] ), ...( customColors || [] ) ];
35
+
36
+ const { colors = _colors, disableCustomColors = ! enableCustomColors } =
37
+ props;
38
+
21
39
  const hasColorsToChoose =
22
40
  ( colors && colors.length > 0 ) || ! disableCustomColors;
23
41
  return (
@@ -24,20 +24,11 @@
24
24
  .block-editor-default-block-appender__content {
25
25
  // Set the opacity of the initial block appender to the same as placeholder text in an empty Paragraph block.
26
26
  opacity: 0.62;
27
- }
28
-
29
- // In "constrained" layout containers, the first and last paragraphs have their margins zeroed out.
30
- // In the case of this appender, it needs to apply those same rules to avoid layout shifts.
31
- // Such shifts happen when the bottom margin of the Title block has been set to less than the default 1em margin of paragraphs.
32
- :where(body .is-layout-constrained) &,
33
- :where(.wp-site-blocks) & {
34
- > :first-child {
35
- margin-block-start: 0;
36
- margin-block-end: 0;
37
- }
38
27
 
39
- // Since this appender will only ever appear on an entirely empty document, we don't account for last-child.
40
- // This is also because it will never be the last child, the block inserter that sits in this appender is the last child.
28
+ // The following prevents user agent styles from applying margins to the appender's inner paragraph.
29
+ // This in turn prevents layout shift due to layout styles removing margins from first and last children.
30
+ margin-block-start: 0;
31
+ margin-block-end: 0;
41
32
  }
42
33
 
43
34
  // Dropzone.
@@ -62,9 +53,7 @@
62
53
  }
63
54
  }
64
55
 
65
- // The black plus that shows up on the right side of an empty paragraph block, or the initial appender
66
- // that exists only on empty documents.
67
- .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter,
56
+ // The initial appender that exists only on empty documents.
68
57
  .block-editor-default-block-appender .block-editor-inserter {
69
58
  position: absolute;
70
59
  top: 0;
@@ -76,10 +65,11 @@
76
65
  }
77
66
  }
78
67
 
79
-
80
68
  /**
81
- * Fixed position appender.
82
- * These styles apply to all in-canvas inserters that exist inside nesting containers.
69
+ * Fixed position appender (right bottom corner).
70
+ *
71
+ * These styles apply to all in-canvas inserters. All in-canvas inserters always
72
+ * exist within a block.
83
73
  */
84
74
 
85
75
  .block-editor-block-list__block .block-list-appender {
@@ -96,6 +86,10 @@
96
86
  line-height: 0;
97
87
  }
98
88
 
89
+ .block-editor-inserter:disabled {
90
+ display: none;
91
+ }
92
+
99
93
  .block-editor-default-block-appender {
100
94
  height: $button-size-small;
101
95
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { SelectControl } from '@wordpress/components';
4
+ import { CustomSelectControl } from '@wordpress/components';
5
5
  import deprecated from '@wordpress/deprecated';
6
6
  import { __ } from '@wordpress/i18n';
7
7
 
@@ -30,13 +30,15 @@ export default function FontFamilyControl( {
30
30
  }
31
31
 
32
32
  const options = [
33
- { value: '', label: __( 'Default' ) },
34
- ...fontFamilies.map( ( { fontFamily, name } ) => {
35
- return {
36
- value: fontFamily,
37
- label: name || fontFamily,
38
- };
39
- } ),
33
+ {
34
+ key: '',
35
+ name: __( 'Default' ),
36
+ },
37
+ ...fontFamilies.map( ( { fontFamily, name } ) => ( {
38
+ key: fontFamily,
39
+ name: name || fontFamily,
40
+ style: { fontFamily },
41
+ } ) ),
40
42
  ];
41
43
 
42
44
  if ( ! __nextHasNoMarginBottom ) {
@@ -51,14 +53,12 @@ export default function FontFamilyControl( {
51
53
  }
52
54
 
53
55
  return (
54
- <SelectControl
56
+ <CustomSelectControl
55
57
  __next40pxDefaultSize={ __next40pxDefaultSize }
56
- __nextHasNoMarginBottom={ __nextHasNoMarginBottom }
57
58
  label={ __( 'Font' ) }
58
- options={ options }
59
59
  value={ value }
60
- onChange={ onChange }
61
- labelPosition="top"
60
+ onChange={ ( { selectedItem } ) => onChange( selectedItem.key ) }
61
+ options={ options }
62
62
  { ...props }
63
63
  />
64
64
  );
@@ -147,24 +147,30 @@ function splitStyleValue( value ) {
147
147
  return value;
148
148
  }
149
149
 
150
- function splitGapValue( value ) {
151
- // Check for shorthand value (a string value).
152
- if ( value && typeof value === 'string' ) {
153
- // If the value is a string, treat it as a single side (top) for the spacing controls.
154
- return {
155
- top: value,
156
- };
150
+ function splitGapValue( value, isAxialGap ) {
151
+ if ( ! value ) {
152
+ return value;
157
153
  }
158
154
 
159
- if ( value ) {
160
- return {
161
- ...value,
162
- right: value?.left,
163
- bottom: value?.top,
164
- };
155
+ // Check for shorthand value (a string value).
156
+ if ( typeof value === 'string' ) {
157
+ /*
158
+ * Map the string value to appropriate sides for the spacing control depending
159
+ * on whether the current block has axial gap support or not.
160
+ *
161
+ * Note: The axial value pairs must match for the spacing control to display
162
+ * the appropriate horizontal/vertical sliders.
163
+ */
164
+ return isAxialGap
165
+ ? { top: value, right: value, bottom: value, left: value }
166
+ : { top: value };
165
167
  }
166
168
 
167
- return value;
169
+ return {
170
+ ...value,
171
+ right: value?.left,
172
+ bottom: value?.top,
173
+ };
168
174
  }
169
175
 
170
176
  function DimensionsToolsPanel( {
@@ -325,13 +331,13 @@ export default function DimensionsPanel( {
325
331
 
326
332
  // Block Gap
327
333
  const showGapControl = useHasGap( settings );
328
- const gapValue = decodeValue( inheritedValue?.spacing?.blockGap );
329
- const gapValues = splitGapValue( gapValue );
330
334
  const gapSides = Array.isArray( settings?.spacing?.blockGap )
331
335
  ? settings?.spacing?.blockGap
332
336
  : settings?.spacing?.blockGap?.sides;
333
337
  const isAxialGap =
334
338
  gapSides && gapSides.some( ( side ) => AXIAL_SIDES.includes( side ) );
339
+ const gapValue = decodeValue( inheritedValue?.spacing?.blockGap );
340
+ const gapValues = splitGapValue( gapValue, isAxialGap );
335
341
  const setGapValue = ( newGapValue ) => {
336
342
  onChange(
337
343
  setImmutably( value, [ 'spacing', 'blockGap' ], newGapValue )
@@ -855,7 +855,7 @@ describe( 'global styles renderer', () => {
855
855
 
856
856
  it( 'should return block selectors data with old experimental selectors', () => {
857
857
  const imageSupports = {
858
- __experimentalBorder: {
858
+ border: {
859
859
  radius: true,
860
860
  __experimentalSelector: 'img, .crop-area',
861
861
  },
@@ -47,7 +47,7 @@ const ELEMENT_CLASS_NAMES = {
47
47
  // List of block support features that can have their related styles
48
48
  // generated under their own feature level selector rather than the block's.
49
49
  const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {
50
- __experimentalBorder: 'border',
50
+ border: 'border',
51
51
  color: 'color',
52
52
  spacing: 'spacing',
53
53
  typography: 'typography',
@@ -7,13 +7,26 @@
7
7
  // We don't want to animate the transform of the translateX because it is used
8
8
  // to "center" the canvas. Leaving it on causes the canvas to slide around in
9
9
  // odd ways.
10
- @include editor-canvas-resize-animation(transform 0s, scale 0s, padding 0s);
10
+ @include editor-canvas-resize-animation( transform 0s, scale 0s, padding 0s, translate 0s);
11
11
 
12
12
  &.zoom-out-animation {
13
- // we only want to animate the scaling when entering zoom out. When sidebars
13
+ $scroll-top: var(--wp-block-editor-iframe-zoom-out-scroll-top, 0);
14
+ $scroll-top-next: var(--wp-block-editor-iframe-zoom-out-scroll-top-next, 0);
15
+
16
+ position: fixed;
17
+ left: 0;
18
+ right: 0;
19
+ top: calc(-1 * #{$scroll-top});
20
+ bottom: 0;
21
+ translate: 0 calc(#{$scroll-top} - #{$scroll-top-next});
22
+ // Force preserving a scrollbar gutter as scrollbar-gutter isn't supported in all browsers yet,
23
+ // and removing the scrollbar causes the content to shift.
24
+ overflow-y: scroll;
25
+
26
+ // We only want to animate the scaling when entering zoom out. When sidebars
14
27
  // are toggled, the resizing of the iframe handles scaling the canvas as well,
15
28
  // and the doubled animations cause very odd animations.
16
- @include editor-canvas-resize-animation(transform 0s);
29
+ @include editor-canvas-resize-animation( transform 0s, top 0s, bottom 0s, right 0s, left 0s );
17
30
  }
18
31
  }
19
32
 
@@ -37,15 +37,10 @@ export function getCompatibilityStyles() {
37
37
  return accumulator;
38
38
  }
39
39
 
40
- // Don't try to add the reset styles, which were removed as a dependency
41
- // from `edit-blocks` for the iframe since we don't need to reset admin
42
- // styles.
43
- if (
44
- [
45
- 'wp-reset-editor-styles-css',
46
- 'wp-reset-editor-styles-rtl-css',
47
- ].includes( ownerNode.id )
48
- ) {
40
+ // Don't try to add core WP styles. We are responsible for adding
41
+ // them. This compatibility layer is only meant to add styles added
42
+ // by plugins or themes.
43
+ if ( ownerNode.id.startsWith( 'wp-' ) ) {
49
44
  return accumulator;
50
45
  }
51
46