@wordpress/block-editor 12.21.0 → 12.23.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 (408) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +4 -0
  3. package/build/components/block-actions/index.js +2 -4
  4. package/build/components/block-actions/index.js.map +1 -1
  5. package/build/components/block-heading-level-dropdown/index.js +5 -5
  6. package/build/components/block-heading-level-dropdown/index.js.map +1 -1
  7. package/build/components/block-heading-level-dropdown/index.native.js +5 -4
  8. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  9. package/build/components/block-list/block-crash-boundary.native.js +49 -0
  10. package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
  11. package/build/components/block-list/block-crash-warning.native.js +24 -0
  12. package/build/components/block-list/block-crash-warning.native.js.map +1 -0
  13. package/build/components/block-list/block.js +11 -3
  14. package/build/components/block-list/block.js.map +1 -1
  15. package/build/components/block-list/block.native.js +7 -2
  16. package/build/components/block-list/block.native.js.map +1 -1
  17. package/build/components/block-mover/button.js +4 -1
  18. package/build/components/block-mover/button.js.map +1 -1
  19. package/build/components/block-mover/index.js +5 -1
  20. package/build/components/block-mover/index.js.map +1 -1
  21. package/build/components/block-patterns-list/index.js +4 -1
  22. package/build/components/block-patterns-list/index.js.map +1 -1
  23. package/build/components/block-settings/container.native.js +2 -1
  24. package/build/components/block-settings/container.native.js.map +1 -1
  25. package/build/components/block-settings-menu/block-settings-dropdown.js +36 -32
  26. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  27. package/build/components/block-settings-menu-controls/index.js +1 -3
  28. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  29. package/build/components/block-switcher/index.js +4 -3
  30. package/build/components/block-switcher/index.js.map +1 -1
  31. package/build/components/block-toolbar/index.js +8 -5
  32. package/build/components/block-toolbar/index.js.map +1 -1
  33. package/build/components/block-toolbar/shuffle.js +19 -10
  34. package/build/components/block-toolbar/shuffle.js.map +1 -1
  35. package/build/components/block-tools/block-selection-button.js +48 -8
  36. package/build/components/block-tools/block-selection-button.js.map +1 -1
  37. package/build/components/block-tools/index.js +14 -2
  38. package/build/components/block-tools/index.js.map +1 -1
  39. package/build/components/child-layout-control/index.js +108 -11
  40. package/build/components/child-layout-control/index.js.map +1 -1
  41. package/build/components/convert-to-group-buttons/toolbar.js +11 -0
  42. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  43. package/build/components/global-styles/advanced-panel.js +9 -2
  44. package/build/components/global-styles/advanced-panel.js.map +1 -1
  45. package/build/components/global-styles/background-panel.js +444 -0
  46. package/build/components/global-styles/background-panel.js.map +1 -0
  47. package/build/components/global-styles/color-panel.js +2 -1
  48. package/build/components/global-styles/color-panel.js.map +1 -1
  49. package/build/components/global-styles/dimensions-panel.js +8 -33
  50. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  51. package/build/components/global-styles/get-global-styles-changes.js +3 -0
  52. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  53. package/build/components/global-styles/hooks.js +1 -1
  54. package/build/components/global-styles/hooks.js.map +1 -1
  55. package/build/components/global-styles/index.js +13 -0
  56. package/build/components/global-styles/index.js.map +1 -1
  57. package/build/components/global-styles/use-global-styles-output.js +16 -15
  58. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  59. package/build/components/global-styles/utils.js +2 -3
  60. package/build/components/global-styles/utils.js.map +1 -1
  61. package/build/components/iframe/index.js +43 -34
  62. package/build/components/iframe/index.js.map +1 -1
  63. package/build/components/inserter/block-patterns-explorer/index.js +3 -6
  64. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  65. package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  66. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  67. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  68. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  69. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  70. package/build/components/inserter/library.js +2 -0
  71. package/build/components/inserter/library.js.map +1 -1
  72. package/build/components/inserter/menu.js +11 -11
  73. package/build/components/inserter/menu.js.map +1 -1
  74. package/build/components/inserter/mobile-tab-navigation.js +1 -1
  75. package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
  76. package/build/components/inserter/search-items.js +36 -15
  77. package/build/components/inserter/search-items.js.map +1 -1
  78. package/build/components/inserter/search-results.js +2 -3
  79. package/build/components/inserter/search-results.js.map +1 -1
  80. package/build/components/inserter/tabs.js +1 -2
  81. package/build/components/inserter/tabs.js.map +1 -1
  82. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
  83. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  84. package/build/components/keyboard-shortcuts/index.js +11 -0
  85. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  86. package/build/components/list-view/block-select-button.js +18 -12
  87. package/build/components/list-view/block-select-button.js.map +1 -1
  88. package/build/components/list-view/block.js +4 -11
  89. package/build/components/list-view/block.js.map +1 -1
  90. package/build/components/list-view/index.js +17 -2
  91. package/build/components/list-view/index.js.map +1 -1
  92. package/build/components/list-view/use-list-view-collapse-items.js +47 -0
  93. package/build/components/list-view/use-list-view-collapse-items.js.map +1 -0
  94. package/build/components/list-view/utils.js +5 -3
  95. package/build/components/list-view/utils.js.map +1 -1
  96. package/build/components/rich-text/index.js +14 -11
  97. package/build/components/rich-text/index.js.map +1 -1
  98. package/build/components/rich-text/index.native.js +17 -11
  99. package/build/components/rich-text/index.native.js.map +1 -1
  100. package/build/components/rich-text/native/get-format-colors.native.js +1 -1
  101. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
  102. package/build/components/rich-text/native/index.native.js +2 -2
  103. package/build/components/rich-text/native/index.native.js.map +1 -1
  104. package/build/components/rich-text/with-deprecations.js +0 -3
  105. package/build/components/rich-text/with-deprecations.js.map +1 -1
  106. package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  107. package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  108. package/build/components/url-popover/image-url-input-ui.js +50 -36
  109. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  110. package/build/components/use-block-display-information/index.js +4 -6
  111. package/build/components/use-block-display-information/index.js.map +1 -1
  112. package/build/components/use-moving-animation/index.js +4 -0
  113. package/build/components/use-moving-animation/index.js.map +1 -1
  114. package/build/components/warning/index.native.js +9 -4
  115. package/build/components/warning/index.native.js.map +1 -1
  116. package/build/hooks/anchor.js +9 -10
  117. package/build/hooks/anchor.js.map +1 -1
  118. package/build/hooks/background.js +85 -402
  119. package/build/hooks/background.js.map +1 -1
  120. package/build/hooks/index.js +9 -1
  121. package/build/hooks/index.js.map +1 -1
  122. package/build/hooks/layout-child.js +28 -6
  123. package/build/hooks/layout-child.js.map +1 -1
  124. package/build/hooks/layout.js +21 -10
  125. package/build/hooks/layout.js.map +1 -1
  126. package/build/hooks/position.js +1 -1
  127. package/build/hooks/position.js.map +1 -1
  128. package/build/hooks/use-zoom-out.js +47 -0
  129. package/build/hooks/use-zoom-out.js.map +1 -0
  130. package/build/index.js +7 -0
  131. package/build/index.js.map +1 -1
  132. package/build/private-apis.js +6 -1
  133. package/build/private-apis.js.map +1 -1
  134. package/build/private-apis.native.js +5 -1
  135. package/build/private-apis.native.js.map +1 -1
  136. package/build/store/private-actions.js +13 -0
  137. package/build/store/private-actions.js.map +1 -1
  138. package/build/store/private-keys.js +2 -1
  139. package/build/store/private-keys.js.map +1 -1
  140. package/build/store/private-selectors.js +24 -3
  141. package/build/store/private-selectors.js.map +1 -1
  142. package/build/store/reducer.js +53 -26
  143. package/build/store/reducer.js.map +1 -1
  144. package/build/store/selectors.js +34 -32
  145. package/build/store/selectors.js.map +1 -1
  146. package/build/store/utils.js +7 -1
  147. package/build/store/utils.js.map +1 -1
  148. package/build/utils/transform-styles/index.js +2 -1
  149. package/build/utils/transform-styles/index.js.map +1 -1
  150. package/build-module/components/block-actions/index.js +2 -4
  151. package/build-module/components/block-actions/index.js.map +1 -1
  152. package/build-module/components/block-heading-level-dropdown/index.js +5 -5
  153. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
  154. package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
  155. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  156. package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
  157. package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
  158. package/build-module/components/block-list/block-crash-warning.native.js +15 -0
  159. package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
  160. package/build-module/components/block-list/block.js +11 -3
  161. package/build-module/components/block-list/block.js.map +1 -1
  162. package/build-module/components/block-list/block.native.js +7 -2
  163. package/build-module/components/block-list/block.native.js.map +1 -1
  164. package/build-module/components/block-mover/button.js +4 -1
  165. package/build-module/components/block-mover/button.js.map +1 -1
  166. package/build-module/components/block-mover/index.js +5 -1
  167. package/build-module/components/block-mover/index.js.map +1 -1
  168. package/build-module/components/block-patterns-list/index.js +4 -1
  169. package/build-module/components/block-patterns-list/index.js.map +1 -1
  170. package/build-module/components/block-settings/container.native.js +3 -2
  171. package/build-module/components/block-settings/container.native.js.map +1 -1
  172. package/build-module/components/block-settings-menu/block-settings-dropdown.js +37 -33
  173. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  174. package/build-module/components/block-settings-menu-controls/index.js +1 -3
  175. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  176. package/build-module/components/block-switcher/index.js +4 -3
  177. package/build-module/components/block-switcher/index.js.map +1 -1
  178. package/build-module/components/block-toolbar/index.js +8 -5
  179. package/build-module/components/block-toolbar/index.js.map +1 -1
  180. package/build-module/components/block-toolbar/shuffle.js +19 -10
  181. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  182. package/build-module/components/block-tools/block-selection-button.js +50 -10
  183. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  184. package/build-module/components/block-tools/index.js +14 -2
  185. package/build-module/components/block-tools/index.js.map +1 -1
  186. package/build-module/components/child-layout-control/index.js +109 -12
  187. package/build-module/components/child-layout-control/index.js.map +1 -1
  188. package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
  189. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  190. package/build-module/components/global-styles/advanced-panel.js +9 -2
  191. package/build-module/components/global-styles/advanced-panel.js.map +1 -1
  192. package/build-module/components/global-styles/background-panel.js +430 -0
  193. package/build-module/components/global-styles/background-panel.js.map +1 -0
  194. package/build-module/components/global-styles/color-panel.js +2 -1
  195. package/build-module/components/global-styles/color-panel.js.map +1 -1
  196. package/build-module/components/global-styles/dimensions-panel.js +9 -34
  197. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  198. package/build-module/components/global-styles/get-global-styles-changes.js +3 -0
  199. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  200. package/build-module/components/global-styles/hooks.js +1 -1
  201. package/build-module/components/global-styles/hooks.js.map +1 -1
  202. package/build-module/components/global-styles/index.js +1 -0
  203. package/build-module/components/global-styles/index.js.map +1 -1
  204. package/build-module/components/global-styles/use-global-styles-output.js +17 -16
  205. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  206. package/build-module/components/global-styles/utils.js +1 -2
  207. package/build-module/components/global-styles/utils.js.map +1 -1
  208. package/build-module/components/iframe/index.js +43 -34
  209. package/build-module/components/iframe/index.js.map +1 -1
  210. package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
  211. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
  212. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  213. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  214. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  215. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  216. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  217. package/build-module/components/inserter/library.js +2 -0
  218. package/build-module/components/inserter/library.js.map +1 -1
  219. package/build-module/components/inserter/menu.js +11 -11
  220. package/build-module/components/inserter/menu.js.map +1 -1
  221. package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
  222. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
  223. package/build-module/components/inserter/search-items.js +33 -15
  224. package/build-module/components/inserter/search-items.js.map +1 -1
  225. package/build-module/components/inserter/search-results.js +2 -3
  226. package/build-module/components/inserter/search-results.js.map +1 -1
  227. package/build-module/components/inserter/tabs.js +1 -2
  228. package/build-module/components/inserter/tabs.js.map +1 -1
  229. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
  230. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  231. package/build-module/components/keyboard-shortcuts/index.js +11 -0
  232. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  233. package/build-module/components/list-view/block-select-button.js +19 -13
  234. package/build-module/components/list-view/block-select-button.js.map +1 -1
  235. package/build-module/components/list-view/block.js +6 -13
  236. package/build-module/components/list-view/block.js.map +1 -1
  237. package/build-module/components/list-view/index.js +17 -2
  238. package/build-module/components/list-view/index.js.map +1 -1
  239. package/build-module/components/list-view/use-list-view-collapse-items.js +40 -0
  240. package/build-module/components/list-view/use-list-view-collapse-items.js.map +1 -0
  241. package/build-module/components/list-view/utils.js +2 -1
  242. package/build-module/components/list-view/utils.js.map +1 -1
  243. package/build-module/components/rich-text/index.js +15 -12
  244. package/build-module/components/rich-text/index.js.map +1 -1
  245. package/build-module/components/rich-text/index.native.js +16 -11
  246. package/build-module/components/rich-text/index.native.js.map +1 -1
  247. package/build-module/components/rich-text/native/get-format-colors.native.js +1 -1
  248. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
  249. package/build-module/components/rich-text/native/index.native.js +2 -2
  250. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  251. package/build-module/components/rich-text/with-deprecations.js +0 -3
  252. package/build-module/components/rich-text/with-deprecations.js.map +1 -1
  253. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  254. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  255. package/build-module/components/url-popover/image-url-input-ui.js +50 -36
  256. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  257. package/build-module/components/use-block-display-information/index.js +5 -7
  258. package/build-module/components/use-block-display-information/index.js.map +1 -1
  259. package/build-module/components/use-moving-animation/index.js +4 -0
  260. package/build-module/components/use-moving-animation/index.js.map +1 -1
  261. package/build-module/components/warning/index.native.js +9 -4
  262. package/build-module/components/warning/index.native.js.map +1 -1
  263. package/build-module/hooks/anchor.js +10 -11
  264. package/build-module/hooks/anchor.js.map +1 -1
  265. package/build-module/hooks/background.js +82 -397
  266. package/build-module/hooks/background.js.map +1 -1
  267. package/build-module/hooks/index.js +3 -1
  268. package/build-module/hooks/index.js.map +1 -1
  269. package/build-module/hooks/layout-child.js +28 -6
  270. package/build-module/hooks/layout-child.js.map +1 -1
  271. package/build-module/hooks/layout.js +21 -10
  272. package/build-module/hooks/layout.js.map +1 -1
  273. package/build-module/hooks/position.js +1 -1
  274. package/build-module/hooks/position.js.map +1 -1
  275. package/build-module/hooks/use-zoom-out.js +41 -0
  276. package/build-module/hooks/use-zoom-out.js.map +1 -0
  277. package/build-module/index.js +1 -1
  278. package/build-module/index.js.map +1 -1
  279. package/build-module/private-apis.js +7 -2
  280. package/build-module/private-apis.js.map +1 -1
  281. package/build-module/private-apis.native.js +5 -1
  282. package/build-module/private-apis.native.js.map +1 -1
  283. package/build-module/store/private-actions.js +12 -0
  284. package/build-module/store/private-actions.js.map +1 -1
  285. package/build-module/store/private-keys.js +1 -0
  286. package/build-module/store/private-keys.js.map +1 -1
  287. package/build-module/store/private-selectors.js +22 -4
  288. package/build-module/store/private-selectors.js.map +1 -1
  289. package/build-module/store/reducer.js +52 -26
  290. package/build-module/store/reducer.js.map +1 -1
  291. package/build-module/store/selectors.js +35 -33
  292. package/build-module/store/selectors.js.map +1 -1
  293. package/build-module/store/utils.js +6 -1
  294. package/build-module/store/utils.js.map +1 -1
  295. package/build-module/utils/transform-styles/index.js +2 -1
  296. package/build-module/utils/transform-styles/index.js.map +1 -1
  297. package/build-style/content-rtl.css +18 -1
  298. package/build-style/content.css +18 -1
  299. package/build-style/style-rtl.css +92 -99
  300. package/build-style/style.css +92 -99
  301. package/package.json +31 -31
  302. package/src/components/block-actions/index.js +2 -8
  303. package/src/components/block-bindings-toolbar-indicator/style.scss +10 -8
  304. package/src/components/block-heading-level-dropdown/README.md +5 -5
  305. package/src/components/block-heading-level-dropdown/index.js +5 -5
  306. package/src/components/block-heading-level-dropdown/index.native.js +5 -4
  307. package/src/components/block-list/block-crash-boundary.native.js +43 -0
  308. package/src/components/block-list/block-crash-warning.native.js +19 -0
  309. package/src/components/block-list/block.js +19 -3
  310. package/src/components/block-list/block.native.js +14 -7
  311. package/src/components/block-list/content.scss +16 -0
  312. package/src/components/block-mover/button.js +4 -1
  313. package/src/components/block-mover/index.js +8 -1
  314. package/src/components/block-patterns-list/index.js +22 -17
  315. package/src/components/block-preview/style.scss +28 -0
  316. package/src/components/block-settings/container.native.js +5 -1
  317. package/src/components/block-settings-menu/block-settings-dropdown.js +49 -58
  318. package/src/components/block-settings-menu-controls/README.md +0 -9
  319. package/src/components/block-settings-menu-controls/index.js +1 -6
  320. package/src/components/block-switcher/index.js +5 -3
  321. package/src/components/block-switcher/style.scss +1 -1
  322. package/src/components/block-toolbar/index.js +25 -20
  323. package/src/components/block-toolbar/shuffle.js +20 -14
  324. package/src/components/block-toolbar/style.scss +1 -1
  325. package/src/components/block-toolbar/test/index.native.js +1 -7
  326. package/src/components/block-tools/block-selection-button.js +66 -9
  327. package/src/components/block-tools/index.js +18 -1
  328. package/src/components/button-block-appender/content.scss +5 -1
  329. package/src/components/child-layout-control/index.js +147 -35
  330. package/src/components/convert-to-group-buttons/toolbar.js +13 -1
  331. package/src/components/default-block-appender/content.scss +2 -2
  332. package/src/components/global-styles/advanced-panel.js +8 -2
  333. package/src/components/global-styles/background-panel.js +591 -0
  334. package/src/components/global-styles/color-panel.js +2 -1
  335. package/src/components/global-styles/dimensions-panel.js +9 -34
  336. package/src/components/global-styles/get-global-styles-changes.js +3 -0
  337. package/src/components/global-styles/hooks.js +1 -0
  338. package/src/components/global-styles/index.js +4 -0
  339. package/src/components/global-styles/style.scss +78 -1
  340. package/src/{hooks/test/background.js → components/global-styles/test/background-panel.js} +36 -1
  341. package/src/components/global-styles/test/get-global-styles-changes.js +22 -3
  342. package/src/components/global-styles/test/use-global-styles-output.js +40 -9
  343. package/src/components/global-styles/use-global-styles-output.js +30 -17
  344. package/src/components/global-styles/utils.js +1 -18
  345. package/src/components/iframe/index.js +79 -53
  346. package/src/components/inserter/block-patterns-explorer/index.js +2 -9
  347. package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
  348. package/src/components/inserter/block-patterns-tab/index.js +1 -0
  349. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  350. package/src/components/inserter/library.js +4 -0
  351. package/src/components/inserter/menu.js +12 -11
  352. package/src/components/inserter/mobile-tab-navigation.js +1 -1
  353. package/src/components/inserter/search-items.js +37 -15
  354. package/src/components/inserter/search-results.js +1 -2
  355. package/src/components/inserter/style.scss +6 -12
  356. package/src/components/inserter/tabs.js +1 -2
  357. package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
  358. package/src/components/keyboard-shortcuts/index.js +11 -0
  359. package/src/components/link-control/style.scss +0 -5
  360. package/src/components/list-view/block-select-button.js +15 -19
  361. package/src/components/list-view/block.js +12 -21
  362. package/src/components/list-view/index.js +18 -1
  363. package/src/components/list-view/style.scss +38 -28
  364. package/src/components/list-view/use-list-view-collapse-items.js +33 -0
  365. package/src/components/list-view/utils.js +4 -1
  366. package/src/components/rich-text/README.md +6 -0
  367. package/src/components/rich-text/index.js +30 -13
  368. package/src/components/rich-text/index.native.js +14 -11
  369. package/src/components/rich-text/native/get-format-colors.native.js +1 -1
  370. package/src/components/rich-text/native/index.native.js +2 -2
  371. package/src/components/rich-text/with-deprecations.js +0 -3
  372. package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  373. package/src/components/url-popover/image-url-input-ui.js +68 -51
  374. package/src/components/use-block-display-information/index.js +8 -10
  375. package/src/components/use-moving-animation/index.js +1 -0
  376. package/src/components/warning/index.native.js +19 -15
  377. package/src/hooks/anchor.js +43 -61
  378. package/src/hooks/background.js +100 -516
  379. package/src/hooks/index.js +3 -0
  380. package/src/hooks/layout-child.js +44 -8
  381. package/src/hooks/layout.js +22 -18
  382. package/src/hooks/position.js +1 -1
  383. package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
  384. package/src/hooks/test/anchor.native.js +32 -0
  385. package/src/hooks/use-zoom-out.js +36 -0
  386. package/src/index.js +1 -0
  387. package/src/private-apis.js +13 -1
  388. package/src/private-apis.native.js +4 -0
  389. package/src/store/private-actions.js +12 -0
  390. package/src/store/private-keys.js +1 -0
  391. package/src/store/private-selectors.js +54 -27
  392. package/src/store/reducer.js +63 -41
  393. package/src/store/selectors.js +195 -180
  394. package/src/store/test/private-actions.js +10 -0
  395. package/src/store/test/private-selectors.js +13 -0
  396. package/src/store/test/reducer.js +26 -0
  397. package/src/store/test/selectors.js +90 -199
  398. package/src/store/utils.js +13 -0
  399. package/src/style.scss +0 -2
  400. package/src/utils/transform-styles/index.js +2 -1
  401. package/tsconfig.json +1 -0
  402. package/build/utils/calculate-scale.js +0 -17
  403. package/build/utils/calculate-scale.js.map +0 -1
  404. package/build-module/utils/calculate-scale.js +0 -11
  405. package/build-module/utils/calculate-scale.js.map +0 -1
  406. package/src/hooks/anchor.scss +0 -4
  407. package/src/hooks/background.scss +0 -75
  408. package/src/utils/calculate-scale.js +0 -20
@@ -19,7 +19,12 @@ import BlockDraggable from '../block-draggable';
19
19
  import { BlockMoverUpButton, BlockMoverDownButton } from './button';
20
20
  import { store as blockEditorStore } from '../../store';
21
21
 
22
- function BlockMover( { clientIds, hideDragHandle } ) {
22
+ function BlockMover( {
23
+ clientIds,
24
+ hideDragHandle,
25
+ isBlockMoverUpButtonDisabled,
26
+ isBlockMoverDownButtonDisabled,
27
+ } ) {
23
28
  const { canMove, rootClientId, isFirst, isLast, orientation } = useSelect(
24
29
  ( select ) => {
25
30
  const {
@@ -83,6 +88,7 @@ function BlockMover( { clientIds, hideDragHandle } ) {
83
88
  <ToolbarItem>
84
89
  { ( itemProps ) => (
85
90
  <BlockMoverUpButton
91
+ disabled={ isBlockMoverUpButtonDisabled }
86
92
  clientIds={ clientIds }
87
93
  { ...itemProps }
88
94
  />
@@ -91,6 +97,7 @@ function BlockMover( { clientIds, hideDragHandle } ) {
91
97
  <ToolbarItem>
92
98
  { ( itemProps ) => (
93
99
  <BlockMoverDownButton
100
+ disabled={ isBlockMoverDownButtonDisabled }
94
101
  clientIds={ clientIds }
95
102
  { ...itemProps }
96
103
  />
@@ -45,6 +45,7 @@ function BlockPattern( {
45
45
  pattern,
46
46
  onClick,
47
47
  onHover,
48
+ showTitle = true,
48
49
  showTooltip,
49
50
  } ) {
50
51
  const [ isDragging, setIsDragging ] = useState( false );
@@ -122,25 +123,27 @@ function BlockPattern( {
122
123
  viewportWidth={ viewportWidth }
123
124
  />
124
125
 
125
- <HStack className="block-editor-patterns__pattern-details">
126
- { pattern.type ===
127
- INSERTER_PATTERN_TYPES.user &&
128
- ! pattern.syncStatus && (
129
- <div className="block-editor-patterns__pattern-icon-wrapper">
130
- <Icon
131
- className="block-editor-patterns__pattern-icon"
132
- icon={ symbol }
133
- />
126
+ { showTitle && (
127
+ <HStack className="block-editor-patterns__pattern-details">
128
+ { pattern.type ===
129
+ INSERTER_PATTERN_TYPES.user &&
130
+ ! pattern.syncStatus && (
131
+ <div className="block-editor-patterns__pattern-icon-wrapper">
132
+ <Icon
133
+ className="block-editor-patterns__pattern-icon"
134
+ icon={ symbol }
135
+ />
136
+ </div>
137
+ ) }
138
+ { ( ! showTooltip ||
139
+ pattern.type ===
140
+ INSERTER_PATTERN_TYPES.user ) && (
141
+ <div className="block-editor-block-patterns-list__item-title">
142
+ { pattern.title }
134
143
  </div>
135
144
  ) }
136
- { ( ! showTooltip ||
137
- pattern.type ===
138
- INSERTER_PATTERN_TYPES.user ) && (
139
- <div className="block-editor-block-patterns-list__item-title">
140
- { pattern.title }
141
- </div>
142
- ) }
143
- </HStack>
145
+ </HStack>
146
+ ) }
144
147
 
145
148
  { !! pattern.description && (
146
149
  <VisuallyHidden id={ descriptionId }>
@@ -170,6 +173,7 @@ function BlockPatternsList(
170
173
  onClickPattern,
171
174
  orientation,
172
175
  label = __( 'Block patterns' ),
176
+ showTitle = true,
173
177
  showTitlesAsTooltip,
174
178
  pagingProps,
175
179
  },
@@ -203,6 +207,7 @@ function BlockPatternsList(
203
207
  onClick={ onClickPattern }
204
208
  onHover={ onHover }
205
209
  isDraggable={ isDraggable }
210
+ showTitle={ showTitle }
206
211
  showTooltip={ showTitlesAsTooltip }
207
212
  />
208
213
  ) : (
@@ -48,3 +48,31 @@
48
48
  bottom: 0;
49
49
  z-index: 1;
50
50
  }
51
+
52
+ // Restrict these shadows to the context of the inspector.
53
+ .interface-interface-skeleton__sidebar {
54
+ .block-editor-block-patterns-list__list-item {
55
+ .block-editor-block-preview__container {
56
+ box-shadow: 0 0 $border-width rgba($black, 0.1);
57
+ }
58
+ &:hover {
59
+ .block-editor-block-preview__container {
60
+ box-shadow: 0 0 0 2px $gray-900;
61
+ }
62
+ }
63
+ }
64
+ }
65
+
66
+ // Restrict these shadows to the context of the inserter.
67
+ .editor-inserter-sidebar {
68
+ .block-editor-block-patterns-list__list-item {
69
+ .block-editor-block-preview__container {
70
+ box-shadow: 0 15px 25px rgb(0 0 0 / 7%);
71
+ }
72
+ &:hover {
73
+ .block-editor-block-preview__container {
74
+ box-shadow: 0 0 0 2px $gray-900, 0 15px 25px rgb(0 0 0 / 7%);
75
+ }
76
+ }
77
+ }
78
+ }
@@ -16,6 +16,7 @@ import styles from './container.native.scss';
16
16
  import InspectorControls from '../inspector-controls';
17
17
  import ImageLinkDestinationsScreen from '../image-link-destinations';
18
18
  import useMultipleOriginColorsAndGradients from '../colors-gradients/use-multiple-origin-colors-and-gradients';
19
+ import AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';
19
20
 
20
21
  export const blockSettingsScreens = {
21
22
  settings: 'Settings',
@@ -46,7 +47,10 @@ export default function BottomSheetSettings( props ) {
46
47
  <BottomSheet.NavigationScreen
47
48
  name={ blockSettingsScreens.settings }
48
49
  >
49
- <InspectorControls.Slot />
50
+ <>
51
+ <InspectorControls.Slot />
52
+ <AdvancedControls />
53
+ </>
50
54
  </BottomSheet.NavigationScreen>
51
55
  <BottomSheet.NavigationScreen
52
56
  name={ BottomSheet.SubSheet.screenName }
@@ -9,8 +9,9 @@ import {
9
9
  import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
10
10
  import { useDispatch, useSelect } from '@wordpress/data';
11
11
  import { moreVertical } from '@wordpress/icons';
12
- import { Children, cloneElement, useCallback } from '@wordpress/element';
12
+ import { Children, cloneElement } from '@wordpress/element';
13
13
  import { __ } from '@wordpress/i18n';
14
+ import { displayShortcut } from '@wordpress/keycodes';
14
15
  import {
15
16
  store as keyboardShortcutsStore,
16
17
  __unstableUseShortcutEventMatch,
@@ -33,31 +34,31 @@ const POPOVER_PROPS = {
33
34
  placement: 'bottom-start',
34
35
  };
35
36
 
36
- function CopyMenuItem( { clientIds, onCopy, label } ) {
37
+ function CopyMenuItem( { clientIds, onCopy, label, shortcut } ) {
37
38
  const { getBlocksByClientId } = useSelect( blockEditorStore );
38
39
  const ref = useCopyToClipboard(
39
40
  () => serialize( getBlocksByClientId( clientIds ) ),
40
41
  onCopy
41
42
  );
42
43
  const copyMenuItemLabel = label ? label : __( 'Copy' );
43
- return <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;
44
+ return (
45
+ <MenuItem ref={ ref } shortcut={ shortcut }>
46
+ { copyMenuItemLabel }
47
+ </MenuItem>
48
+ );
44
49
  }
45
50
 
46
51
  export function BlockSettingsDropdown( {
47
52
  block,
48
53
  clientIds,
49
- __experimentalSelectBlock,
50
54
  children,
51
- __unstableDisplayLocation,
55
+ __experimentalSelectBlock,
52
56
  ...props
53
57
  } ) {
54
58
  // Get the client id of the current block for this menu, if one is set.
55
59
  const currentClientId = block?.clientId;
56
- const blockClientIds = Array.isArray( clientIds )
57
- ? clientIds
58
- : [ clientIds ];
59
- const count = blockClientIds.length;
60
- const firstBlockClientId = blockClientIds[ 0 ];
60
+ const count = clientIds.length;
61
+ const firstBlockClientId = clientIds[ 0 ];
61
62
  const {
62
63
  firstParentClientId,
63
64
  onlyBlock,
@@ -127,41 +128,35 @@ export function BlockSettingsDropdown( {
127
128
  const isMatch = __unstableUseShortcutEventMatch();
128
129
  const hasSelectedBlocks = selectedBlockClientIds.length > 0;
129
130
 
130
- const updateSelectionAfterDuplicate = useCallback(
131
- async ( clientIdsPromise ) => {
132
- if ( __experimentalSelectBlock ) {
133
- const ids = await clientIdsPromise;
134
- if ( ids && ids[ 0 ] ) {
135
- __experimentalSelectBlock( ids[ 0 ], false );
136
- }
137
- }
138
- },
139
- [ __experimentalSelectBlock ]
140
- );
131
+ async function updateSelectionAfterDuplicate( clientIdsPromise ) {
132
+ if ( ! __experimentalSelectBlock ) {
133
+ return;
134
+ }
141
135
 
142
- const updateSelectionAfterRemove = useCallback( () => {
143
- if ( __experimentalSelectBlock ) {
144
- let blockToFocus = previousBlockClientId || firstParentClientId;
136
+ const ids = await clientIdsPromise;
137
+ if ( ids && ids[ 0 ] ) {
138
+ __experimentalSelectBlock( ids[ 0 ], false );
139
+ }
140
+ }
145
141
 
146
- // Focus the first block if there's no previous block nor parent block.
147
- if ( ! blockToFocus ) {
148
- blockToFocus = getBlockOrder()[ 0 ];
149
- }
142
+ function updateSelectionAfterRemove() {
143
+ if ( ! __experimentalSelectBlock ) {
144
+ return;
145
+ }
150
146
 
151
- // Only update the selection if the original selection is removed.
152
- const shouldUpdateSelection =
153
- hasSelectedBlocks && getSelectedBlockClientIds().length === 0;
147
+ let blockToFocus = previousBlockClientId || firstParentClientId;
154
148
 
155
- __experimentalSelectBlock( blockToFocus, shouldUpdateSelection );
149
+ // Focus the first block if there's no previous block nor parent block.
150
+ if ( ! blockToFocus ) {
151
+ blockToFocus = getBlockOrder()[ 0 ];
156
152
  }
157
- }, [
158
- __experimentalSelectBlock,
159
- previousBlockClientId,
160
- firstParentClientId,
161
- getBlockOrder,
162
- hasSelectedBlocks,
163
- getSelectedBlockClientIds,
164
- ] );
153
+
154
+ // Only update the selection if the original selection is removed.
155
+ const shouldUpdateSelection =
156
+ hasSelectedBlocks && getSelectedBlockClientIds().length === 0;
157
+
158
+ __experimentalSelectBlock( blockToFocus, shouldUpdateSelection );
159
+ }
165
160
 
166
161
  // This can occur when the selected block (the parent)
167
162
  // displays child blocks within a List View.
@@ -179,20 +174,17 @@ export function BlockSettingsDropdown( {
179
174
  ? undefined
180
175
  : openedBlockSettingsMenu === currentClientId || false;
181
176
 
182
- const onToggle = useCallback(
183
- ( localOpen ) => {
184
- if ( localOpen && openedBlockSettingsMenu !== currentClientId ) {
185
- setOpenedBlockSettingsMenu( currentClientId );
186
- } else if (
187
- ! localOpen &&
188
- openedBlockSettingsMenu &&
189
- openedBlockSettingsMenu === currentClientId
190
- ) {
191
- setOpenedBlockSettingsMenu( undefined );
192
- }
193
- },
194
- [ currentClientId, openedBlockSettingsMenu, setOpenedBlockSettingsMenu ]
195
- );
177
+ function onToggle( localOpen ) {
178
+ if ( localOpen && openedBlockSettingsMenu !== currentClientId ) {
179
+ setOpenedBlockSettingsMenu( currentClientId );
180
+ } else if (
181
+ ! localOpen &&
182
+ openedBlockSettingsMenu &&
183
+ openedBlockSettingsMenu === currentClientId
184
+ ) {
185
+ setOpenedBlockSettingsMenu( undefined );
186
+ }
187
+ }
196
188
 
197
189
  return (
198
190
  <BlockActions
@@ -233,7 +225,8 @@ export function BlockSettingsDropdown( {
233
225
  canRemove
234
226
  ) {
235
227
  event.preventDefault();
236
- updateSelectionAfterRemove( onRemove() );
228
+ onRemove();
229
+ updateSelectionAfterRemove();
237
230
  } else if (
238
231
  isMatch(
239
232
  'core/block-editor/duplicate',
@@ -291,6 +284,7 @@ export function BlockSettingsDropdown( {
291
284
  <CopyMenuItem
292
285
  clientIds={ clientIds }
293
286
  onCopy={ onCopy }
287
+ shortcut={ displayShortcut.primary( 'c' ) }
294
288
  />
295
289
  { canDuplicate && (
296
290
  <MenuItem
@@ -349,9 +343,6 @@ export function BlockSettingsDropdown( {
349
343
  firstBlockClientId,
350
344
  } }
351
345
  clientIds={ clientIds }
352
- __unstableDisplayLocation={
353
- __unstableDisplayLocation
354
- }
355
346
  />
356
347
  { typeof children === 'function'
357
348
  ? children( { onClose } )
@@ -16,12 +16,3 @@ function ReusableBlocksMenuItems() {
16
16
  );
17
17
  }
18
18
  ```
19
-
20
- ## Props
21
-
22
- ### `__unstableDisplayLocation`
23
-
24
- - **Type:** `String`
25
- - **Default:** `undefined`
26
-
27
- A string representing the location where the component is being displayed within the UI. This can be used to conditionalize certain behaviors including the display of associated components. This behaviour will likely be refactored to a React.Context implementation.
@@ -26,11 +26,7 @@ import { BlockRenameControl, useBlockRename } from '../block-rename';
26
26
 
27
27
  const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
28
28
 
29
- const BlockSettingsMenuControlsSlot = ( {
30
- fillProps,
31
- clientIds = null,
32
- __unstableDisplayLocation,
33
- } ) => {
29
+ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
34
30
  const { selectedBlocks, selectedClientIds } = useSelect(
35
31
  ( select ) => {
36
32
  const { getBlockNamesByClientId, getSelectedBlockClientIds } =
@@ -61,7 +57,6 @@ const BlockSettingsMenuControlsSlot = ( {
61
57
  <Slot
62
58
  fillProps={ {
63
59
  ...fillProps,
64
- __unstableDisplayLocation,
65
60
  selectedBlocks,
66
61
  selectedClientIds,
67
62
  } }
@@ -160,7 +160,7 @@ function BlockSwitcherDropdownMenuContents( {
160
160
  );
161
161
  }
162
162
 
163
- export const BlockSwitcher = ( { clientIds } ) => {
163
+ export const BlockSwitcher = ( { clientIds, disabled } ) => {
164
164
  const {
165
165
  canRemove,
166
166
  hasBlockStyles,
@@ -182,7 +182,9 @@ export const BlockSwitcher = ( { clientIds } ) => {
182
182
  if ( ! _blocks.length || _blocks.some( ( block ) => ! block ) ) {
183
183
  return { invalidBlocks: true };
184
184
  }
185
- const rootClientId = getBlockRootClientId( clientIds );
185
+ const rootClientId = getBlockRootClientId(
186
+ Array.isArray( clientIds ) ? clientIds[ 0 ] : clientIds
187
+ );
186
188
  const [ { name: firstBlockName } ] = _blocks;
187
189
  const _isSingleBlockSelected = _blocks.length === 1;
188
190
  const blockType = getBlockType( firstBlockName );
@@ -229,8 +231,8 @@ export const BlockSwitcher = ( { clientIds } ) => {
229
231
  const blockSwitcherLabel = isSingleBlock
230
232
  ? blockTitle
231
233
  : __( 'Multiple blocks selected' );
232
- const hideDropdown = ! hasBlockStyles && ! canRemove;
233
234
 
235
+ const hideDropdown = disabled || ( ! hasBlockStyles && ! canRemove );
234
236
  if ( hideDropdown ) {
235
237
  return (
236
238
  <ToolbarGroup>
@@ -1,7 +1,7 @@
1
1
  .block-editor-block-switcher {
2
2
  position: relative;
3
3
 
4
- // @todo: override toolbar group inherited paddings from components/block-tools/style.scss.
4
+ // @todo override toolbar group inherited paddings from components/block-tools/style.scss.
5
5
  // This is best fixed by making the mover control area a proper single toolbar group.
6
6
  // It needs specificity due to style inherited from .components-accessible-toolbar .components-button.has-icon.has-icon.
7
7
  .components-button.components-dropdown-menu__toggle.has-icon.has-icon {
@@ -63,6 +63,7 @@ export function PrivateBlockToolbar( {
63
63
  isDefaultEditingMode,
64
64
  blockType,
65
65
  blockName,
66
+ toolbarKey,
66
67
  shouldShowVisualToolbar,
67
68
  showParentSelector,
68
69
  isUsingBindings,
@@ -103,6 +104,7 @@ export function PrivateBlockToolbar( {
103
104
  blockType: selectedBlockClientId && getBlockType( _blockName ),
104
105
  shouldShowVisualToolbar: isValid && isVisual,
105
106
  rootClientId: blockRootClientId,
107
+ toolbarKey: `${ selectedBlockClientId }${ firstParentClientId }`,
106
108
  showParentSelector:
107
109
  parentBlockType &&
108
110
  getBlockEditingMode( firstParentClientId ) === 'default' &&
@@ -159,7 +161,7 @@ export function PrivateBlockToolbar( {
159
161
  __experimentalOnIndexChange={ __experimentalOnIndexChange }
160
162
  // Resets the index whenever the active block changes so
161
163
  // this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
162
- key={ blockClientId }
164
+ key={ toolbarKey }
163
165
  >
164
166
  <div ref={ toolbarWrapperRef } className={ innerClasses }>
165
167
  { ! isMultiToolbar &&
@@ -168,26 +170,29 @@ export function PrivateBlockToolbar( {
168
170
  { isUsingBindings && canBindBlock( blockName ) && (
169
171
  <BlockBindingsIndicator />
170
172
  ) }
171
- { ( shouldShowVisualToolbar || isMultiToolbar ) &&
172
- isDefaultEditingMode && (
173
- <div
174
- ref={ nodeRef }
175
- { ...showHoveredOrFocusedGestures }
176
- >
177
- <ToolbarGroup className="block-editor-block-toolbar__block-controls">
178
- <BlockSwitcher clientIds={ blockClientIds } />
179
- { ! isMultiToolbar && (
180
- <BlockLockToolbar
181
- clientId={ blockClientId }
173
+ { ( shouldShowVisualToolbar || isMultiToolbar ) && (
174
+ <div ref={ nodeRef } { ...showHoveredOrFocusedGestures }>
175
+ <ToolbarGroup className="block-editor-block-toolbar__block-controls">
176
+ <BlockSwitcher
177
+ clientIds={ blockClientIds }
178
+ disabled={ ! isDefaultEditingMode }
179
+ />
180
+ { isDefaultEditingMode && (
181
+ <>
182
+ { ! isMultiToolbar && (
183
+ <BlockLockToolbar
184
+ clientId={ blockClientId }
185
+ />
186
+ ) }
187
+ <BlockMover
188
+ clientIds={ blockClientIds }
189
+ hideDragHandle={ hideDragHandle }
182
190
  />
183
- ) }
184
- <BlockMover
185
- clientIds={ blockClientIds }
186
- hideDragHandle={ hideDragHandle }
187
- />
188
- </ToolbarGroup>
189
- </div>
190
- ) }
191
+ </>
192
+ ) }
193
+ </ToolbarGroup>
194
+ </div>
195
+ ) }
191
196
  <Shuffle clientId={ blockClientId } />
192
197
  { shouldShowVisualToolbar && isMultiToolbar && (
193
198
  <BlockGroupToolbar />
@@ -23,7 +23,7 @@ function Container( props ) {
23
23
  }
24
24
 
25
25
  export default function Shuffle( { clientId, as = Container } ) {
26
- const { categories, patterns } = useSelect(
26
+ const { categories, patterns, patternName } = useSelect(
27
27
  ( select ) => {
28
28
  const {
29
29
  getBlockAttributes,
@@ -32,11 +32,13 @@ export default function Shuffle( { clientId, as = Container } ) {
32
32
  } = select( blockEditorStore );
33
33
  const attributes = getBlockAttributes( clientId );
34
34
  const _categories = attributes?.metadata?.categories || EMPTY_ARRAY;
35
+ const _patternName = attributes?.metadata?.patternName;
35
36
  const rootBlock = getBlockRootClientId( clientId );
36
37
  const _patterns = __experimentalGetAllowedPatterns( rootBlock );
37
38
  return {
38
39
  categories: _categories,
39
40
  patterns: _patterns,
41
+ patternName: _patternName,
40
42
  };
41
43
  },
42
44
  [ clientId ]
@@ -56,7 +58,7 @@ export default function Shuffle( { clientId, as = Container } ) {
56
58
  // Check if the pattern has only one top level block,
57
59
  // otherwise we may shuffle to pattern that will not allow to continue shuffling.
58
60
  pattern.blocks.length === 1 &&
59
- pattern.categories.some( ( category ) => {
61
+ pattern.categories?.some( ( category ) => {
60
62
  return categories.includes( category );
61
63
  } )
62
64
  );
@@ -65,28 +67,32 @@ export default function Shuffle( { clientId, as = Container } ) {
65
67
  if ( sameCategoryPatternsWithSingleWrapper.length === 0 ) {
66
68
  return null;
67
69
  }
70
+
71
+ function getNextPattern() {
72
+ const numberOfPatterns = sameCategoryPatternsWithSingleWrapper.length;
73
+ const patternIndex = sameCategoryPatternsWithSingleWrapper.findIndex(
74
+ ( { name } ) => name === patternName
75
+ );
76
+ const nextPatternIndex =
77
+ patternIndex + 1 < numberOfPatterns ? patternIndex + 1 : 0;
78
+ return sameCategoryPatternsWithSingleWrapper[ nextPatternIndex ];
79
+ }
80
+
68
81
  const ComponentToUse = as;
69
82
  return (
70
83
  <ComponentToUse
71
84
  label={ __( 'Shuffle' ) }
72
85
  icon={ shuffle }
73
86
  onClick={ () => {
74
- const randomPattern =
75
- sameCategoryPatternsWithSingleWrapper[
76
- Math.floor(
77
- // eslint-disable-next-line no-restricted-syntax
78
- Math.random() *
79
- sameCategoryPatternsWithSingleWrapper.length
80
- )
81
- ];
82
- randomPattern.blocks[ 0 ].attributes = {
83
- ...randomPattern.blocks[ 0 ].attributes,
87
+ const nextPattern = getNextPattern();
88
+ nextPattern.blocks[ 0 ].attributes = {
89
+ ...nextPattern.blocks[ 0 ].attributes,
84
90
  metadata: {
85
- ...randomPattern.blocks[ 0 ].attributes.metadata,
91
+ ...nextPattern.blocks[ 0 ].attributes.metadata,
86
92
  categories,
87
93
  },
88
94
  };
89
- replaceBlocks( clientId, randomPattern.blocks );
95
+ replaceBlocks( clientId, nextPattern.blocks );
90
96
  } }
91
97
  />
92
98
  );
@@ -133,7 +133,7 @@
133
133
  }
134
134
  }
135
135
 
136
- // @todo: override toolbar group inherited paddings from components/block-tools/style.scss.
136
+ // @todo override toolbar group inherited paddings from components/block-tools/style.scss.
137
137
  // This is best fixed by making the mover control area a proper single toolbar group.
138
138
  .components-toolbar-group {
139
139
  padding: 0;
@@ -15,13 +15,7 @@ describe( 'Block Toolbar', () => {
15
15
  it( "doesn't render the block settings button if there aren't any settings for the current selected block", async () => {
16
16
  // Arrange
17
17
  const screen = await initializeEditor();
18
- await addBlock( screen, 'Image' );
19
-
20
- // Act
21
- fireEvent(
22
- screen.getByTestId( 'media-options-picker' ),
23
- 'backdropPress'
24
- );
18
+ await addBlock( screen, 'Shortcode' );
25
19
 
26
20
  // Assert
27
21
  expect( screen.queryByLabelText( 'Open Settings' ) ).toBeNull();