@wordpress/block-editor 14.5.0 → 14.7.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 (541) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +0 -8
  3. package/build/autocompleters/block.js +13 -5
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-canvas/index.js +10 -0
  6. package/build/components/block-canvas/index.js.map +1 -1
  7. package/build/components/block-card/index.js +2 -2
  8. package/build/components/block-card/index.js.map +1 -1
  9. package/build/components/block-full-height-alignment-control/index.js +1 -1
  10. package/build/components/block-full-height-alignment-control/index.js.map +1 -1
  11. package/build/components/block-list/block.js +15 -29
  12. package/build/components/block-list/block.js.map +1 -1
  13. package/build/components/block-list/block.native.js +1 -7
  14. package/build/components/block-list/block.native.js.map +1 -1
  15. package/build/components/block-list/index.js +5 -5
  16. package/build/components/block-list/index.js.map +1 -1
  17. package/build/components/block-list/use-block-props/index.js +1 -2
  18. package/build/components/block-list/use-block-props/index.js.map +1 -1
  19. package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -3
  20. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  21. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
  22. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  23. package/build/components/block-list/use-in-between-inserter.js +1 -1
  24. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  25. package/build/components/block-patterns-list/index.js +23 -26
  26. package/build/components/block-patterns-list/index.js.map +1 -1
  27. package/build/components/block-patterns-paging/index.js +1 -1
  28. package/build/components/block-patterns-paging/index.js.map +1 -1
  29. package/build/components/block-popover/index.js +3 -46
  30. package/build/components/block-popover/index.js.map +1 -1
  31. package/build/components/block-preview/async.js +51 -0
  32. package/build/components/block-preview/async.js.map +1 -0
  33. package/build/components/block-preview/index.js +6 -3
  34. package/build/components/block-preview/index.js.map +1 -1
  35. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -0
  36. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  37. package/build/components/block-settings-menu/index.js +4 -3
  38. package/build/components/block-settings-menu/index.js.map +1 -1
  39. package/build/components/block-toolbar/change-design.js +119 -0
  40. package/build/components/block-toolbar/change-design.js.map +1 -0
  41. package/build/components/block-toolbar/index.js +19 -7
  42. package/build/components/block-toolbar/index.js.map +1 -1
  43. package/build/components/block-tools/index.js +16 -19
  44. package/build/components/block-tools/index.js.map +1 -1
  45. package/build/components/block-tools/insertion-point.js +4 -3
  46. package/build/components/block-tools/insertion-point.js.map +1 -1
  47. package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  48. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  49. package/build/components/block-tools/use-show-block-tools.js +7 -10
  50. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  51. package/build/components/block-tools/zoom-out-mode-inserters.js +20 -29
  52. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  53. package/build/components/block-variation-transforms/index.js +2 -2
  54. package/build/components/block-variation-transforms/index.js.map +1 -1
  55. package/build/components/block-vertical-alignment-control/ui.js +6 -10
  56. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  57. package/build/components/border-radius-control/linked-button.js +7 -10
  58. package/build/components/border-radius-control/linked-button.js.map +1 -1
  59. package/build/components/collab/block-comment-icon-slot.js +18 -0
  60. package/build/components/collab/block-comment-icon-slot.js.map +1 -0
  61. package/build/components/collab/block-comment-icon-toolbar-slot.js +18 -0
  62. package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
  63. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  64. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  65. package/build/components/convert-to-group-buttons/toolbar.js +4 -4
  66. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  67. package/build/components/global-styles/color-panel.js +1 -4
  68. package/build/components/global-styles/color-panel.js.map +1 -1
  69. package/build/components/global-styles/dimensions-panel.js +26 -14
  70. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  71. package/build/components/global-styles/use-global-styles-context.native.js +6 -0
  72. package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
  73. package/build/components/iframe/get-compatibility-styles.js +4 -4
  74. package/build/components/iframe/get-compatibility-styles.js.map +1 -1
  75. package/build/components/iframe/index.js +33 -22
  76. package/build/components/iframe/index.js.map +1 -1
  77. package/build/components/image-size-control/index.js +61 -20
  78. package/build/components/image-size-control/index.js.map +1 -1
  79. package/build/components/inner-blocks/index.js +9 -5
  80. package/build/components/inner-blocks/index.js.map +1 -1
  81. package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  82. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  83. package/build/components/inserter/block-patterns-tab/index.js +1 -2
  84. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  85. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +5 -3
  86. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  87. package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  88. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  89. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +3 -0
  90. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  91. package/build/components/inserter/block-patterns-tab/utils.js +5 -1
  92. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  93. package/build/components/inserter/category-tabs/index.js +15 -2
  94. package/build/components/inserter/category-tabs/index.js.map +1 -1
  95. package/build/components/inserter/hooks/use-block-types-state.js +1 -1
  96. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  97. package/build/components/inserter/hooks/use-patterns-paging.js +0 -5
  98. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  99. package/build/components/inserter/menu.js +4 -2
  100. package/build/components/inserter/menu.js.map +1 -1
  101. package/build/components/inserter/search-results.js +0 -2
  102. package/build/components/inserter/search-results.js.map +1 -1
  103. package/build/components/inserter-button/index.native.js +1 -1
  104. package/build/components/inserter-button/index.native.js.map +1 -1
  105. package/build/components/inspector-controls-tabs/index.js +0 -2
  106. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  107. package/build/components/inspector-controls-tabs/utils.js +3 -6
  108. package/build/components/inspector-controls-tabs/utils.js.map +1 -1
  109. package/build/components/link-control/link-preview.js +12 -9
  110. package/build/components/link-control/link-preview.js.map +1 -1
  111. package/build/components/list-view/appender.js +4 -3
  112. package/build/components/list-view/appender.js.map +1 -1
  113. package/build/components/list-view/branch.js +6 -5
  114. package/build/components/list-view/branch.js.map +1 -1
  115. package/build/components/list-view/index.js +1 -2
  116. package/build/components/list-view/index.js.map +1 -1
  117. package/build/components/media-placeholder/index.js +4 -4
  118. package/build/components/media-placeholder/index.js.map +1 -1
  119. package/build/components/provider/index.js +1 -1
  120. package/build/components/provider/index.js.map +1 -1
  121. package/build/components/rich-text/event-listeners/index.js +3 -1
  122. package/build/components/rich-text/event-listeners/index.js.map +1 -1
  123. package/build/components/rich-text/index.js +1 -1
  124. package/build/components/rich-text/index.js.map +1 -1
  125. package/build/components/rich-text/index.native.js +2 -6
  126. package/build/components/rich-text/index.native.js.map +1 -1
  127. package/build/components/spacing-sizes-control/index.js +2 -2
  128. package/build/components/spacing-sizes-control/index.js.map +1 -1
  129. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
  130. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  131. package/build/components/spacing-sizes-control/linked-button.js +1 -5
  132. package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
  133. package/build/components/tabbed-sidebar/index.js +1 -1
  134. package/build/components/tabbed-sidebar/index.js.map +1 -1
  135. package/build/components/tool-selector/index.js +1 -4
  136. package/build/components/tool-selector/index.js.map +1 -1
  137. package/build/components/url-input/index.js +4 -2
  138. package/build/components/url-input/index.js.map +1 -1
  139. package/build/components/use-block-commands/index.js +6 -7
  140. package/build/components/use-block-commands/index.js.map +1 -1
  141. package/build/components/use-block-drop-zone/index.js +5 -5
  142. package/build/components/use-block-drop-zone/index.js.map +1 -1
  143. package/build/components/use-block-drop-zone/index.native.js +0 -1
  144. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  145. package/build/components/use-moving-animation/index.js +1 -3
  146. package/build/components/use-moving-animation/index.js.map +1 -1
  147. package/build/components/use-settings/index.js +1 -3
  148. package/build/components/use-settings/index.js.map +1 -1
  149. package/build/components/writing-flow/index.js +5 -3
  150. package/build/components/writing-flow/index.js.map +1 -1
  151. package/build/components/writing-flow/use-tab-nav.js +2 -3
  152. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  153. package/build/hooks/block-bindings.js +19 -8
  154. package/build/hooks/block-bindings.js.map +1 -1
  155. package/build/hooks/contrast-checker.js +0 -1
  156. package/build/hooks/contrast-checker.js.map +1 -1
  157. package/build/hooks/duotone.js +2 -2
  158. package/build/hooks/duotone.js.map +1 -1
  159. package/build/hooks/font-family.js +1 -1
  160. package/build/hooks/font-family.js.map +1 -1
  161. package/build/hooks/style.js +4 -1
  162. package/build/hooks/style.js.map +1 -1
  163. package/build/hooks/supports.js +6 -6
  164. package/build/hooks/supports.js.map +1 -1
  165. package/build/hooks/typography.js +5 -5
  166. package/build/hooks/typography.js.map +1 -1
  167. package/build/hooks/use-zoom-out.js +13 -22
  168. package/build/hooks/use-zoom-out.js.map +1 -1
  169. package/build/hooks/utils.js +2 -2
  170. package/build/hooks/utils.js.map +1 -1
  171. package/build/index.js +0 -7
  172. package/build/index.js.map +1 -1
  173. package/build/lock-unlock.js.map +1 -1
  174. package/build/private-apis.js +6 -3
  175. package/build/private-apis.js.map +1 -1
  176. package/build/store/actions.js +2 -33
  177. package/build/store/actions.js.map +1 -1
  178. package/build/store/defaults.js +1 -1
  179. package/build/store/defaults.js.map +1 -1
  180. package/build/store/private-actions.js +57 -8
  181. package/build/store/private-actions.js.map +1 -1
  182. package/build/store/private-selectors.js +10 -22
  183. package/build/store/private-selectors.js.map +1 -1
  184. package/build/store/reducer.js +16 -6
  185. package/build/store/reducer.js.map +1 -1
  186. package/build/store/selectors.js +53 -15
  187. package/build/store/selectors.js.map +1 -1
  188. package/build/store/utils.js +5 -4
  189. package/build/store/utils.js.map +1 -1
  190. package/build/utils/dom.js +37 -17
  191. package/build/utils/dom.js.map +1 -1
  192. package/build/utils/get-font-styles-and-weights.js +1 -1
  193. package/build/utils/get-font-styles-and-weights.js.map +1 -1
  194. package/build/utils/transform-styles/index.js +4 -3
  195. package/build/utils/transform-styles/index.js.map +1 -1
  196. package/build-module/autocompleters/block.js +14 -6
  197. package/build-module/autocompleters/block.js.map +1 -1
  198. package/build-module/components/block-canvas/index.js +11 -1
  199. package/build-module/components/block-canvas/index.js.map +1 -1
  200. package/build-module/components/block-card/index.js +3 -3
  201. package/build-module/components/block-card/index.js.map +1 -1
  202. package/build-module/components/block-full-height-alignment-control/index.js +1 -1
  203. package/build-module/components/block-full-height-alignment-control/index.js.map +1 -1
  204. package/build-module/components/block-list/block.js +16 -28
  205. package/build-module/components/block-list/block.js.map +1 -1
  206. package/build-module/components/block-list/block.native.js +1 -7
  207. package/build-module/components/block-list/block.native.js.map +1 -1
  208. package/build-module/components/block-list/index.js +5 -5
  209. package/build-module/components/block-list/index.js.map +1 -1
  210. package/build-module/components/block-list/use-block-props/index.js +1 -2
  211. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  212. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -3
  213. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  214. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
  215. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  216. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  217. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  218. package/build-module/components/block-patterns-list/index.js +23 -26
  219. package/build-module/components/block-patterns-list/index.js.map +1 -1
  220. package/build-module/components/block-patterns-paging/index.js +1 -1
  221. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  222. package/build-module/components/block-popover/index.js +4 -47
  223. package/build-module/components/block-popover/index.js.map +1 -1
  224. package/build-module/components/block-preview/async.js +44 -0
  225. package/build-module/components/block-preview/async.js.map +1 -0
  226. package/build-module/components/block-preview/index.js +6 -3
  227. package/build-module/components/block-preview/index.js.map +1 -1
  228. package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -0
  229. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  230. package/build-module/components/block-settings-menu/index.js +5 -4
  231. package/build-module/components/block-settings-menu/index.js.map +1 -1
  232. package/build-module/components/block-toolbar/change-design.js +111 -0
  233. package/build-module/components/block-toolbar/change-design.js.map +1 -0
  234. package/build-module/components/block-toolbar/index.js +19 -7
  235. package/build-module/components/block-toolbar/index.js.map +1 -1
  236. package/build-module/components/block-tools/index.js +17 -20
  237. package/build-module/components/block-tools/index.js.map +1 -1
  238. package/build-module/components/block-tools/insertion-point.js +4 -3
  239. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  240. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  241. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  242. package/build-module/components/block-tools/use-show-block-tools.js +7 -10
  243. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  244. package/build-module/components/block-tools/zoom-out-mode-inserters.js +20 -29
  245. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  246. package/build-module/components/block-variation-transforms/index.js +2 -2
  247. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  248. package/build-module/components/block-vertical-alignment-control/ui.js +6 -10
  249. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  250. package/build-module/components/border-radius-control/linked-button.js +8 -11
  251. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  252. package/build-module/components/collab/block-comment-icon-slot.js +11 -0
  253. package/build-module/components/collab/block-comment-icon-slot.js.map +1 -0
  254. package/build-module/components/collab/block-comment-icon-toolbar-slot.js +11 -0
  255. package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
  256. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  257. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  258. package/build-module/components/convert-to-group-buttons/toolbar.js +4 -4
  259. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  260. package/build-module/components/global-styles/color-panel.js +2 -5
  261. package/build-module/components/global-styles/color-panel.js.map +1 -1
  262. package/build-module/components/global-styles/dimensions-panel.js +26 -14
  263. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  264. package/build-module/components/global-styles/use-global-styles-context.native.js +6 -0
  265. package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
  266. package/build-module/components/iframe/get-compatibility-styles.js +4 -4
  267. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
  268. package/build-module/components/iframe/index.js +33 -22
  269. package/build-module/components/iframe/index.js.map +1 -1
  270. package/build-module/components/image-size-control/index.js +62 -21
  271. package/build-module/components/image-size-control/index.js.map +1 -1
  272. package/build-module/components/inner-blocks/index.js +9 -5
  273. package/build-module/components/inner-blocks/index.js.map +1 -1
  274. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  275. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  276. package/build-module/components/inserter/block-patterns-tab/index.js +1 -2
  277. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  278. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +6 -4
  279. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  280. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  281. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  282. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +4 -1
  283. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  284. package/build-module/components/inserter/block-patterns-tab/utils.js +4 -0
  285. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  286. package/build-module/components/inserter/category-tabs/index.js +15 -2
  287. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  288. package/build-module/components/inserter/hooks/use-block-types-state.js +1 -1
  289. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  290. package/build-module/components/inserter/hooks/use-patterns-paging.js +1 -6
  291. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  292. package/build-module/components/inserter/menu.js +5 -3
  293. package/build-module/components/inserter/menu.js.map +1 -1
  294. package/build-module/components/inserter/search-results.js +0 -2
  295. package/build-module/components/inserter/search-results.js.map +1 -1
  296. package/build-module/components/inserter-button/index.native.js +1 -1
  297. package/build-module/components/inserter-button/index.native.js.map +1 -1
  298. package/build-module/components/inspector-controls-tabs/index.js +0 -2
  299. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  300. package/build-module/components/inspector-controls-tabs/utils.js +3 -6
  301. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
  302. package/build-module/components/link-control/link-preview.js +13 -10
  303. package/build-module/components/link-control/link-preview.js.map +1 -1
  304. package/build-module/components/list-view/appender.js +4 -3
  305. package/build-module/components/list-view/appender.js.map +1 -1
  306. package/build-module/components/list-view/branch.js +7 -6
  307. package/build-module/components/list-view/branch.js.map +1 -1
  308. package/build-module/components/list-view/index.js +1 -2
  309. package/build-module/components/list-view/index.js.map +1 -1
  310. package/build-module/components/media-placeholder/index.js +4 -4
  311. package/build-module/components/media-placeholder/index.js.map +1 -1
  312. package/build-module/components/provider/index.js +1 -1
  313. package/build-module/components/provider/index.js.map +1 -1
  314. package/build-module/components/rich-text/event-listeners/index.js +4 -2
  315. package/build-module/components/rich-text/event-listeners/index.js.map +1 -1
  316. package/build-module/components/rich-text/index.js +1 -1
  317. package/build-module/components/rich-text/index.js.map +1 -1
  318. package/build-module/components/rich-text/index.native.js +2 -6
  319. package/build-module/components/rich-text/index.native.js.map +1 -1
  320. package/build-module/components/spacing-sizes-control/index.js +3 -3
  321. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  322. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  323. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  324. package/build-module/components/spacing-sizes-control/linked-button.js +2 -6
  325. package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
  326. package/build-module/components/tabbed-sidebar/index.js +1 -1
  327. package/build-module/components/tabbed-sidebar/index.js.map +1 -1
  328. package/build-module/components/tool-selector/index.js +1 -4
  329. package/build-module/components/tool-selector/index.js.map +1 -1
  330. package/build-module/components/url-input/index.js +4 -2
  331. package/build-module/components/url-input/index.js.map +1 -1
  332. package/build-module/components/use-block-commands/index.js +5 -5
  333. package/build-module/components/use-block-commands/index.js.map +1 -1
  334. package/build-module/components/use-block-drop-zone/index.js +5 -5
  335. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  336. package/build-module/components/use-block-drop-zone/index.native.js +0 -1
  337. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  338. package/build-module/components/use-moving-animation/index.js +1 -3
  339. package/build-module/components/use-moving-animation/index.js.map +1 -1
  340. package/build-module/components/use-settings/index.js +1 -3
  341. package/build-module/components/use-settings/index.js.map +1 -1
  342. package/build-module/components/writing-flow/index.js +5 -3
  343. package/build-module/components/writing-flow/index.js.map +1 -1
  344. package/build-module/components/writing-flow/use-tab-nav.js +2 -3
  345. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  346. package/build-module/hooks/block-bindings.js +20 -9
  347. package/build-module/hooks/block-bindings.js.map +1 -1
  348. package/build-module/hooks/contrast-checker.js +0 -1
  349. package/build-module/hooks/contrast-checker.js.map +1 -1
  350. package/build-module/hooks/duotone.js +2 -2
  351. package/build-module/hooks/duotone.js.map +1 -1
  352. package/build-module/hooks/font-family.js +1 -1
  353. package/build-module/hooks/font-family.js.map +1 -1
  354. package/build-module/hooks/style.js +4 -1
  355. package/build-module/hooks/style.js.map +1 -1
  356. package/build-module/hooks/supports.js +6 -6
  357. package/build-module/hooks/supports.js.map +1 -1
  358. package/build-module/hooks/typography.js +5 -5
  359. package/build-module/hooks/typography.js.map +1 -1
  360. package/build-module/hooks/use-zoom-out.js +15 -23
  361. package/build-module/hooks/use-zoom-out.js.map +1 -1
  362. package/build-module/hooks/utils.js +2 -2
  363. package/build-module/hooks/utils.js.map +1 -1
  364. package/build-module/index.js +1 -1
  365. package/build-module/index.js.map +1 -1
  366. package/build-module/lock-unlock.js.map +1 -1
  367. package/build-module/private-apis.js +7 -5
  368. package/build-module/private-apis.js.map +1 -1
  369. package/build-module/store/actions.js +2 -33
  370. package/build-module/store/actions.js.map +1 -1
  371. package/build-module/store/defaults.js +1 -1
  372. package/build-module/store/defaults.js.map +1 -1
  373. package/build-module/store/private-actions.js +54 -7
  374. package/build-module/store/private-actions.js.map +1 -1
  375. package/build-module/store/private-selectors.js +10 -21
  376. package/build-module/store/private-selectors.js.map +1 -1
  377. package/build-module/store/reducer.js +16 -6
  378. package/build-module/store/reducer.js.map +1 -1
  379. package/build-module/store/selectors.js +54 -16
  380. package/build-module/store/selectors.js.map +1 -1
  381. package/build-module/store/utils.js +3 -3
  382. package/build-module/store/utils.js.map +1 -1
  383. package/build-module/utils/dom.js +35 -16
  384. package/build-module/utils/dom.js.map +1 -1
  385. package/build-module/utils/get-font-styles-and-weights.js +2 -2
  386. package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
  387. package/build-module/utils/transform-styles/index.js +3 -2
  388. package/build-module/utils/transform-styles/index.js.map +1 -1
  389. package/build-style/content-rtl.css +16 -10
  390. package/build-style/content.css +16 -10
  391. package/build-style/style-rtl.css +47 -25
  392. package/build-style/style.css +47 -25
  393. package/build-types/utils/dom.d.ts +7 -9
  394. package/build-types/utils/dom.d.ts.map +1 -1
  395. package/package.json +34 -32
  396. package/src/autocompleters/block.js +16 -7
  397. package/src/components/block-canvas/index.js +17 -1
  398. package/src/components/block-canvas/style.scss +3 -1
  399. package/src/components/block-card/index.js +3 -3
  400. package/src/components/block-full-height-alignment-control/index.js +1 -1
  401. package/src/components/block-inspector/style.scss +2 -7
  402. package/src/components/block-list/block.js +29 -50
  403. package/src/components/block-list/block.native.js +0 -4
  404. package/src/components/block-list/content.scss +1 -1
  405. package/src/components/block-list/index.js +4 -4
  406. package/src/components/block-list/use-block-props/index.js +0 -2
  407. package/src/components/block-list/use-block-props/use-focus-first-element.js +5 -3
  408. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +7 -20
  409. package/src/components/block-list/use-in-between-inserter.js +1 -1
  410. package/src/components/block-patterns-list/README.md +8 -8
  411. package/src/components/block-patterns-list/index.js +35 -51
  412. package/src/components/block-patterns-list/stories/fixtures.js +834 -0
  413. package/src/components/block-patterns-list/stories/index.story.js +64 -0
  414. package/src/components/block-patterns-list/style.scss +2 -0
  415. package/src/components/block-patterns-paging/index.js +1 -1
  416. package/src/components/block-popover/index.js +4 -66
  417. package/src/components/block-preview/async.js +43 -0
  418. package/src/components/block-preview/index.js +8 -3
  419. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
  420. package/src/components/block-settings-menu/index.js +3 -0
  421. package/src/components/block-toolbar/change-design.js +127 -0
  422. package/src/components/block-toolbar/index.js +25 -8
  423. package/src/components/block-toolbar/style.scss +16 -0
  424. package/src/components/block-tools/index.js +30 -27
  425. package/src/components/block-tools/insertion-point.js +4 -3
  426. package/src/components/block-tools/style.scss +12 -20
  427. package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  428. package/src/components/block-tools/use-show-block-tools.js +3 -14
  429. package/src/components/block-tools/zoom-out-mode-inserters.js +25 -40
  430. package/src/components/block-variation-transforms/index.js +2 -2
  431. package/src/components/block-vertical-alignment-control/ui.js +11 -15
  432. package/src/components/border-radius-control/linked-button.js +9 -11
  433. package/src/components/collab/block-comment-icon-slot.js +12 -0
  434. package/src/components/collab/block-comment-icon-toolbar-slot.js +12 -0
  435. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  436. package/src/components/convert-to-group-buttons/toolbar.js +4 -4
  437. package/src/components/default-block-appender/content.scss +13 -19
  438. package/src/components/global-styles/color-panel.js +2 -10
  439. package/src/components/global-styles/dimensions-panel.js +22 -16
  440. package/src/components/global-styles/test/use-global-styles-context.native.js +1 -0
  441. package/src/components/global-styles/use-global-styles-context.native.js +6 -0
  442. package/src/components/iframe/content.scss +4 -9
  443. package/src/components/iframe/get-compatibility-styles.js +4 -9
  444. package/src/components/iframe/index.js +48 -34
  445. package/src/components/iframe/style.scss +2 -3
  446. package/src/components/image-size-control/index.js +74 -43
  447. package/src/components/image-size-control/test/index.js +5 -63
  448. package/src/components/inner-blocks/index.js +12 -6
  449. package/src/components/inserter/block-patterns-explorer/pattern-list.js +3 -6
  450. package/src/components/inserter/block-patterns-tab/index.js +0 -1
  451. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -4
  452. package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  453. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +8 -0
  454. package/src/components/inserter/block-patterns-tab/utils.js +5 -0
  455. package/src/components/inserter/category-tabs/index.js +16 -2
  456. package/src/components/inserter/hooks/use-block-types-state.js +6 -1
  457. package/src/components/inserter/hooks/use-patterns-paging.js +1 -6
  458. package/src/components/inserter/menu.js +6 -4
  459. package/src/components/inserter/search-results.js +0 -6
  460. package/src/components/inserter/style.scss +13 -0
  461. package/src/components/inserter-button/index.native.js +1 -1
  462. package/src/components/inspector-controls-tabs/index.js +1 -6
  463. package/src/components/inspector-controls-tabs/utils.js +0 -3
  464. package/src/components/link-control/link-preview.js +15 -8
  465. package/src/components/link-control/test/index.js +63 -24
  466. package/src/components/list-view/appender.js +5 -6
  467. package/src/components/list-view/branch.js +8 -6
  468. package/src/components/list-view/index.js +1 -2
  469. package/src/components/media-placeholder/index.js +4 -4
  470. package/src/components/provider/index.js +1 -3
  471. package/src/components/provider/test/experimental-provider.js +43 -1
  472. package/src/components/rich-text/event-listeners/index.js +4 -2
  473. package/src/components/rich-text/index.js +8 -1
  474. package/src/components/rich-text/index.native.js +0 -2
  475. package/src/components/spacing-sizes-control/index.js +3 -3
  476. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  477. package/src/components/spacing-sizes-control/linked-button.js +2 -12
  478. package/src/components/tabbed-sidebar/index.js +1 -1
  479. package/src/components/tabbed-sidebar/style.scss +1 -1
  480. package/src/components/tool-selector/index.js +1 -5
  481. package/src/components/url-input/index.js +4 -5
  482. package/src/components/use-block-commands/index.js +245 -234
  483. package/src/components/use-block-drop-zone/index.js +5 -5
  484. package/src/components/use-block-drop-zone/index.native.js +0 -1
  485. package/src/components/use-moving-animation/index.js +0 -1
  486. package/src/components/use-settings/index.js +0 -1
  487. package/src/components/writing-flow/index.js +5 -3
  488. package/src/components/writing-flow/use-tab-nav.js +1 -2
  489. package/src/hooks/block-bindings.js +48 -31
  490. package/src/hooks/contrast-checker.js +0 -1
  491. package/src/hooks/duotone.js +2 -2
  492. package/src/hooks/font-family.js +1 -1
  493. package/src/hooks/style.js +7 -3
  494. package/src/hooks/supports.js +6 -6
  495. package/src/hooks/typography.js +5 -5
  496. package/src/hooks/use-zoom-out.js +14 -34
  497. package/src/hooks/utils.js +7 -2
  498. package/src/index.js +0 -1
  499. package/src/private-apis.js +6 -3
  500. package/src/store/actions.js +3 -52
  501. package/src/store/defaults.js +2 -1
  502. package/src/store/private-actions.js +71 -8
  503. package/src/store/private-selectors.js +14 -25
  504. package/src/store/reducer.js +25 -11
  505. package/src/store/selectors.js +116 -53
  506. package/src/store/test/actions.js +41 -0
  507. package/src/store/test/private-selectors.js +5 -0
  508. package/src/store/test/reducer.js +23 -0
  509. package/src/store/utils.js +12 -11
  510. package/src/utils/dom.js +42 -17
  511. package/src/utils/get-font-styles-and-weights.js +2 -2
  512. package/src/utils/test/dom.js +224 -0
  513. package/src/utils/transform-styles/index.js +3 -2
  514. package/tsconfig.json +1 -0
  515. package/tsconfig.tsbuildinfo +1 -1
  516. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -57
  517. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
  518. package/build/components/block-toolbar/shuffle.js +0 -110
  519. package/build/components/block-toolbar/shuffle.js.map +0 -1
  520. package/build/components/block-tools/zoom-out-popover.js +0 -58
  521. package/build/components/block-tools/zoom-out-popover.js.map +0 -1
  522. package/build/components/block-tools/zoom-out-toolbar.js +0 -132
  523. package/build/components/block-tools/zoom-out-toolbar.js.map +0 -1
  524. package/build/components/block-vertical-alignment-control/icons.js +0 -48
  525. package/build/components/block-vertical-alignment-control/icons.js.map +0 -1
  526. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -51
  527. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
  528. package/build-module/components/block-toolbar/shuffle.js +0 -103
  529. package/build-module/components/block-toolbar/shuffle.js.map +0 -1
  530. package/build-module/components/block-tools/zoom-out-popover.js +0 -49
  531. package/build-module/components/block-tools/zoom-out-popover.js.map +0 -1
  532. package/build-module/components/block-tools/zoom-out-toolbar.js +0 -124
  533. package/build-module/components/block-tools/zoom-out-toolbar.js.map +0 -1
  534. package/build-module/components/block-vertical-alignment-control/icons.js +0 -41
  535. package/build-module/components/block-vertical-alignment-control/icons.js.map +0 -1
  536. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -65
  537. package/src/components/block-toolbar/shuffle.js +0 -111
  538. package/src/components/block-tools/zoom-out-popover.js +0 -47
  539. package/src/components/block-tools/zoom-out-toolbar.js +0 -135
  540. package/src/components/block-vertical-alignment-control/icons.js +0 -34
  541. /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
@@ -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
 
@@ -117,12 +117,12 @@ function Iframe( {
117
117
  const settings = getSettings();
118
118
  return {
119
119
  resolvedAssets: settings.__unstableResolvedAssets,
120
- isPreviewMode: settings.__unstableIsPreviewMode,
120
+ isPreviewMode: settings.isPreviewMode,
121
121
  };
122
122
  }, [] );
123
123
  const { styles = '', scripts = '' } = resolvedAssets;
124
124
  const [ iframeDocument, setIframeDocument ] = useState();
125
- const initialContainerWidth = useRef();
125
+ const initialContainerWidthRef = useRef( 0 );
126
126
  const [ bodyClasses, setBodyClasses ] = useState( [] );
127
127
  const clearerRef = useBlockSelectionClearer();
128
128
  const [ before, writingFlowRef, after ] = useWritingFlow();
@@ -191,6 +191,22 @@ function Iframe( {
191
191
  preventFileDropDefault,
192
192
  false
193
193
  );
194
+ // Prevent clicks on links from navigating away. Note that links
195
+ // inside `contenteditable` are already disabled by the browser, so
196
+ // this is for links in blocks outside of `contenteditable`.
197
+ iFrameDocument.addEventListener( 'click', ( event ) => {
198
+ if ( event.target.tagName === 'A' ) {
199
+ event.preventDefault();
200
+
201
+ // Appending a hash to the current URL will not reload the
202
+ // page. This is useful for e.g. footnotes.
203
+ const href = event.target.getAttribute( 'href' );
204
+ if ( href.startsWith( '#' ) ) {
205
+ iFrameDocument.defaultView.location.hash =
206
+ href.slice( 1 );
207
+ }
208
+ }
209
+ } );
194
210
  }
195
211
 
196
212
  node.addEventListener( 'load', onLoad );
@@ -243,10 +259,15 @@ function Iframe( {
243
259
 
244
260
  useEffect( () => {
245
261
  if ( ! isZoomedOut ) {
246
- initialContainerWidth.current = containerWidth;
262
+ initialContainerWidthRef.current = containerWidth;
247
263
  }
248
264
  }, [ containerWidth, isZoomedOut ] );
249
265
 
266
+ const scaleContainerWidth = Math.max(
267
+ initialContainerWidthRef.current,
268
+ containerWidth
269
+ );
270
+
250
271
  const disabledRef = useDisabled( { isDisabled: ! readonly } );
251
272
  const bodyRef = useMergeRefs( [
252
273
  useBubbleEvents( iframeDocument ),
@@ -267,6 +288,7 @@ function Iframe( {
267
288
  <html>
268
289
  <head>
269
290
  <meta charset="utf-8">
291
+ <base href="${ window.location.origin }">
270
292
  <script>window.frameElement._load()</script>
271
293
  <style>
272
294
  html{
@@ -299,17 +321,6 @@ function Iframe( {
299
321
  useEffect( () => cleanup, [ cleanup ] );
300
322
 
301
323
  const zoomOutAnimationClassnameRef = useRef( null );
302
- const handleZoomOutAnimationClassname = () => {
303
- clearTimeout( zoomOutAnimationClassnameRef.current );
304
-
305
- iframeDocument.documentElement.classList.add( 'zoom-out-animation' );
306
-
307
- zoomOutAnimationClassnameRef.current = setTimeout( () => {
308
- iframeDocument.documentElement.classList.remove(
309
- 'zoom-out-animation'
310
- );
311
- }, 400 ); // 400ms should match the animation speed used in components/iframe/content.scss
312
- };
313
324
 
314
325
  // Toggle zoom out CSS Classes only when zoom out mode changes. We could add these into the useEffect
315
326
  // that controls settings the CSS variables, but then we would need to do more work to ensure we're
@@ -320,6 +331,20 @@ function Iframe( {
320
331
  return;
321
332
  }
322
333
 
334
+ const handleZoomOutAnimationClassname = () => {
335
+ clearTimeout( zoomOutAnimationClassnameRef.current );
336
+
337
+ iframeDocument.documentElement.classList.add(
338
+ 'zoom-out-animation'
339
+ );
340
+
341
+ zoomOutAnimationClassnameRef.current = setTimeout( () => {
342
+ iframeDocument.documentElement.classList.remove(
343
+ 'zoom-out-animation'
344
+ );
345
+ }, 400 ); // 400ms should match the animation speed used in components/iframe/content.scss
346
+ };
347
+
323
348
  handleZoomOutAnimationClassname();
324
349
  iframeDocument.documentElement.classList.add( 'is-zoomed-out' );
325
350
 
@@ -337,7 +362,7 @@ function Iframe( {
337
362
 
338
363
  const maxWidth = 750;
339
364
  // Note: When we initialize the zoom out when the canvas is smaller (sidebars open),
340
- // initialContainerWidth will be smaller than the full page, and reflow will happen
365
+ // initialContainerWidthRef will be smaller than the full page, and reflow will happen
341
366
  // when the canvas area becomes larger due to sidebars closing. This is a known but
342
367
  // minor divergence for now.
343
368
 
@@ -346,13 +371,10 @@ function Iframe( {
346
371
  // but calc( 100px / 2px ) is not.
347
372
  iframeDocument.documentElement.style.setProperty(
348
373
  '--wp-block-editor-iframe-zoom-out-scale',
349
- scale === 'default'
374
+ scale === 'auto-scaled'
350
375
  ? ( Math.min( containerWidth, maxWidth ) -
351
376
  parseInt( frameSize ) * 2 ) /
352
- Math.max(
353
- initialContainerWidth.current,
354
- containerWidth
355
- )
377
+ scaleContainerWidth
356
378
  : scale
357
379
  );
358
380
 
@@ -374,15 +396,10 @@ function Iframe( {
374
396
  `${ containerWidth }px`
375
397
  );
376
398
  iframeDocument.documentElement.style.setProperty(
377
- '--wp-block-editor-iframe-zoom-out-outer-container-width',
378
- `${ Math.max( initialContainerWidth.current, containerWidth ) }px`
399
+ '--wp-block-editor-iframe-zoom-out-scale-container-width',
400
+ `${ scaleContainerWidth }px`
379
401
  );
380
402
 
381
- // iframeDocument.documentElement.style.setProperty(
382
- // '--wp-block-editor-iframe-zoom-out-outer-container-width',
383
- // `${ Math.max( initialContainerWidth.current, containerWidth ) }px`
384
- // );
385
-
386
403
  return () => {
387
404
  iframeDocument.documentElement.style.removeProperty(
388
405
  '--wp-block-editor-iframe-zoom-out-scale'
@@ -400,7 +417,7 @@ function Iframe( {
400
417
  '--wp-block-editor-iframe-zoom-out-container-width'
401
418
  );
402
419
  iframeDocument.documentElement.style.removeProperty(
403
- '--wp-block-editor-iframe-zoom-out-outer-container-width'
420
+ '--wp-block-editor-iframe-zoom-out-scale-container-width'
404
421
  );
405
422
  };
406
423
  }, [
@@ -412,6 +429,7 @@ function Iframe( {
412
429
  containerWidth,
413
430
  windowInnerWidth,
414
431
  isZoomedOut,
432
+ scaleContainerWidth,
415
433
  ] );
416
434
 
417
435
  // Make sure to not render the before and after focusable div elements in view
@@ -501,12 +519,8 @@ function Iframe( {
501
519
  isZoomedOut && 'is-zoomed-out'
502
520
  ) }
503
521
  style={ {
504
- '--wp-block-editor-iframe-zoom-out-outer-container-width':
505
- isZoomedOut &&
506
- `${ Math.max(
507
- initialContainerWidth.current,
508
- containerWidth
509
- ) }px`,
522
+ '--wp-block-editor-iframe-zoom-out-scale-container-width':
523
+ isZoomedOut && `${ scaleContainerWidth }px`,
510
524
  } }
511
525
  >
512
526
  { iframe }
@@ -1,7 +1,6 @@
1
1
  .block-editor-iframe__container {
2
2
  width: 100%;
3
3
  height: 100%;
4
- overflow-x: hidden;
5
4
  }
6
5
 
7
6
  .block-editor-iframe__scale-container {
@@ -9,8 +8,8 @@
9
8
  }
10
9
 
11
10
  .block-editor-iframe__scale-container.is-zoomed-out {
12
- $outer-container-width: var(--wp-block-editor-iframe-zoom-out-outer-container-width, 100vw);
13
- width: $outer-container-width;
11
+ $scale-container-width: var(--wp-block-editor-iframe-zoom-out-scale-container-width, 100vw);
12
+ width: $scale-container-width;
14
13
  // Position the iframe so that it is always aligned with the right side so that
15
14
  // the scrollbar is always visible on the right side
16
15
  position: absolute;
@@ -2,11 +2,11 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import {
5
- Button,
6
- ButtonGroup,
7
5
  SelectControl,
8
6
  __experimentalNumberControl as NumberControl,
9
7
  __experimentalHStack as HStack,
8
+ __experimentalToggleGroupControl as ToggleGroupControl,
9
+ __experimentalToggleGroupControlOption as ToggleGroupControlOption,
10
10
  } from '@wordpress/components';
11
11
  import { __ } from '@wordpress/i18n';
12
12
 
@@ -18,6 +18,25 @@ import useDimensionHandler from './use-dimension-handler';
18
18
  const IMAGE_SIZE_PRESETS = [ 25, 50, 75, 100 ];
19
19
  const noop = () => {};
20
20
 
21
+ /**
22
+ * Get scaled width and height for the given scale.
23
+ *
24
+ * @param {number} scale The scale to get the scaled width and height for.
25
+ * @param {number} imageWidth The image width.
26
+ * @param {number} imageHeight The image height.
27
+ *
28
+ * @return {Object} The scaled width and height.
29
+ */
30
+ function getScaledWidthAndHeight( scale, imageWidth, imageHeight ) {
31
+ const scaledWidth = Math.round( imageWidth * ( scale / 100 ) );
32
+ const scaledHeight = Math.round( imageHeight * ( scale / 100 ) );
33
+
34
+ return {
35
+ scaledWidth,
36
+ scaledHeight,
37
+ };
38
+ }
39
+
21
40
  export default function ImageSizeControl( {
22
41
  imageSizeHelp,
23
42
  imageWidth,
@@ -33,6 +52,40 @@ export default function ImageSizeControl( {
33
52
  const { currentHeight, currentWidth, updateDimension, updateDimensions } =
34
53
  useDimensionHandler( height, width, imageHeight, imageWidth, onChange );
35
54
 
55
+ /**
56
+ * Updates the dimensions for the given scale.
57
+ * Handler for toggle group control change.
58
+ *
59
+ * @param {number} scale The scale to update the dimensions for.
60
+ */
61
+ const handleUpdateDimensions = ( scale ) => {
62
+ if ( undefined === scale ) {
63
+ updateDimensions();
64
+ return;
65
+ }
66
+
67
+ const { scaledWidth, scaledHeight } = getScaledWidthAndHeight(
68
+ scale,
69
+ imageWidth,
70
+ imageHeight
71
+ );
72
+
73
+ updateDimensions( scaledHeight, scaledWidth );
74
+ };
75
+
76
+ /**
77
+ * Add the stored image preset value to toggle group control.
78
+ */
79
+ const selectedValue = IMAGE_SIZE_PRESETS.find( ( scale ) => {
80
+ const { scaledWidth, scaledHeight } = getScaledWidthAndHeight(
81
+ scale,
82
+ imageWidth,
83
+ imageHeight
84
+ );
85
+
86
+ return currentWidth === scaledWidth && currentHeight === scaledHeight;
87
+ } );
88
+
36
89
  return (
37
90
  <>
38
91
  { imageSizeOptions && imageSizeOptions.length > 0 && (
@@ -70,47 +123,25 @@ export default function ImageSizeControl( {
70
123
  size="__unstable-large"
71
124
  />
72
125
  </HStack>
73
- <HStack>
74
- <ButtonGroup aria-label={ __( 'Image size presets' ) }>
75
- { IMAGE_SIZE_PRESETS.map( ( scale ) => {
76
- const scaledWidth = Math.round(
77
- imageWidth * ( scale / 100 )
78
- );
79
- const scaledHeight = Math.round(
80
- imageHeight * ( scale / 100 )
81
- );
82
-
83
- const isCurrent =
84
- currentWidth === scaledWidth &&
85
- currentHeight === scaledHeight;
86
-
87
- return (
88
- <Button
89
- key={ scale }
90
- size="small"
91
- variant={
92
- isCurrent ? 'primary' : undefined
93
- }
94
- isPressed={ isCurrent }
95
- onClick={ () =>
96
- updateDimensions(
97
- scaledHeight,
98
- scaledWidth
99
- )
100
- }
101
- >
102
- { scale }%
103
- </Button>
104
- );
105
- } ) }
106
- </ButtonGroup>
107
- <Button
108
- size="small"
109
- onClick={ () => updateDimensions() }
110
- >
111
- { __( 'Reset' ) }
112
- </Button>
113
- </HStack>
126
+ <ToggleGroupControl
127
+ label={ __( 'Image size presets' ) }
128
+ hideLabelFromVision
129
+ onChange={ handleUpdateDimensions }
130
+ value={ selectedValue }
131
+ isBlock
132
+ __next40pxDefaultSize
133
+ __nextHasNoMarginBottom
134
+ >
135
+ { IMAGE_SIZE_PRESETS.map( ( scale ) => {
136
+ return (
137
+ <ToggleGroupControlOption
138
+ key={ scale }
139
+ value={ scale }
140
+ label={ `${ scale }%` }
141
+ />
142
+ );
143
+ } ) }
144
+ </ToggleGroupControl>
114
145
  </div>
115
146
  ) }
116
147
  </>
@@ -221,47 +221,8 @@ describe( 'ImageSizeControl', () => {
221
221
  } );
222
222
  } );
223
223
 
224
- describe( 'reset button', () => {
225
- it( 'resets both height and width to default values', async () => {
226
- const user = userEvent.setup();
227
-
228
- render(
229
- <ImageSizeControl
230
- imageHeight="100"
231
- imageWidth="200"
232
- height="300"
233
- width="400"
234
- onChange={ mockOnChange }
235
- />
236
- );
237
-
238
- const heightInput = screen.getByRole( 'spinbutton', {
239
- name: 'Height',
240
- } );
241
- const widthInput = screen.getByRole( 'spinbutton', {
242
- name: 'Width',
243
- } );
244
-
245
- // The initial dimension values display first.
246
- expect( heightInput ).toHaveValue( 300 );
247
- expect( widthInput ).toHaveValue( 400 );
248
-
249
- await user.click( screen.getByRole( 'button', { name: 'Reset' } ) );
250
-
251
- // Both attributes are set to undefined to clear custom values.
252
- expect( mockOnChange ).toHaveBeenLastCalledWith( {
253
- height: undefined,
254
- width: undefined,
255
- } );
256
-
257
- // The inputs display the default values once more.
258
- expect( heightInput ).toHaveValue( 100 );
259
- expect( widthInput ).toHaveValue( 200 );
260
- } );
261
- } );
262
-
263
224
  describe( 'image size percentage presets', () => {
264
- it( 'updates height and width attributes on selection', async () => {
225
+ it( 'updates height and width on selection', async () => {
265
226
  const user = userEvent.setup();
266
227
 
267
228
  render(
@@ -272,44 +233,25 @@ describe( 'ImageSizeControl', () => {
272
233
  />
273
234
  );
274
235
 
275
- const button = screen.getByRole( 'button', {
236
+ const button = screen.getByRole( 'radio', {
276
237
  name: '50%',
277
- pressed: false,
238
+ checked: false,
278
239
  } );
279
240
 
280
241
  await user.click( button );
281
242
 
282
- expect( button ).toHaveClass( 'is-pressed' );
243
+ expect( button ).toBeChecked();
283
244
 
284
245
  // Both attributes are set to the rounded scaled value.
285
246
  expect( mockOnChange ).toHaveBeenLastCalledWith( {
286
247
  height: 50,
287
248
  width: 101,
288
249
  } );
289
- } );
290
-
291
- it( 'updates height and width inputs on selection', async () => {
292
- const user = userEvent.setup();
293
-
294
- render(
295
- <ImageSizeControl
296
- imageHeight="100"
297
- imageWidth="201"
298
- onChange={ mockOnChange }
299
- />
300
- );
301
-
302
- const button = screen.getByRole( 'button', {
303
- name: '50%',
304
- pressed: false,
305
- } );
306
-
307
- await user.click( button );
308
250
 
309
- // Both attributes are set to the rounded scaled value.
310
251
  expect(
311
252
  screen.getByRole( 'spinbutton', { name: 'Height' } )
312
253
  ).toHaveValue( 50 );
254
+
313
255
  expect(
314
256
  screen.getByRole( 'spinbutton', { name: 'Width' } )
315
257
  ).toHaveValue( 101 );
@@ -195,17 +195,24 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
195
195
  ( select ) => {
196
196
  const {
197
197
  getBlockName,
198
- __unstableGetEditorMode,
198
+ isZoomOut,
199
199
  getTemplateLock,
200
200
  getBlockRootClientId,
201
201
  getBlockEditingMode,
202
202
  getBlockSettings,
203
203
  getSectionRootClientId,
204
204
  } = unlock( select( blockEditorStore ) );
205
- let _isDropZoneDisabled;
206
205
 
207
206
  if ( ! clientId ) {
208
- return { isDropZoneDisabled: _isDropZoneDisabled };
207
+ const sectionRootClientId = getSectionRootClientId();
208
+ // Disable the root drop zone when zoomed out and the section root client id
209
+ // is not the root block list (represented by an empty string).
210
+ // This avoids drag handling bugs caused by having two block lists acting as
211
+ // drop zones - the actual 'root' block list and the section root.
212
+ return {
213
+ isDropZoneDisabled:
214
+ isZoomOut() && sectionRootClientId !== '',
215
+ };
209
216
  }
210
217
 
211
218
  const { hasBlockSupport, getBlockType } = select( blocksStore );
@@ -214,14 +221,13 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
214
221
  const parentClientId = getBlockRootClientId( clientId );
215
222
  const [ defaultLayout ] = getBlockSettings( clientId, 'layout' );
216
223
 
217
- _isDropZoneDisabled = blockEditingMode === 'disabled';
224
+ let _isDropZoneDisabled = blockEditingMode === 'disabled';
218
225
 
219
- if ( __unstableGetEditorMode() === 'zoom-out' ) {
226
+ if ( isZoomOut() ) {
220
227
  // In zoom out mode, we want to disable the drop zone for the sections.
221
228
  // The inner blocks belonging to the section drop zone is
222
229
  // already disabled by the blocks themselves being disabled.
223
230
  const sectionRootClientId = getSectionRootClientId();
224
-
225
231
  _isDropZoneDisabled = clientId !== sectionRootClientId;
226
232
  }
227
233
 
@@ -85,10 +85,10 @@ function PatternList( {
85
85
  return true;
86
86
  }
87
87
  if ( selectedCategory === 'uncategorized' ) {
88
- const hasKnownCategory = pattern.categories.some(
89
- ( category ) =>
88
+ const hasKnownCategory =
89
+ pattern.categories?.some( ( category ) =>
90
90
  registeredPatternCategories.includes( category )
91
- );
91
+ ) ?? false;
92
92
 
93
93
  return ! pattern.categories?.length || ! hasKnownCategory;
94
94
  }
@@ -151,9 +151,6 @@ function PatternList( {
151
151
  { hasItems && (
152
152
  <>
153
153
  <BlockPatternsList
154
- shownPatterns={
155
- pagingProps.categoryPatternsAsyncList
156
- }
157
154
  blockPatterns={ pagingProps.categoryPatterns }
158
155
  onClickPattern={ onClickPattern }
159
156
  isDraggable={ false }
@@ -79,7 +79,6 @@ function BlockPatternsTab( {
79
79
  onInsert={ onInsert }
80
80
  rootClientId={ rootClientId }
81
81
  category={ category }
82
- showTitlesAsTooltip={ false }
83
82
  />
84
83
  </div>
85
84
  ) }
@@ -31,9 +31,11 @@ import {
31
31
  isPatternFiltered,
32
32
  allPatternsCategory,
33
33
  myPatternsCategory,
34
+ starterPatternsCategory,
34
35
  INSERTER_PATTERN_TYPES,
35
36
  } from './utils';
36
37
  import { store as blockEditorStore } from '../../../store';
38
+ import { unlock } from '../../../lock-unlock';
37
39
 
38
40
  const noop = () => {};
39
41
 
@@ -45,8 +47,7 @@ export function PatternCategoryPreviews( {
45
47
  showTitlesAsTooltip,
46
48
  } ) {
47
49
  const isZoomOutMode = useSelect(
48
- ( select ) =>
49
- select( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',
50
+ ( select ) => unlock( select( blockEditorStore ) ).isZoomOut(),
50
51
  []
51
52
  );
52
53
  const [ allPatterns, , onClickPattern ] = usePatternsState(
@@ -86,6 +87,13 @@ export function PatternCategoryPreviews( {
86
87
  return true;
87
88
  }
88
89
 
90
+ if (
91
+ category.name === starterPatternsCategory.name &&
92
+ pattern.blockTypes?.includes( 'core/post-content' )
93
+ ) {
94
+ return true;
95
+ }
96
+
89
97
  if ( category.name === 'uncategorized' ) {
90
98
  // The uncategorized category should show all the patterns without any category...
91
99
  if ( ! pattern.categories ) {
@@ -117,7 +125,6 @@ export function PatternCategoryPreviews( {
117
125
  const { changePage } = pagingProps;
118
126
 
119
127
  // Hide block pattern preview on unmount.
120
- // eslint-disable-next-line react-hooks/exhaustive-deps
121
128
  useEffect( () => () => onHover( null ), [] );
122
129
 
123
130
  const onSetPatternSyncFilter = useCallback(
@@ -183,7 +190,6 @@ export function PatternCategoryPreviews( {
183
190
  ) }
184
191
  <BlockPatternsList
185
192
  ref={ scrollContainerRef }
186
- shownPatterns={ pagingProps.categoryPatternsAsyncList }
187
193
  blockPatterns={ pagingProps.categoryPatterns }
188
194
  onClickPattern={ onClickPattern }
189
195
  onHover={ onHover }
@@ -158,7 +158,7 @@ export function PatternsFilter( {
158
158
  value={ patternSyncFilter }
159
159
  />
160
160
  </MenuGroup>
161
- <div className="block-editor-tool-selector__help">
161
+ <div className="block-editor-inserter__patterns-filter-help">
162
162
  { createInterpolateElement(
163
163
  __(
164
164
  'Patterns are available from the <Link>WordPress.org Pattern Directory</Link>, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced.'
@@ -14,6 +14,7 @@ import {
14
14
  isPatternFiltered,
15
15
  allPatternsCategory,
16
16
  myPatternsCategory,
17
+ starterPatternsCategory,
17
18
  INSERTER_PATTERN_TYPES,
18
19
  } from './utils';
19
20
 
@@ -67,6 +68,13 @@ export function usePatternCategories( rootClientId, sourceFilter = 'all' ) {
67
68
  label: _x( 'Uncategorized' ),
68
69
  } );
69
70
  }
71
+ if (
72
+ filteredPatterns.some( ( pattern ) =>
73
+ pattern.blockTypes?.includes( 'core/post-content' )
74
+ )
75
+ ) {
76
+ categories.unshift( starterPatternsCategory );
77
+ }
70
78
  if (
71
79
  filteredPatterns.some(
72
80
  ( pattern ) => pattern.type === INSERTER_PATTERN_TYPES.user
@@ -25,6 +25,11 @@ export const myPatternsCategory = {
25
25
  label: __( 'My patterns' ),
26
26
  };
27
27
 
28
+ export const starterPatternsCategory = {
29
+ name: 'core/starter-content',
30
+ label: __( 'Starter content' ),
31
+ };
32
+
28
33
  export function isPatternFiltered( pattern, sourceFilter, syncFilter ) {
29
34
  const isUserPattern = pattern.name.startsWith( 'core/block' );
30
35
  const isDirectoryPattern =
@@ -6,6 +6,7 @@ import {
6
6
  privateApis as componentsPrivateApis,
7
7
  __unstableMotion as motion,
8
8
  } from '@wordpress/components';
9
+ import { useState, useEffect } from '@wordpress/element';
9
10
 
10
11
  /**
11
12
  * Internal dependencies
@@ -31,11 +32,22 @@ function CategoryTabs( {
31
32
 
32
33
  const previousSelectedCategory = usePrevious( selectedCategory );
33
34
 
35
+ const selectedTabId = selectedCategory ? selectedCategory.name : null;
36
+ const [ activeTabId, setActiveId ] = useState();
37
+ const firstTabId = categories?.[ 0 ]?.name;
38
+ useEffect( () => {
39
+ // If there is no active tab, make the first tab the active tab, so that
40
+ // when focus is moved to the tablist, the first tab will be focused
41
+ // despite not being selected
42
+ if ( selectedTabId === null && ! activeTabId && firstTabId ) {
43
+ setActiveId( firstTabId );
44
+ }
45
+ }, [ selectedTabId, activeTabId, firstTabId, setActiveId ] );
46
+
34
47
  return (
35
48
  <Tabs
36
- className="block-editor-inserter__category-tabs"
37
49
  selectOnMove={ false }
38
- selectedTabId={ selectedCategory ? selectedCategory.name : null }
50
+ selectedTabId={ selectedTabId }
39
51
  orientation="vertical"
40
52
  onSelect={ ( categoryId ) => {
41
53
  // Pass the full category object
@@ -45,6 +57,8 @@ function CategoryTabs( {
45
57
  )
46
58
  );
47
59
  } }
60
+ activeTabId={ activeTabId }
61
+ onActiveTabIdChange={ setActiveId }
48
62
  >
49
63
  <Tabs.TabList className="block-editor-inserter__category-tablist">
50
64
  { categories.map( ( category ) => (