@wordpress/block-editor 13.2.0 → 13.3.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 (367) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +0 -1
  3. package/build/components/block-breadcrumb/index.js +12 -1
  4. package/build/components/block-breadcrumb/index.js.map +1 -1
  5. package/build/components/block-lock/toolbar.js +0 -1
  6. package/build/components/block-lock/toolbar.js.map +1 -1
  7. package/build/components/block-mover/button.js +1 -1
  8. package/build/components/block-mover/button.js.map +1 -1
  9. package/build/components/block-mover/index.js +1 -1
  10. package/build/components/block-mover/index.js.map +1 -1
  11. package/build/components/block-pattern-setup/setup-toolbar.js +2 -2
  12. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  13. package/build/components/block-patterns-paging/index.js +5 -7
  14. package/build/components/block-patterns-paging/index.js.map +1 -1
  15. package/build/components/block-quick-navigation/index.js +20 -17
  16. package/build/components/block-quick-navigation/index.js.map +1 -1
  17. package/build/components/block-rename/modal.js +4 -12
  18. package/build/components/block-rename/modal.js.map +1 -1
  19. package/build/components/block-toolbar/shuffle.js +1 -0
  20. package/build/components/block-toolbar/shuffle.js.map +1 -1
  21. package/build/components/block-tools/block-selection-button.js +7 -58
  22. package/build/components/block-tools/block-selection-button.js.map +1 -1
  23. package/build/components/block-tools/block-toolbar-breadcrumb.js +9 -2
  24. package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
  25. package/build/components/block-tools/index.js +14 -1
  26. package/build/components/block-tools/index.js.map +1 -1
  27. package/build/components/block-tools/use-show-block-tools.js +4 -2
  28. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  29. package/build/components/block-tools/zoom-out-mode-inserters.js +5 -4
  30. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  31. package/build/components/block-tools/zoom-out-popover.js +57 -0
  32. package/build/components/block-tools/zoom-out-popover.js.map +1 -0
  33. package/build/components/block-tools/zoom-out-toolbar.js +138 -0
  34. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -0
  35. package/build/components/button-block-appender/index.js +3 -1
  36. package/build/components/button-block-appender/index.js.map +1 -1
  37. package/build/components/child-layout-control/index.js +26 -18
  38. package/build/components/child-layout-control/index.js.map +1 -1
  39. package/build/components/date-format-picker/index.js +10 -1
  40. package/build/components/date-format-picker/index.js.map +1 -1
  41. package/build/components/dimensions-tool/index.js +6 -4
  42. package/build/components/dimensions-tool/index.js.map +1 -1
  43. package/build/components/font-appearance-control/index.js +26 -61
  44. package/build/components/font-appearance-control/index.js.map +1 -1
  45. package/build/components/global-styles/background-panel.js +178 -116
  46. package/build/components/global-styles/background-panel.js.map +1 -1
  47. package/build/components/global-styles/border-panel.js +2 -1
  48. package/build/components/global-styles/border-panel.js.map +1 -1
  49. package/build/components/global-styles/color-panel.js +2 -1
  50. package/build/components/global-styles/color-panel.js.map +1 -1
  51. package/build/components/global-styles/dimensions-panel.js +2 -1
  52. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  53. package/build/components/global-styles/filters-panel.js +2 -1
  54. package/build/components/global-styles/filters-panel.js.map +1 -1
  55. package/build/components/global-styles/hooks.js +8 -0
  56. package/build/components/global-styles/hooks.js.map +1 -1
  57. package/build/components/global-styles/image-settings-panel.js +2 -1
  58. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  59. package/build/components/global-styles/typography-panel.js +50 -12
  60. package/build/components/global-styles/typography-panel.js.map +1 -1
  61. package/build/components/global-styles/typography-utils.js +50 -0
  62. package/build/components/global-styles/typography-utils.js.map +1 -1
  63. package/build/components/global-styles/use-global-styles-output.js +23 -8
  64. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  65. package/build/components/global-styles/utils.js +17 -7
  66. package/build/components/global-styles/utils.js.map +1 -1
  67. package/build/components/grid/grid-item-movers.js +11 -14
  68. package/build/components/grid/grid-item-movers.js.map +1 -1
  69. package/build/components/grid/grid-item-resizer.js +2 -2
  70. package/build/components/grid/grid-item-resizer.js.map +1 -1
  71. package/build/components/grid/grid-visualizer.js +116 -36
  72. package/build/components/grid/grid-visualizer.js.map +1 -1
  73. package/build/components/grid/use-grid-layout-sync.js +29 -22
  74. package/build/components/grid/use-grid-layout-sync.js.map +1 -1
  75. package/build/components/inner-blocks/index.js +1 -1
  76. package/build/components/inner-blocks/index.js.map +1 -1
  77. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
  78. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  79. package/build/components/inserter/menu.js +26 -4
  80. package/build/components/inserter/menu.js.map +1 -1
  81. package/build/components/inserter/quick-inserter.js +2 -1
  82. package/build/components/inserter/quick-inserter.js.map +1 -1
  83. package/build/components/inspector-controls/block-support-tools-panel.js +2 -1
  84. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  85. package/build/components/link-control/link-preview.js +1 -1
  86. package/build/components/link-control/link-preview.js.map +1 -1
  87. package/build/components/media-placeholder/index.js +19 -23
  88. package/build/components/media-placeholder/index.js.map +1 -1
  89. package/build/components/navigable-toolbar/index.js +3 -1
  90. package/build/components/navigable-toolbar/index.js.map +1 -1
  91. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
  92. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  93. package/build/components/tabbed-sidebar/index.js +66 -0
  94. package/build/components/tabbed-sidebar/index.js.map +1 -0
  95. package/build/components/url-popover/index.js +3 -0
  96. package/build/components/url-popover/index.js.map +1 -1
  97. package/build/hooks/background.js +26 -4
  98. package/build/hooks/background.js.map +1 -1
  99. package/build/hooks/block-hooks.js +11 -17
  100. package/build/hooks/block-hooks.js.map +1 -1
  101. package/build/hooks/block-style-variation.js +169 -4
  102. package/build/hooks/block-style-variation.js.map +1 -1
  103. package/build/hooks/duotone.js +16 -11
  104. package/build/hooks/duotone.js.map +1 -1
  105. package/build/hooks/grid-visualizer.js +65 -0
  106. package/build/hooks/grid-visualizer.js.map +1 -0
  107. package/build/hooks/index.js +15 -2
  108. package/build/hooks/index.js.map +1 -1
  109. package/build/hooks/layout-child.js +39 -22
  110. package/build/hooks/layout-child.js.map +1 -1
  111. package/build/hooks/position.js +2 -9
  112. package/build/hooks/position.js.map +1 -1
  113. package/build/hooks/use-bindings-attributes.js +16 -6
  114. package/build/hooks/use-bindings-attributes.js.map +1 -1
  115. package/build/hooks/utils.js +2 -0
  116. package/build/hooks/utils.js.map +1 -1
  117. package/build/layouts/constrained.js +44 -2
  118. package/build/layouts/constrained.js.map +1 -1
  119. package/build/layouts/grid.js +90 -51
  120. package/build/layouts/grid.js.map +1 -1
  121. package/build/private-apis.js +6 -1
  122. package/build/private-apis.js.map +1 -1
  123. package/build/store/defaults.js +0 -2
  124. package/build/store/defaults.js.map +1 -1
  125. package/build/store/defaults.native.js +0 -3
  126. package/build/store/defaults.native.js.map +1 -1
  127. package/build/store/private-keys.js +2 -1
  128. package/build/store/private-keys.js.map +1 -1
  129. package/build/utils/format-font-style.js +45 -0
  130. package/build/utils/format-font-style.js.map +1 -0
  131. package/build/utils/format-font-weight.js +68 -0
  132. package/build/utils/format-font-weight.js.map +1 -0
  133. package/build/utils/get-editor-region.js +34 -0
  134. package/build/utils/get-editor-region.js.map +1 -0
  135. package/build/utils/get-font-styles-and-weights.js +167 -0
  136. package/build/utils/get-font-styles-and-weights.js.map +1 -0
  137. package/build/utils/pasting.js +5 -13
  138. package/build/utils/pasting.js.map +1 -1
  139. package/build-module/components/block-breadcrumb/index.js +12 -1
  140. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  141. package/build-module/components/block-lock/toolbar.js +0 -1
  142. package/build-module/components/block-lock/toolbar.js.map +1 -1
  143. package/build-module/components/block-mover/button.js +1 -1
  144. package/build-module/components/block-mover/button.js.map +1 -1
  145. package/build-module/components/block-mover/index.js +1 -1
  146. package/build-module/components/block-mover/index.js.map +1 -1
  147. package/build-module/components/block-pattern-setup/setup-toolbar.js +2 -2
  148. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  149. package/build-module/components/block-patterns-paging/index.js +5 -7
  150. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  151. package/build-module/components/block-quick-navigation/index.js +20 -17
  152. package/build-module/components/block-quick-navigation/index.js.map +1 -1
  153. package/build-module/components/block-rename/modal.js +5 -13
  154. package/build-module/components/block-rename/modal.js.map +1 -1
  155. package/build-module/components/block-toolbar/shuffle.js +1 -0
  156. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  157. package/build-module/components/block-tools/block-selection-button.js +10 -61
  158. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  159. package/build-module/components/block-tools/block-toolbar-breadcrumb.js +9 -2
  160. package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
  161. package/build-module/components/block-tools/index.js +14 -1
  162. package/build-module/components/block-tools/index.js.map +1 -1
  163. package/build-module/components/block-tools/use-show-block-tools.js +4 -2
  164. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  165. package/build-module/components/block-tools/zoom-out-mode-inserters.js +5 -4
  166. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  167. package/build-module/components/block-tools/zoom-out-popover.js +48 -0
  168. package/build-module/components/block-tools/zoom-out-popover.js.map +1 -0
  169. package/build-module/components/block-tools/zoom-out-toolbar.js +131 -0
  170. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -0
  171. package/build-module/components/button-block-appender/index.js +3 -1
  172. package/build-module/components/button-block-appender/index.js.map +1 -1
  173. package/build-module/components/child-layout-control/index.js +27 -19
  174. package/build-module/components/child-layout-control/index.js.map +1 -1
  175. package/build-module/components/date-format-picker/index.js +11 -3
  176. package/build-module/components/date-format-picker/index.js.map +1 -1
  177. package/build-module/components/dimensions-tool/index.js +6 -4
  178. package/build-module/components/dimensions-tool/index.js.map +1 -1
  179. package/build-module/components/font-appearance-control/index.js +28 -63
  180. package/build-module/components/font-appearance-control/index.js.map +1 -1
  181. package/build-module/components/global-styles/background-panel.js +181 -119
  182. package/build-module/components/global-styles/background-panel.js.map +1 -1
  183. package/build-module/components/global-styles/border-panel.js +3 -2
  184. package/build-module/components/global-styles/border-panel.js.map +1 -1
  185. package/build-module/components/global-styles/color-panel.js +3 -2
  186. package/build-module/components/global-styles/color-panel.js.map +1 -1
  187. package/build-module/components/global-styles/dimensions-panel.js +3 -2
  188. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  189. package/build-module/components/global-styles/filters-panel.js +3 -2
  190. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  191. package/build-module/components/global-styles/hooks.js +8 -0
  192. package/build-module/components/global-styles/hooks.js.map +1 -1
  193. package/build-module/components/global-styles/image-settings-panel.js +3 -2
  194. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  195. package/build-module/components/global-styles/typography-panel.js +52 -14
  196. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  197. package/build-module/components/global-styles/typography-utils.js +48 -0
  198. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  199. package/build-module/components/global-styles/use-global-styles-output.js +23 -8
  200. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  201. package/build-module/components/global-styles/utils.js +15 -6
  202. package/build-module/components/global-styles/utils.js.map +1 -1
  203. package/build-module/components/grid/grid-item-movers.js +11 -14
  204. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  205. package/build-module/components/grid/grid-item-resizer.js +2 -2
  206. package/build-module/components/grid/grid-item-resizer.js.map +1 -1
  207. package/build-module/components/grid/grid-visualizer.js +117 -37
  208. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  209. package/build-module/components/grid/use-grid-layout-sync.js +29 -22
  210. package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
  211. package/build-module/components/inner-blocks/index.js +1 -1
  212. package/build-module/components/inner-blocks/index.js.map +1 -1
  213. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
  214. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  215. package/build-module/components/inserter/menu.js +26 -4
  216. package/build-module/components/inserter/menu.js.map +1 -1
  217. package/build-module/components/inserter/quick-inserter.js +2 -1
  218. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  219. package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -2
  220. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  221. package/build-module/components/link-control/link-preview.js +1 -1
  222. package/build-module/components/link-control/link-preview.js.map +1 -1
  223. package/build-module/components/media-placeholder/index.js +19 -23
  224. package/build-module/components/media-placeholder/index.js.map +1 -1
  225. package/build-module/components/navigable-toolbar/index.js +3 -1
  226. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  227. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
  228. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  229. package/build-module/components/tabbed-sidebar/index.js +60 -0
  230. package/build-module/components/tabbed-sidebar/index.js.map +1 -0
  231. package/build-module/components/url-popover/index.js +3 -0
  232. package/build-module/components/url-popover/index.js.map +1 -1
  233. package/build-module/hooks/background.js +26 -4
  234. package/build-module/hooks/background.js.map +1 -1
  235. package/build-module/hooks/block-hooks.js +11 -17
  236. package/build-module/hooks/block-hooks.js.map +1 -1
  237. package/build-module/hooks/block-style-variation.js +168 -4
  238. package/build-module/hooks/block-style-variation.js.map +1 -1
  239. package/build-module/hooks/duotone.js +16 -11
  240. package/build-module/hooks/duotone.js.map +1 -1
  241. package/build-module/hooks/grid-visualizer.js +64 -0
  242. package/build-module/hooks/grid-visualizer.js.map +1 -0
  243. package/build-module/hooks/index.js +3 -0
  244. package/build-module/hooks/index.js.map +1 -1
  245. package/build-module/hooks/layout-child.js +39 -22
  246. package/build-module/hooks/layout-child.js.map +1 -1
  247. package/build-module/hooks/position.js +2 -9
  248. package/build-module/hooks/position.js.map +1 -1
  249. package/build-module/hooks/use-bindings-attributes.js +16 -6
  250. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  251. package/build-module/hooks/utils.js +2 -0
  252. package/build-module/hooks/utils.js.map +1 -1
  253. package/build-module/layouts/constrained.js +44 -2
  254. package/build-module/layouts/constrained.js.map +1 -1
  255. package/build-module/layouts/grid.js +90 -51
  256. package/build-module/layouts/grid.js.map +1 -1
  257. package/build-module/private-apis.js +8 -3
  258. package/build-module/private-apis.js.map +1 -1
  259. package/build-module/store/defaults.js +0 -2
  260. package/build-module/store/defaults.js.map +1 -1
  261. package/build-module/store/defaults.native.js +0 -3
  262. package/build-module/store/defaults.native.js.map +1 -1
  263. package/build-module/store/private-keys.js +1 -0
  264. package/build-module/store/private-keys.js.map +1 -1
  265. package/build-module/utils/format-font-style.js +39 -0
  266. package/build-module/utils/format-font-style.js.map +1 -0
  267. package/build-module/utils/format-font-weight.js +62 -0
  268. package/build-module/utils/format-font-weight.js.map +1 -0
  269. package/build-module/utils/get-editor-region.js +28 -0
  270. package/build-module/utils/get-editor-region.js.map +1 -0
  271. package/build-module/utils/get-font-styles-and-weights.js +160 -0
  272. package/build-module/utils/get-font-styles-and-weights.js.map +1 -0
  273. package/build-module/utils/pasting.js +5 -13
  274. package/build-module/utils/pasting.js.map +1 -1
  275. package/build-style/content-rtl.css +1 -0
  276. package/build-style/content.css +1 -0
  277. package/build-style/style-rtl.css +207 -96
  278. package/build-style/style.css +207 -96
  279. package/package.json +32 -32
  280. package/src/components/block-breadcrumb/index.js +16 -1
  281. package/src/components/block-lock/toolbar.js +0 -1
  282. package/src/components/block-mover/button.js +1 -1
  283. package/src/components/block-mover/index.js +1 -1
  284. package/src/components/block-pattern-setup/setup-toolbar.js +2 -2
  285. package/src/components/block-patterns-paging/index.js +8 -11
  286. package/src/components/block-patterns-paging/style.scss +18 -0
  287. package/src/components/block-quick-navigation/index.js +21 -28
  288. package/src/components/block-rename/modal.js +2 -8
  289. package/src/components/block-switcher/test/index.js +6 -6
  290. package/src/components/block-toolbar/shuffle.js +1 -0
  291. package/src/components/block-toolbar/style.scss +1 -11
  292. package/src/components/block-tools/block-selection-button.js +11 -83
  293. package/src/components/block-tools/block-toolbar-breadcrumb.js +9 -4
  294. package/src/components/block-tools/index.js +21 -1
  295. package/src/components/block-tools/style.scss +15 -0
  296. package/src/components/block-tools/use-show-block-tools.js +14 -6
  297. package/src/components/block-tools/zoom-out-mode-inserters.js +5 -4
  298. package/src/components/block-tools/zoom-out-popover.js +49 -0
  299. package/src/components/block-tools/zoom-out-toolbar.js +140 -0
  300. package/src/components/button-block-appender/index.js +2 -1
  301. package/src/components/child-layout-control/index.js +41 -23
  302. package/src/components/date-format-picker/index.js +10 -1
  303. package/src/components/date-format-picker/style.scss +0 -9
  304. package/src/components/dimensions-tool/index.js +97 -89
  305. package/src/components/font-appearance-control/index.js +29 -83
  306. package/src/components/font-appearance-control/style.scss +3 -5
  307. package/src/components/global-styles/background-panel.js +249 -170
  308. package/src/components/global-styles/border-panel.js +3 -2
  309. package/src/components/global-styles/color-panel.js +3 -2
  310. package/src/components/global-styles/dimensions-panel.js +3 -2
  311. package/src/components/global-styles/filters-panel.js +3 -2
  312. package/src/components/global-styles/hooks.js +9 -0
  313. package/src/components/global-styles/image-settings-panel.js +3 -2
  314. package/src/components/global-styles/style.scss +105 -20
  315. package/src/components/global-styles/test/typography-utils.js +269 -0
  316. package/src/components/global-styles/typography-panel.js +49 -12
  317. package/src/components/global-styles/typography-utils.js +63 -0
  318. package/src/components/global-styles/use-global-styles-output.js +23 -8
  319. package/src/components/global-styles/utils.js +17 -6
  320. package/src/components/grid/grid-item-movers.js +11 -27
  321. package/src/components/grid/grid-item-resizer.js +3 -2
  322. package/src/components/grid/grid-visualizer.js +171 -54
  323. package/src/components/grid/style.scss +43 -8
  324. package/src/components/grid/use-grid-layout-sync.js +31 -28
  325. package/src/components/iframe/content.scss +1 -0
  326. package/src/components/inner-blocks/index.js +2 -1
  327. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -16
  328. package/src/components/inserter/menu.js +47 -13
  329. package/src/components/inserter/quick-inserter.js +6 -1
  330. package/src/components/inserter/style.scss +1 -49
  331. package/src/components/inspector-controls/block-support-tools-panel.js +3 -3
  332. package/src/components/link-control/link-preview.js +1 -1
  333. package/src/components/media-placeholder/index.js +22 -32
  334. package/src/components/navigable-toolbar/index.js +3 -1
  335. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +6 -1
  336. package/src/components/tabbed-sidebar/README.md +76 -0
  337. package/src/components/tabbed-sidebar/index.js +70 -0
  338. package/src/components/tabbed-sidebar/style.scss +53 -0
  339. package/src/components/url-popover/index.js +3 -0
  340. package/src/hooks/background.js +25 -10
  341. package/src/hooks/block-hooks.js +9 -16
  342. package/src/hooks/block-style-variation.js +202 -3
  343. package/src/hooks/duotone.js +16 -12
  344. package/src/hooks/grid-visualizer.js +64 -0
  345. package/src/hooks/index.js +3 -0
  346. package/src/hooks/layout-child.js +53 -37
  347. package/src/hooks/position.js +3 -10
  348. package/src/hooks/test/get-variation-styles-with-ref-values.js +91 -0
  349. package/src/hooks/use-bindings-attributes.js +18 -4
  350. package/src/hooks/utils.js +2 -0
  351. package/src/layouts/constrained.js +43 -2
  352. package/src/layouts/grid.js +146 -51
  353. package/src/private-apis.js +12 -1
  354. package/src/store/defaults.js +0 -2
  355. package/src/store/defaults.native.js +0 -3
  356. package/src/store/private-keys.js +1 -0
  357. package/src/style.scss +1 -1
  358. package/src/utils/format-font-style.js +40 -0
  359. package/src/utils/format-font-weight.js +63 -0
  360. package/src/utils/get-editor-region.js +31 -0
  361. package/src/utils/get-font-styles-and-weights.js +191 -0
  362. package/src/utils/pasting.js +5 -12
  363. package/src/utils/test/format-font-style.js +34 -0
  364. package/src/utils/test/format-font-weight.js +66 -0
  365. package/src/utils/test/get-font-styles-and-weights.js +513 -0
  366. package/tsconfig.tsbuildinfo +1 -1
  367. package/src/hooks/position.scss +0 -18
@@ -30,12 +30,10 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
30
30
  useEffect( () => {
31
31
  const updates = {};
32
32
 
33
- const { columnCount, rowCount = 2 } = gridLayout;
34
- const isManualGrid = !! columnCount;
33
+ const { columnCount, rowCount, isManualPlacement } = gridLayout;
35
34
 
36
- if ( isManualGrid ) {
35
+ if ( isManualPlacement ) {
37
36
  const rects = [];
38
- let cellsTaken = 0;
39
37
 
40
38
  // Respect the position of blocks that already have a columnStart and rowStart value.
41
39
  for ( const clientId of blockOrder ) {
@@ -46,7 +44,6 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
46
44
  columnSpan = 1,
47
45
  rowSpan = 1,
48
46
  } = attributes.style?.layout || {};
49
- cellsTaken += columnSpan * rowSpan;
50
47
  if ( ! columnStart || ! rowStart ) {
51
48
  continue;
52
49
  }
@@ -60,29 +57,21 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
60
57
  );
61
58
  }
62
59
 
63
- // Ensure there's enough rows to fit all blocks.
64
- const minimumNeededRows = Math.ceil( cellsTaken / columnCount );
65
- if ( rowCount < minimumNeededRows ) {
66
- updates[ gridClientId ] = {
67
- layout: {
68
- ...gridLayout,
69
- rowCount: minimumNeededRows,
70
- },
71
- };
72
- }
73
-
74
60
  // When in manual mode, ensure that every block has a columnStart and rowStart value.
75
61
  for ( const clientId of blockOrder ) {
76
62
  const attributes = getBlockAttributes( clientId );
77
- const { columnStart, rowStart, columnSpan, rowSpan } =
78
- attributes.style?.layout || {};
63
+ const {
64
+ columnStart,
65
+ rowStart,
66
+ columnSpan = 1,
67
+ rowSpan = 1,
68
+ } = attributes.style?.layout || {};
79
69
  if ( columnStart && rowStart ) {
80
70
  continue;
81
71
  }
82
72
  const [ newColumnStart, newRowStart ] = getFirstEmptyCell(
83
73
  rects,
84
74
  columnCount,
85
- minimumNeededRows,
86
75
  columnSpan,
87
76
  rowSpan
88
77
  );
@@ -105,6 +94,17 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
105
94
  },
106
95
  };
107
96
  }
97
+
98
+ // Ensure there's enough rows to fit all blocks.
99
+ const bottomMostRow = Math.max( ...rects.map( ( r ) => r.rowEnd ) );
100
+ if ( ! rowCount || rowCount < bottomMostRow ) {
101
+ updates[ gridClientId ] = {
102
+ layout: {
103
+ ...gridLayout,
104
+ rowCount: bottomMostRow,
105
+ },
106
+ };
107
+ }
108
108
  } else {
109
109
  // When in auto mode, remove all of the columnStart and rowStart values.
110
110
  for ( const clientId of blockOrder ) {
@@ -121,6 +121,16 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
121
121
  };
122
122
  }
123
123
  }
124
+
125
+ // Remove row styles in auto mode
126
+ if ( rowCount ) {
127
+ updates[ gridClientId ] = {
128
+ layout: {
129
+ ...gridLayout,
130
+ rowCount: undefined,
131
+ },
132
+ };
133
+ }
124
134
  }
125
135
 
126
136
  if ( Object.keys( updates ).length ) {
@@ -143,14 +153,8 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
143
153
  ] );
144
154
  }
145
155
 
146
- function getFirstEmptyCell(
147
- rects,
148
- columnCount,
149
- rowCount,
150
- columnSpan = 1,
151
- rowSpan = 1
152
- ) {
153
- for ( let row = 1; row <= rowCount; row++ ) {
156
+ function getFirstEmptyCell( rects, columnCount, columnSpan = 1, rowSpan = 1 ) {
157
+ for ( let row = 1; ; row++ ) {
154
158
  for ( let column = 1; column <= columnCount; column++ ) {
155
159
  const rect = new GridRect( {
156
160
  columnStart: column,
@@ -163,5 +167,4 @@ function getFirstEmptyCell(
163
167
  }
164
168
  }
165
169
  }
166
- return [ 1, 1 ];
167
170
  }
@@ -11,6 +11,7 @@
11
11
  .block-editor-iframe__scale-container {
12
12
  width: 100%;
13
13
  height: 100%;
14
+ display: flex;
14
15
  }
15
16
 
16
17
  .block-editor-iframe__scale-container.is-zoomed-out {
@@ -269,7 +269,8 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
269
269
  props.ref,
270
270
  __unstableDisableDropZone ||
271
271
  isDropZoneDisabled ||
272
- ( layout?.columnCount && window.__experimentalEnableGridInteractivity )
272
+ ( layout?.isManualPlacement &&
273
+ window.__experimentalEnableGridInteractivity )
273
274
  ? null
274
275
  : blockDropZoneRef,
275
276
  ] );
@@ -2,9 +2,8 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import { PatternCategoryPreviews } from './pattern-category-previews';
5
- import { useZoomOut } from '../../../hooks/use-zoom-out';
6
5
 
7
- function PatternCategoryPreviewPanelInner( {
6
+ export function PatternCategoryPreviewPanel( {
8
7
  rootClientId,
9
8
  onInsert,
10
9
  onHover,
@@ -24,17 +23,3 @@ function PatternCategoryPreviewPanelInner( {
24
23
  />
25
24
  );
26
25
  }
27
-
28
- function PatternCategoryPreviewPanelWithZoomOut( props ) {
29
- useZoomOut();
30
- return <PatternCategoryPreviewPanelInner { ...props } />;
31
- }
32
-
33
- export function PatternCategoryPreviewPanel( props ) {
34
- // When the pattern panel is showing, we want to use zoom out mode
35
- if ( window.__experimentalEnableZoomedOutPatternsTab ) {
36
- return <PatternCategoryPreviewPanelWithZoomOut { ...props } />;
37
- }
38
-
39
- return <PatternCategoryPreviewPanelInner { ...props } />;
40
- }
@@ -30,8 +30,9 @@ import { PatternCategoryPreviewPanel } from './block-patterns-tab/pattern-catego
30
30
  import { MediaTab, MediaCategoryPanel } from './media-tab';
31
31
  import InserterSearchResults from './search-results';
32
32
  import useInsertionPoint from './hooks/use-insertion-point';
33
- import InserterTabs from './tabs';
34
33
  import { store as blockEditorStore } from '../../store';
34
+ import TabbedSidebar from '../tabbed-sidebar';
35
+ import { useZoomOut } from '../../hooks/use-zoom-out';
35
36
 
36
37
  const NOOP = () => {};
37
38
  function InserterMenu(
@@ -88,7 +89,7 @@ function InserterMenu(
88
89
  shouldForceFocusBlock,
89
90
  _rootClientId
90
91
  );
91
- onSelect();
92
+ onSelect( blocks );
92
93
 
93
94
  // Check for focus loss due to filtering blocks by selected block type
94
95
  window.requestAnimationFrame( () => {
@@ -145,6 +146,11 @@ function InserterMenu(
145
146
 
146
147
  const showMediaPanel = selectedTab === 'media' && !! selectedMediaCategory;
147
148
 
149
+ const showZoomOut =
150
+ showPatternPanel && window.__experimentalEnableZoomedOutPatternsTab;
151
+
152
+ useZoomOut( showZoomOut );
153
+
148
154
  const inserterSearch = useMemo( () => {
149
155
  if ( selectedTab === 'media' ) {
150
156
  return null;
@@ -315,21 +321,49 @@ function InserterMenu(
315
321
  ref={ ref }
316
322
  >
317
323
  <div className="block-editor-inserter__main-area">
318
- <InserterTabs
324
+ <TabbedSidebar
319
325
  ref={ tabsRef }
320
326
  onSelect={ handleSetSelectedTab }
321
327
  onClose={ onClose }
322
328
  selectedTab={ selectedTab }
323
- >
324
- { inserterSearch }
325
- { selectedTab === 'blocks' &&
326
- ! delayedFilterValue &&
327
- blocksTab }
328
- { selectedTab === 'patterns' &&
329
- ! delayedFilterValue &&
330
- patternsTab }
331
- { selectedTab === 'media' && mediaTab }
332
- </InserterTabs>
329
+ closeButtonLabel={ __( 'Close block inserter' ) }
330
+ tabs={ [
331
+ {
332
+ name: 'blocks',
333
+ title: __( 'Blocks' ),
334
+ panel: (
335
+ <>
336
+ { inserterSearch }
337
+ { selectedTab === 'blocks' &&
338
+ ! delayedFilterValue &&
339
+ blocksTab }
340
+ </>
341
+ ),
342
+ },
343
+ {
344
+ name: 'patterns',
345
+ title: __( 'Patterns' ),
346
+ panel: (
347
+ <>
348
+ { inserterSearch }
349
+ { selectedTab === 'patterns' &&
350
+ ! delayedFilterValue &&
351
+ patternsTab }
352
+ </>
353
+ ),
354
+ },
355
+ {
356
+ name: 'media',
357
+ title: __( 'Media' ),
358
+ panel: (
359
+ <>
360
+ { inserterSearch }
361
+ { mediaTab }
362
+ </>
363
+ ),
364
+ },
365
+ ] }
366
+ />
333
367
  </div>
334
368
  { showInserterHelpPanel && hoveredItem && (
335
369
  <Popover
@@ -85,7 +85,12 @@ export default function QuickInserter( {
85
85
  // When clicking Browse All select the appropriate block so as
86
86
  // the insertion point can work as expected.
87
87
  const onBrowseAll = () => {
88
- setInserterIsOpened( { rootClientId, insertionIndex, filterValue } );
88
+ setInserterIsOpened( {
89
+ rootClientId,
90
+ insertionIndex,
91
+ filterValue,
92
+ onSelect,
93
+ } );
89
94
  };
90
95
 
91
96
  let maxBlockPatterns = 0;
@@ -17,19 +17,13 @@ $block-inserter-tabs-height: 44px;
17
17
  }
18
18
 
19
19
  .block-editor-inserter__main-area {
20
- position: relative;
21
- display: flex;
22
- flex-direction: column;
23
20
  height: 100%;
24
21
  gap: $grid-unit-20;
22
+ position: relative;
25
23
 
26
24
  &.show-as-tabs {
27
25
  gap: 0;
28
26
  }
29
-
30
- @include break-medium {
31
- width: $block-inserter-width;
32
- }
33
27
  }
34
28
 
35
29
  .block-editor-inserter__popover.is-quick {
@@ -109,48 +103,6 @@ $block-inserter-tabs-height: 44px;
109
103
  padding: $grid-unit-20 $grid-unit-20 0 $grid-unit-20;
110
104
  }
111
105
 
112
- .block-editor-inserter__tabs {
113
- flex-grow: 1;
114
- display: flex;
115
- flex-direction: column;
116
- overflow: hidden;
117
-
118
- .block-editor-inserter__tablist-and-close-button {
119
- border-bottom: $border-width solid $gray-300;
120
- padding-right: $grid-unit-15;
121
- display: flex;
122
- justify-content: space-between;
123
- }
124
-
125
- .block-editor-inserter__close-button {
126
- /* stylelint-disable-next-line property-disallowed-list -- This should be refactored to avoid order if possible */
127
- order: 1;
128
- align-self: center;
129
- }
130
-
131
- .block-editor-inserter__tablist {
132
- width: 100%;
133
- margin-bottom: -$border-width;
134
-
135
- button[role="tab"] {
136
- flex-grow: 1;
137
- &[id$="reusable"] {
138
- flex-grow: inherit;
139
- // These are to align the `reusable` icon with the search icon.
140
- padding-left: $grid-unit-20;
141
- padding-right: $grid-unit-20;
142
- }
143
- }
144
- }
145
-
146
- .block-editor-inserter__tabpanel {
147
- display: flex;
148
- flex-grow: 1;
149
- flex-direction: column;
150
- overflow-y: auto;
151
- }
152
- }
153
-
154
106
  .block-editor-inserter__no-tab-container {
155
107
  overflow-y: auto;
156
108
  flex-grow: 1;
@@ -10,7 +10,7 @@ import { useCallback } from '@wordpress/element';
10
10
  */
11
11
  import { store as blockEditorStore } from '../../store';
12
12
  import { cleanEmptyObject } from '../../hooks/utils';
13
- import { TOOLSPANEL_DROPDOWNMENU_PROPS } from '../global-styles/utils';
13
+ import { useToolsPanelDropdownMenuProps } from '../global-styles/utils';
14
14
 
15
15
  export default function BlockSupportToolsPanel( { children, group, label } ) {
16
16
  const { updateBlockAttributes } = useDispatch( blockEditorStore );
@@ -20,7 +20,7 @@ export default function BlockSupportToolsPanel( { children, group, label } ) {
20
20
  getSelectedBlockClientId,
21
21
  hasMultiSelection,
22
22
  } = useSelect( blockEditorStore );
23
-
23
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
24
24
  const panelId = getSelectedBlockClientId();
25
25
  const resetAll = useCallback(
26
26
  ( resetFilters = [] ) => {
@@ -72,7 +72,7 @@ export default function BlockSupportToolsPanel( { children, group, label } ) {
72
72
  shouldRenderPlaceholderItems // Required to maintain fills ordering.
73
73
  __experimentalFirstVisibleItemClass="first"
74
74
  __experimentalLastVisibleItemClass="last"
75
- dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
75
+ dropdownMenuProps={ dropdownMenuProps }
76
76
  >
77
77
  { children }
78
78
  </ToolsPanel>
@@ -166,7 +166,7 @@ export default function LinkPreview( {
166
166
  isEmptyURL || showIconLabels ? '' : ': ' + value.url
167
167
  ) }
168
168
  ref={ ref }
169
- __experimentalIsFocusable
169
+ accessibleWhenDisabled
170
170
  disabled={ isEmptyURL }
171
171
  size="compact"
172
172
  />
@@ -60,28 +60,37 @@ const InsertFromURLPopover = ( {
60
60
  </URLPopover>
61
61
  );
62
62
 
63
- const URLSelectionUI = ( {
64
- isURLInputVisible,
65
- src,
66
- onChangeSrc,
67
- onSubmitSrc,
68
- openURLInput,
69
- closeURLInput,
70
- } ) => {
63
+ const URLSelectionUI = ( { src, onChangeSrc, onSelectURL } ) => {
71
64
  // Use internal state instead of a ref to make sure that the component
72
65
  // re-renders when the popover's anchor updates.
73
66
  const [ popoverAnchor, setPopoverAnchor ] = useState( null );
67
+ const [ isURLInputVisible, setIsURLInputVisible ] = useState( false );
68
+
69
+ const openURLInput = () => {
70
+ setIsURLInputVisible( true );
71
+ };
72
+ const closeURLInput = () => {
73
+ setIsURLInputVisible( false );
74
+ popoverAnchor?.focus();
75
+ };
76
+
77
+ const onSubmitSrc = ( event ) => {
78
+ event.preventDefault();
79
+ if ( src && onSelectURL ) {
80
+ onSelectURL( src );
81
+ closeURLInput();
82
+ }
83
+ };
74
84
 
75
85
  return (
76
- <div
77
- className="block-editor-media-placeholder__url-input-container"
78
- ref={ setPopoverAnchor }
79
- >
86
+ <div className="block-editor-media-placeholder__url-input-container">
80
87
  <Button
81
88
  className="block-editor-media-placeholder__button"
82
89
  onClick={ openURLInput }
83
90
  isPressed={ isURLInputVisible }
84
91
  variant="secondary"
92
+ aria-haspopup="dialog"
93
+ ref={ setPopoverAnchor }
85
94
  >
86
95
  { __( 'Insert from URL' ) }
87
96
  </Button>
@@ -138,7 +147,6 @@ export function MediaPlaceholder( {
138
147
  return getSettings().mediaUpload;
139
148
  }, [] );
140
149
  const [ src, setSrc ] = useState( '' );
141
- const [ isURLInputVisible, setIsURLInputVisible ] = useState( false );
142
150
 
143
151
  useEffect( () => {
144
152
  setSrc( value?.src ?? '' );
@@ -159,21 +167,6 @@ export function MediaPlaceholder( {
159
167
  setSrc( event.target.value );
160
168
  };
161
169
 
162
- const openURLInput = () => {
163
- setIsURLInputVisible( true );
164
- };
165
- const closeURLInput = () => {
166
- setIsURLInputVisible( false );
167
- };
168
-
169
- const onSubmitSrc = ( event ) => {
170
- event.preventDefault();
171
- if ( src && onSelectURL ) {
172
- onSelectURL( src );
173
- closeURLInput();
174
- }
175
- };
176
-
177
170
  const onFilesUpload = ( files ) => {
178
171
  if ( ! handleUpload ) {
179
172
  return onSelect( files );
@@ -404,12 +397,9 @@ export function MediaPlaceholder( {
404
397
  return (
405
398
  onSelectURL && (
406
399
  <URLSelectionUI
407
- isURLInputVisible={ isURLInputVisible }
408
400
  src={ src }
409
401
  onChangeSrc={ onChangeSrc }
410
- onSubmitSrc={ onSubmitSrc }
411
- openURLInput={ openURLInput }
412
- closeURLInput={ closeURLInput }
402
+ onSelectURL={ onSelectURL }
413
403
  />
414
404
  )
415
405
  );
@@ -210,6 +210,7 @@ export default function NavigableToolbar( {
210
210
  shouldUseKeyboardFocusShortcut = true,
211
211
  __experimentalInitialIndex: initialIndex,
212
212
  __experimentalOnIndexChange: onIndexChange,
213
+ orientation = 'horizontal',
213
214
  ...props
214
215
  } ) {
215
216
  const toolbarRef = useRef();
@@ -230,6 +231,7 @@ export default function NavigableToolbar( {
230
231
  <Toolbar
231
232
  label={ props[ 'aria-label' ] }
232
233
  ref={ toolbarRef }
234
+ orientation={ orientation }
233
235
  { ...props }
234
236
  >
235
237
  { children }
@@ -239,7 +241,7 @@ export default function NavigableToolbar( {
239
241
 
240
242
  return (
241
243
  <NavigableMenu
242
- orientation="horizontal"
244
+ orientation={ orientation }
243
245
  role="toolbar"
244
246
  ref={ toolbarRef }
245
247
  { ...props }
@@ -3,13 +3,13 @@
3
3
  */
4
4
  import {
5
5
  Button,
6
- CustomSelectControl,
7
6
  Icon,
8
7
  RangeControl,
9
8
  __experimentalHStack as HStack,
10
9
  __experimentalUnitControl as UnitControl,
11
10
  __experimentalUseCustomUnits as useCustomUnits,
12
11
  __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
12
+ privateApis as componentsPrivateApis,
13
13
  } from '@wordpress/components';
14
14
  import { useSelect } from '@wordpress/data';
15
15
  import { useState, useMemo } from '@wordpress/element';
@@ -31,6 +31,11 @@ import {
31
31
  getPresetValueFromCustomValue,
32
32
  isValueSpacingPreset,
33
33
  } from '../utils';
34
+ import { unlock } from '../../../lock-unlock';
35
+
36
+ const { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(
37
+ componentsPrivateApis
38
+ );
34
39
 
35
40
  const CUSTOM_VALUE_SETTINGS = {
36
41
  px: { max: 300, steps: 1 },
@@ -0,0 +1,76 @@
1
+ # Tabbed Panel
2
+
3
+ The `TabbedPanel` component is used to create the secondary panels in the editor.
4
+
5
+ ## Development guidelines
6
+
7
+ This acts as a wrapper for the `Tabs` component, but adding conventions that can be shared between all secondary panels, for example:
8
+
9
+ - A close button
10
+ - Tabs that fill the panel
11
+ - Custom scollbars
12
+
13
+ ### Usage
14
+
15
+ Renders a block alignment toolbar with alignments options.
16
+
17
+ ```jsx
18
+ import { TabbedSidebar } from '@wordpress/components';
19
+
20
+ const MyTabbedSidebar = () => (
21
+ <TabbedSidebar
22
+ tabs={ [
23
+ {
24
+ name: 'slug-1',
25
+ title: _x( 'Title 1', 'context' ),
26
+ panel: <PanelContents>,
27
+ panelRef: useRef('an-optional-ref'),
28
+ },
29
+ {
30
+ name: 'slug-2',
31
+ title: _x( 'Title 2', 'context' ),
32
+ panel: <PanelContents />,
33
+ },
34
+ ] }
35
+ onClose={ onClickCloseButton }
36
+ onSelect={ onSelectTab }
37
+ defaultTabId="slug-1"
38
+ ref={ tabsRef }
39
+ />
40
+ );
41
+ ```
42
+
43
+ ### Props
44
+
45
+ ### `defaultTabId`
46
+
47
+ - **Type:** `String`
48
+ - **Default:** `undefined`
49
+
50
+ This is passed to the `Tabs` component so it can handle the tab to select by default when it component renders.
51
+
52
+ ### `onClose`
53
+
54
+ - **Type:** `Function`
55
+
56
+ The function that is called when the close button is clicked.
57
+
58
+ ### `onSelect`
59
+
60
+ - **Type:** `Function`
61
+
62
+ This is passed to the `Tabs` component - it will be called when a tab has been selected. It is passed the selected tab's ID as an argument.
63
+
64
+ ### `selectedTab`
65
+
66
+ - **Type:** `String`
67
+ - **Default:** `undefined`
68
+
69
+ This is passed to the `Tabs` component - it will display this tab as selected.
70
+
71
+ ### `tabs`
72
+
73
+ - **Type:** `Array`
74
+ - **Default:** `undefined`
75
+
76
+ An array of tabs which will be rendered as `TabList` and `TabPanel` components.
@@ -0,0 +1,70 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ Button,
6
+ privateApis as componentsPrivateApis,
7
+ } from '@wordpress/components';
8
+ import { forwardRef } from '@wordpress/element';
9
+ import { closeSmall } from '@wordpress/icons';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import { unlock } from '../../lock-unlock';
15
+
16
+ const { Tabs } = unlock( componentsPrivateApis );
17
+
18
+ function TabbedSidebar(
19
+ { defaultTabId, onClose, onSelect, selectedTab, tabs, closeButtonLabel },
20
+ ref
21
+ ) {
22
+ return (
23
+ <div className="block-editor-tabbed-sidebar">
24
+ <Tabs
25
+ selectOnMove={ false }
26
+ defaultTabId={ defaultTabId }
27
+ onSelect={ onSelect }
28
+ selectedTabId={ selectedTab }
29
+ >
30
+ <div className="block-editor-tabbed-sidebar__tablist-and-close-button">
31
+ <Button
32
+ className="block-editor-tabbed-sidebar__close-button"
33
+ icon={ closeSmall }
34
+ label={ closeButtonLabel }
35
+ onClick={ () => onClose() }
36
+ size="small"
37
+ />
38
+
39
+ <Tabs.TabList
40
+ className="block-editor-tabbed-sidebar__tablist"
41
+ ref={ ref }
42
+ >
43
+ { tabs.map( ( tab ) => (
44
+ <Tabs.Tab
45
+ key={ tab.name }
46
+ tabId={ tab.name }
47
+ className="block-editor-tabbed-sidebar__tab"
48
+ >
49
+ { tab.title }
50
+ </Tabs.Tab>
51
+ ) ) }
52
+ </Tabs.TabList>
53
+ </div>
54
+ { tabs.map( ( tab ) => (
55
+ <Tabs.TabPanel
56
+ key={ tab.name }
57
+ tabId={ tab.name }
58
+ focusable={ false }
59
+ className="block-editor-tabbed-sidebar__tabpanel"
60
+ ref={ tab.panelRef }
61
+ >
62
+ { tab.panel }
63
+ </Tabs.TabPanel>
64
+ ) ) }
65
+ </Tabs>
66
+ </div>
67
+ );
68
+ }
69
+
70
+ export default forwardRef( TabbedSidebar );