@wordpress/block-editor 8.3.0 → 8.5.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 (443) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +56 -18
  3. package/build/components/alignment-control/index.js +13 -6
  4. package/build/components/alignment-control/index.js.map +1 -1
  5. package/build/components/block-alignment-control/index.js +13 -6
  6. package/build/components/block-alignment-control/index.js.map +1 -1
  7. package/build/components/block-draggable/index.js +2 -3
  8. package/build/components/block-draggable/index.js.map +1 -1
  9. package/build/components/block-icon/index.js +4 -0
  10. package/build/components/block-icon/index.js.map +1 -1
  11. package/build/components/block-inspector/index.js +6 -1
  12. package/build/components/block-inspector/index.js.map +1 -1
  13. package/build/components/block-list/block-html.js +4 -1
  14. package/build/components/block-list/block-html.js.map +1 -1
  15. package/build/components/block-list/block.js +4 -1
  16. package/build/components/block-list/block.js.map +1 -1
  17. package/build/components/block-list/use-block-props/index.js +1 -6
  18. package/build/components/block-list/use-block-props/index.js.map +1 -1
  19. package/build/components/block-list/use-block-props/use-focus-first-element.js +22 -6
  20. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  21. package/build/components/block-list/use-block-props/use-focus-handler.js +7 -1
  22. package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  23. package/build/components/block-list-appender/index.js +6 -1
  24. package/build/components/block-list-appender/index.js.map +1 -1
  25. package/build/components/block-lock/index.js +32 -0
  26. package/build/components/block-lock/index.js.map +1 -0
  27. package/build/components/block-lock/menu-item.js +67 -0
  28. package/build/components/block-lock/menu-item.js.map +1 -0
  29. package/build/components/block-lock/modal.js +134 -0
  30. package/build/components/block-lock/modal.js.map +1 -0
  31. package/build/components/block-lock/toolbar.js +78 -0
  32. package/build/components/block-lock/toolbar.js.map +1 -0
  33. package/build/components/block-mover/index.js +4 -0
  34. package/build/components/block-mover/index.js.map +1 -1
  35. package/build/components/block-settings-menu/block-settings-dropdown.js +75 -10
  36. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  37. package/build/components/block-settings-menu-controls/index.js +19 -9
  38. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  39. package/build/components/block-switcher/index.js +1 -1
  40. package/build/components/block-switcher/index.js.map +1 -1
  41. package/build/components/block-title/index.js +2 -2
  42. package/build/components/block-title/index.js.map +1 -1
  43. package/build/components/block-title/use-block-display-title.js +8 -6
  44. package/build/components/block-title/use-block-display-title.js.map +1 -1
  45. package/build/components/block-toolbar/block-name-context.js +17 -0
  46. package/build/components/block-toolbar/block-name-context.js.map +1 -0
  47. package/build/components/block-toolbar/block-toolbar-last-item.js +20 -0
  48. package/build/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
  49. package/build/components/block-toolbar/index.js +24 -5
  50. package/build/components/block-toolbar/index.js.map +1 -1
  51. package/build/components/block-tools/index.js +0 -16
  52. package/build/components/block-tools/index.js.map +1 -1
  53. package/build/components/block-variation-transforms/index.js +92 -47
  54. package/build/components/block-variation-transforms/index.js.map +1 -1
  55. package/build/components/block-vertical-alignment-control/index.js +13 -6
  56. package/build/components/block-vertical-alignment-control/index.js.map +1 -1
  57. package/build/components/border-radius-control/index.js +0 -1
  58. package/build/components/border-radius-control/index.js.map +1 -1
  59. package/build/components/border-radius-control/utils.js +1 -1
  60. package/build/components/border-radius-control/utils.js.map +1 -1
  61. package/build/components/colors-gradients/control.js +3 -1
  62. package/build/components/colors-gradients/control.js.map +1 -1
  63. package/build/components/contrast-checker/index.js +4 -0
  64. package/build/components/contrast-checker/index.js.map +1 -1
  65. package/build/components/convert-to-group-buttons/index.js +8 -0
  66. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  67. package/build/components/convert-to-group-buttons/toolbar.js +105 -0
  68. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -0
  69. package/build/components/copy-handler/index.js +4 -0
  70. package/build/components/copy-handler/index.js.map +1 -1
  71. package/build/components/date-format-picker/index.js +132 -0
  72. package/build/components/date-format-picker/index.js.map +1 -0
  73. package/build/components/font-sizes/font-size-picker.js +4 -0
  74. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  75. package/build/components/iframe/index.js +6 -9
  76. package/build/components/iframe/index.js.map +1 -1
  77. package/build/components/index.js +27 -0
  78. package/build/components/index.js.map +1 -1
  79. package/build/components/justify-content-control/index.js +13 -6
  80. package/build/components/justify-content-control/index.js.map +1 -1
  81. package/build/components/keyboard-shortcuts/index.js +1 -1
  82. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  83. package/build/components/line-height-control/index.js +15 -6
  84. package/build/components/line-height-control/index.js.map +1 -1
  85. package/build/components/list-view/block-select-button.js +24 -23
  86. package/build/components/list-view/block-select-button.js.map +1 -1
  87. package/build/components/list-view/block.js +38 -13
  88. package/build/components/list-view/block.js.map +1 -1
  89. package/build/components/list-view/branch.js +16 -13
  90. package/build/components/list-view/branch.js.map +1 -1
  91. package/build/components/list-view/index.js +7 -1
  92. package/build/components/list-view/index.js.map +1 -1
  93. package/build/components/list-view/use-block-selection.js +9 -2
  94. package/build/components/list-view/use-block-selection.js.map +1 -1
  95. package/build/components/media-replace-flow/index.js +4 -0
  96. package/build/components/media-replace-flow/index.js.map +1 -1
  97. package/build/components/multi-selection-inspector/index.js +1 -1
  98. package/build/components/multi-selection-inspector/index.js.map +1 -1
  99. package/build/components/rich-text/index.js +27 -5
  100. package/build/components/rich-text/index.js.map +1 -1
  101. package/build/components/rich-text/index.native.js +13 -9
  102. package/build/components/rich-text/index.native.js.map +1 -1
  103. package/build/components/rich-text/split-value.js +12 -2
  104. package/build/components/rich-text/split-value.js.map +1 -1
  105. package/build/components/rich-text/use-firefox-compat.js +49 -0
  106. package/build/components/rich-text/use-firefox-compat.js.map +1 -0
  107. package/build/components/rich-text/use-input-rules.js +34 -2
  108. package/build/components/rich-text/use-input-rules.js.map +1 -1
  109. package/build/components/skip-to-selected-block/index.js +4 -0
  110. package/build/components/skip-to-selected-block/index.js.map +1 -1
  111. package/build/components/url-popover/image-url-input-ui.js +11 -27
  112. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  113. package/build/components/writing-flow/index.js +9 -1
  114. package/build/components/writing-flow/index.js.map +1 -1
  115. package/build/components/writing-flow/use-arrow-nav.js +3 -44
  116. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  117. package/build/components/writing-flow/use-click-selection.js +68 -0
  118. package/build/components/writing-flow/use-click-selection.js.map +1 -0
  119. package/build/components/writing-flow/use-drag-selection.js +134 -0
  120. package/build/components/writing-flow/use-drag-selection.js.map +1 -0
  121. package/build/components/writing-flow/use-input.js +116 -0
  122. package/build/components/writing-flow/use-input.js.map +1 -0
  123. package/build/components/writing-flow/use-multi-selection.js +18 -38
  124. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  125. package/build/components/writing-flow/use-selection-observer.js +161 -0
  126. package/build/components/writing-flow/use-selection-observer.js.map +1 -0
  127. package/build/components/writing-flow/use-tab-nav.js +1 -8
  128. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  129. package/build/hooks/anchor.js +7 -6
  130. package/build/hooks/anchor.js.map +1 -1
  131. package/build/hooks/border-color.js +3 -3
  132. package/build/hooks/border-color.js.map +1 -1
  133. package/build/hooks/border.js +0 -14
  134. package/build/hooks/border.js.map +1 -1
  135. package/build/hooks/color.js +20 -17
  136. package/build/hooks/color.js.map +1 -1
  137. package/build/hooks/font-family.js +5 -1
  138. package/build/hooks/font-family.js.map +1 -1
  139. package/build/hooks/font-size.js +4 -2
  140. package/build/hooks/font-size.js.map +1 -1
  141. package/build/hooks/gap.js +77 -5
  142. package/build/hooks/gap.js.map +1 -1
  143. package/build/hooks/layout.js +7 -2
  144. package/build/hooks/layout.js.map +1 -1
  145. package/build/hooks/style.js +34 -3
  146. package/build/hooks/style.js.map +1 -1
  147. package/build/hooks/utils.js +29 -0
  148. package/build/hooks/utils.js.map +1 -1
  149. package/build/layouts/flex.js +82 -15
  150. package/build/layouts/flex.js.map +1 -1
  151. package/build/layouts/flow.js +22 -13
  152. package/build/layouts/flow.js.map +1 -1
  153. package/build/store/actions.js +297 -51
  154. package/build/store/actions.js.map +1 -1
  155. package/build/store/defaults.js +5 -1
  156. package/build/store/defaults.js.map +1 -1
  157. package/build/store/reducer.js +25 -13
  158. package/build/store/reducer.js.map +1 -1
  159. package/build/store/selectors.js +171 -21
  160. package/build/store/selectors.js.map +1 -1
  161. package/build/utils/dom.js +2 -1
  162. package/build/utils/dom.js.map +1 -1
  163. package/build-module/components/alignment-control/index.js +12 -4
  164. package/build-module/components/alignment-control/index.js.map +1 -1
  165. package/build-module/components/block-alignment-control/index.js +12 -4
  166. package/build-module/components/block-alignment-control/index.js.map +1 -1
  167. package/build-module/components/block-draggable/index.js +2 -3
  168. package/build-module/components/block-draggable/index.js.map +1 -1
  169. package/build-module/components/block-icon/index.js +4 -0
  170. package/build-module/components/block-icon/index.js.map +1 -1
  171. package/build-module/components/block-inspector/index.js +6 -1
  172. package/build-module/components/block-inspector/index.js.map +1 -1
  173. package/build-module/components/block-list/block-html.js +5 -2
  174. package/build-module/components/block-list/block-html.js.map +1 -1
  175. package/build-module/components/block-list/block.js +5 -2
  176. package/build-module/components/block-list/block.js.map +1 -1
  177. package/build-module/components/block-list/use-block-props/index.js +1 -4
  178. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  179. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +22 -6
  180. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  181. package/build-module/components/block-list/use-block-props/use-focus-handler.js +7 -1
  182. package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  183. package/build-module/components/block-list-appender/index.js +6 -1
  184. package/build-module/components/block-list-appender/index.js.map +1 -1
  185. package/build-module/components/block-lock/index.js +4 -0
  186. package/build-module/components/block-lock/index.js.map +1 -0
  187. package/build-module/components/block-lock/menu-item.js +53 -0
  188. package/build-module/components/block-lock/menu-item.js.map +1 -0
  189. package/build-module/components/block-lock/modal.js +119 -0
  190. package/build-module/components/block-lock/modal.js.map +1 -0
  191. package/build-module/components/block-lock/toolbar.js +63 -0
  192. package/build-module/components/block-lock/toolbar.js.map +1 -0
  193. package/build-module/components/block-mover/index.js +4 -0
  194. package/build-module/components/block-mover/index.js.map +1 -1
  195. package/build-module/components/block-settings-menu/block-settings-dropdown.js +75 -12
  196. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  197. package/build-module/components/block-settings-menu-controls/index.js +18 -9
  198. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  199. package/build-module/components/block-switcher/index.js +2 -2
  200. package/build-module/components/block-switcher/index.js.map +1 -1
  201. package/build-module/components/block-title/index.js +2 -2
  202. package/build-module/components/block-title/index.js.map +1 -1
  203. package/build-module/components/block-title/use-block-display-title.js +8 -6
  204. package/build-module/components/block-title/use-block-display-title.js.map +1 -1
  205. package/build-module/components/block-toolbar/block-name-context.js +9 -0
  206. package/build-module/components/block-toolbar/block-name-context.js.map +1 -0
  207. package/build-module/components/block-toolbar/block-toolbar-last-item.js +11 -0
  208. package/build-module/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
  209. package/build-module/components/block-toolbar/index.js +19 -4
  210. package/build-module/components/block-toolbar/index.js.map +1 -1
  211. package/build-module/components/block-tools/index.js +0 -16
  212. package/build-module/components/block-tools/index.js.map +1 -1
  213. package/build-module/components/block-variation-transforms/index.js +95 -49
  214. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  215. package/build-module/components/block-vertical-alignment-control/index.js +12 -4
  216. package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
  217. package/build-module/components/border-radius-control/index.js +0 -1
  218. package/build-module/components/border-radius-control/index.js.map +1 -1
  219. package/build-module/components/border-radius-control/utils.js +1 -1
  220. package/build-module/components/border-radius-control/utils.js.map +1 -1
  221. package/build-module/components/colors-gradients/control.js +3 -1
  222. package/build-module/components/colors-gradients/control.js.map +1 -1
  223. package/build-module/components/contrast-checker/index.js +4 -0
  224. package/build-module/components/contrast-checker/index.js.map +1 -1
  225. package/build-module/components/convert-to-group-buttons/index.js +2 -1
  226. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  227. package/build-module/components/convert-to-group-buttons/toolbar.js +90 -0
  228. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -0
  229. package/build-module/components/copy-handler/index.js +4 -0
  230. package/build-module/components/copy-handler/index.js.map +1 -1
  231. package/build-module/components/date-format-picker/index.js +122 -0
  232. package/build-module/components/date-format-picker/index.js.map +1 -0
  233. package/build-module/components/font-sizes/font-size-picker.js +4 -0
  234. package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
  235. package/build-module/components/iframe/index.js +6 -9
  236. package/build-module/components/iframe/index.js.map +1 -1
  237. package/build-module/components/index.js +3 -0
  238. package/build-module/components/index.js.map +1 -1
  239. package/build-module/components/justify-content-control/index.js +12 -4
  240. package/build-module/components/justify-content-control/index.js.map +1 -1
  241. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  242. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  243. package/build-module/components/line-height-control/index.js +14 -5
  244. package/build-module/components/line-height-control/index.js.map +1 -1
  245. package/build-module/components/list-view/block-select-button.js +24 -23
  246. package/build-module/components/list-view/block-select-button.js.map +1 -1
  247. package/build-module/components/list-view/block.js +36 -13
  248. package/build-module/components/list-view/block.js.map +1 -1
  249. package/build-module/components/list-view/branch.js +16 -13
  250. package/build-module/components/list-view/branch.js.map +1 -1
  251. package/build-module/components/list-view/index.js +7 -1
  252. package/build-module/components/list-view/index.js.map +1 -1
  253. package/build-module/components/list-view/use-block-selection.js +10 -3
  254. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  255. package/build-module/components/media-replace-flow/index.js +4 -0
  256. package/build-module/components/media-replace-flow/index.js.map +1 -1
  257. package/build-module/components/multi-selection-inspector/index.js +2 -2
  258. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  259. package/build-module/components/rich-text/index.js +26 -5
  260. package/build-module/components/rich-text/index.js.map +1 -1
  261. package/build-module/components/rich-text/index.native.js +13 -9
  262. package/build-module/components/rich-text/index.native.js.map +1 -1
  263. package/build-module/components/rich-text/split-value.js +12 -2
  264. package/build-module/components/rich-text/split-value.js.map +1 -1
  265. package/build-module/components/rich-text/use-firefox-compat.js +39 -0
  266. package/build-module/components/rich-text/use-firefox-compat.js.map +1 -0
  267. package/build-module/components/rich-text/use-input-rules.js +35 -4
  268. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  269. package/build-module/components/skip-to-selected-block/index.js +4 -0
  270. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  271. package/build-module/components/url-popover/image-url-input-ui.js +12 -28
  272. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  273. package/build-module/components/writing-flow/index.js +5 -1
  274. package/build-module/components/writing-flow/index.js.map +1 -1
  275. package/build-module/components/writing-flow/use-arrow-nav.js +4 -45
  276. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  277. package/build-module/components/writing-flow/use-click-selection.js +57 -0
  278. package/build-module/components/writing-flow/use-click-selection.js.map +1 -0
  279. package/build-module/components/writing-flow/use-drag-selection.js +124 -0
  280. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -0
  281. package/build-module/components/writing-flow/use-input.js +104 -0
  282. package/build-module/components/writing-flow/use-input.js.map +1 -0
  283. package/build-module/components/writing-flow/use-multi-selection.js +18 -37
  284. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  285. package/build-module/components/writing-flow/use-selection-observer.js +150 -0
  286. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -0
  287. package/build-module/components/writing-flow/use-tab-nav.js +1 -9
  288. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  289. package/build-module/hooks/anchor.js +7 -6
  290. package/build-module/hooks/anchor.js.map +1 -1
  291. package/build-module/hooks/border-color.js +5 -5
  292. package/build-module/hooks/border-color.js.map +1 -1
  293. package/build-module/hooks/border.js +0 -12
  294. package/build-module/hooks/border.js.map +1 -1
  295. package/build-module/hooks/color.js +19 -18
  296. package/build-module/hooks/color.js.map +1 -1
  297. package/build-module/hooks/font-family.js +3 -1
  298. package/build-module/hooks/font-family.js.map +1 -1
  299. package/build-module/hooks/font-size.js +4 -3
  300. package/build-module/hooks/font-size.js.map +1 -1
  301. package/build-module/hooks/gap.js +75 -7
  302. package/build-module/hooks/gap.js.map +1 -1
  303. package/build-module/hooks/layout.js +7 -2
  304. package/build-module/hooks/layout.js.map +1 -1
  305. package/build-module/hooks/style.js +33 -3
  306. package/build-module/hooks/style.js.map +1 -1
  307. package/build-module/hooks/utils.js +26 -0
  308. package/build-module/hooks/utils.js.map +1 -1
  309. package/build-module/layouts/flex.js +81 -16
  310. package/build-module/layouts/flex.js.map +1 -1
  311. package/build-module/layouts/flow.js +20 -13
  312. package/build-module/layouts/flow.js.map +1 -1
  313. package/build-module/store/actions.js +286 -49
  314. package/build-module/store/actions.js.map +1 -1
  315. package/build-module/store/defaults.js +5 -1
  316. package/build-module/store/defaults.js.map +1 -1
  317. package/build-module/store/reducer.js +25 -13
  318. package/build-module/store/reducer.js.map +1 -1
  319. package/build-module/store/selectors.js +162 -20
  320. package/build-module/store/selectors.js.map +1 -1
  321. package/build-module/utils/dom.js +2 -1
  322. package/build-module/utils/dom.js.map +1 -1
  323. package/build-style/style-rtl.css +214 -24
  324. package/build-style/style.css +214 -24
  325. package/build-types/utils/dom.d.ts.map +1 -1
  326. package/package.json +28 -27
  327. package/src/components/alignment-control/index.js +9 -4
  328. package/src/components/block-alignment-control/index.js +9 -4
  329. package/src/components/block-draggable/index.js +2 -5
  330. package/src/components/block-icon/index.js +3 -0
  331. package/src/components/block-inspector/index.js +4 -0
  332. package/src/components/block-list/block-html.js +8 -4
  333. package/src/components/block-list/block.js +5 -1
  334. package/src/components/block-list/style.scss +4 -5
  335. package/src/components/block-list/use-block-props/index.js +0 -5
  336. package/src/components/block-list/use-block-props/use-focus-first-element.js +27 -6
  337. package/src/components/block-list/use-block-props/use-focus-handler.js +8 -0
  338. package/src/components/block-list-appender/index.js +5 -0
  339. package/src/components/block-lock/index.js +3 -0
  340. package/src/components/block-lock/menu-item.js +59 -0
  341. package/src/components/block-lock/modal.js +170 -0
  342. package/src/components/block-lock/style.scss +70 -0
  343. package/src/components/block-lock/toolbar.js +68 -0
  344. package/src/components/block-mover/index.js +3 -0
  345. package/src/components/block-mover/style.scss +4 -0
  346. package/src/components/block-settings-menu/block-settings-dropdown.js +109 -9
  347. package/src/components/block-settings-menu-controls/index.js +33 -12
  348. package/src/components/block-switcher/index.js +2 -2
  349. package/src/components/block-switcher/style.scss +8 -1
  350. package/src/components/block-switcher/test/index.js +2 -2
  351. package/src/components/block-title/README.md +6 -1
  352. package/src/components/block-title/index.js +2 -2
  353. package/src/components/block-title/test/index.js +43 -1
  354. package/src/components/block-title/use-block-display-title.js +10 -7
  355. package/src/components/block-toolbar/block-name-context.js +8 -0
  356. package/src/components/block-toolbar/block-toolbar-last-item.js +12 -0
  357. package/src/components/block-toolbar/index.js +24 -2
  358. package/src/components/block-toolbar/style.scss +10 -0
  359. package/src/components/block-tools/index.js +0 -19
  360. package/src/components/block-tools/style.scss +27 -0
  361. package/src/components/block-variation-transforms/index.js +105 -36
  362. package/src/components/block-variation-transforms/style.scss +1 -1
  363. package/src/components/block-vertical-alignment-control/index.js +9 -4
  364. package/src/components/border-radius-control/index.js +0 -1
  365. package/src/components/border-radius-control/test/utils.js +4 -0
  366. package/src/components/border-radius-control/utils.js +2 -1
  367. package/src/components/button-block-appender/style.scss +5 -1
  368. package/src/components/color-palette/test/__snapshots__/control.js.snap +70 -4
  369. package/src/components/colors-gradients/control.js +1 -1
  370. package/src/components/colors-gradients/style.scss +6 -0
  371. package/src/components/contrast-checker/index.js +3 -0
  372. package/src/components/convert-to-group-buttons/index.js +6 -1
  373. package/src/components/convert-to-group-buttons/toolbar.js +87 -0
  374. package/src/components/copy-handler/index.js +3 -0
  375. package/src/components/date-format-picker/README.md +58 -0
  376. package/src/components/date-format-picker/index.js +161 -0
  377. package/src/components/date-format-picker/style.scss +31 -0
  378. package/src/components/font-sizes/font-size-picker.js +3 -0
  379. package/src/components/iframe/index.js +5 -7
  380. package/src/components/index.js +3 -0
  381. package/src/components/justify-content-control/index.js +9 -4
  382. package/src/components/keyboard-shortcuts/index.js +1 -1
  383. package/src/components/line-height-control/index.js +11 -6
  384. package/src/components/link-control/README.md +1 -1
  385. package/src/components/list-view/block-select-button.js +21 -30
  386. package/src/components/list-view/block.js +55 -13
  387. package/src/components/list-view/branch.js +37 -15
  388. package/src/components/list-view/index.js +6 -0
  389. package/src/components/list-view/style.scss +56 -14
  390. package/src/components/list-view/use-block-selection.js +15 -2
  391. package/src/components/media-placeholder/README.md +8 -0
  392. package/src/components/media-replace-flow/index.js +3 -0
  393. package/src/components/multi-selection-inspector/index.js +2 -2
  394. package/src/components/rich-text/index.js +25 -2
  395. package/src/components/rich-text/index.native.js +24 -8
  396. package/src/components/rich-text/split-value.js +5 -1
  397. package/src/components/rich-text/use-firefox-compat.js +39 -0
  398. package/src/components/rich-text/use-input-rules.js +40 -3
  399. package/src/components/skip-to-selected-block/index.js +3 -0
  400. package/src/components/url-input/style.scss +3 -2
  401. package/src/components/url-popover/image-url-input-ui.js +16 -29
  402. package/src/components/writing-flow/index.js +8 -0
  403. package/src/components/writing-flow/readme.md +28 -0
  404. package/src/components/writing-flow/use-arrow-nav.js +4 -53
  405. package/src/components/writing-flow/use-click-selection.js +65 -0
  406. package/src/components/writing-flow/use-drag-selection.js +126 -0
  407. package/src/components/writing-flow/use-input.js +112 -0
  408. package/src/components/writing-flow/use-multi-selection.js +13 -36
  409. package/src/components/writing-flow/use-selection-observer.js +153 -0
  410. package/src/components/writing-flow/use-tab-nav.js +1 -11
  411. package/src/hooks/anchor.js +8 -6
  412. package/src/hooks/border-color.js +5 -5
  413. package/src/hooks/border.js +0 -13
  414. package/src/hooks/color.js +51 -24
  415. package/src/hooks/font-family.js +5 -2
  416. package/src/hooks/font-size.js +10 -7
  417. package/src/hooks/gap.js +91 -12
  418. package/src/hooks/layout.js +11 -1
  419. package/src/hooks/style.js +40 -4
  420. package/src/hooks/test/gap.js +66 -0
  421. package/src/hooks/test/style.js +94 -0
  422. package/src/hooks/test/utils.js +1 -1
  423. package/src/hooks/utils.js +26 -0
  424. package/src/layouts/flex.js +93 -6
  425. package/src/layouts/flow.js +28 -12
  426. package/src/store/actions.js +349 -32
  427. package/src/store/defaults.js +7 -1
  428. package/src/store/reducer.js +25 -10
  429. package/src/store/selectors.js +207 -25
  430. package/src/store/test/selectors.js +305 -5
  431. package/src/style.scss +2 -0
  432. package/src/utils/dom.js +2 -1
  433. package/tsconfig.tsbuildinfo +1 -1
  434. package/build/components/block-list/use-block-props/use-multi-selection.js +0 -205
  435. package/build/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
  436. package/build/components/block-list/use-block-props/use-scroll-into-view.js +0 -77
  437. package/build/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
  438. package/build-module/components/block-list/use-block-props/use-multi-selection.js +0 -192
  439. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
  440. package/build-module/components/block-list/use-block-props/use-scroll-into-view.js +0 -63
  441. package/build-module/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
  442. package/src/components/block-list/use-block-props/use-multi-selection.js +0 -227
  443. package/src/components/block-list/use-block-props/use-scroll-into-view.js +0 -73
@@ -6,12 +6,17 @@ import { castArray, flow, noop } from 'lodash';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { __, sprintf } from '@wordpress/i18n';
9
+ import { getBlockType, serialize } from '@wordpress/blocks';
10
10
  import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
11
- import { useSelect } from '@wordpress/data';
11
+ import { useDispatch, useSelect } from '@wordpress/data';
12
12
  import { moreVertical } from '@wordpress/icons';
13
- import { Children, cloneElement, useCallback } from '@wordpress/element';
14
- import { serialize } from '@wordpress/blocks';
13
+ import {
14
+ Children,
15
+ cloneElement,
16
+ useCallback,
17
+ useRef,
18
+ } from '@wordpress/element';
19
+ import { __, sprintf } from '@wordpress/i18n';
15
20
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
16
21
  import { useCopyToClipboard } from '@wordpress/compose';
17
22
 
@@ -19,12 +24,14 @@ import { useCopyToClipboard } from '@wordpress/compose';
19
24
  * Internal dependencies
20
25
  */
21
26
  import BlockActions from '../block-actions';
27
+ import BlockIcon from '../block-icon';
22
28
  import BlockModeToggle from './block-mode-toggle';
23
29
  import BlockHTMLConvertButton from './block-html-convert-button';
24
30
  import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
25
31
  import BlockSettingsMenuControls from '../block-settings-menu-controls';
26
32
  import { store as blockEditorStore } from '../../store';
27
33
  import useBlockDisplayTitle from '../block-title/use-block-display-title';
34
+ import { useShowMoversGestures } from '../block-toolbar/utils';
28
35
 
29
36
  const POPOVER_PROPS = {
30
37
  className: 'block-editor-block-settings-menu__popover',
@@ -46,11 +53,40 @@ export function BlockSettingsDropdown( {
46
53
  const blockClientIds = castArray( clientIds );
47
54
  const count = blockClientIds.length;
48
55
  const firstBlockClientId = blockClientIds[ 0 ];
49
- const { onlyBlock } = useSelect(
56
+ const {
57
+ firstParentClientId,
58
+ hasReducedUI,
59
+ onlyBlock,
60
+ parentBlockType,
61
+ previousBlockClientId,
62
+ nextBlockClientId,
63
+ selectedBlockClientIds,
64
+ } = useSelect(
50
65
  ( select ) => {
51
- const { getBlockCount } = select( blockEditorStore );
66
+ const {
67
+ getBlockCount,
68
+ getBlockName,
69
+ getBlockParents,
70
+ getPreviousBlockClientId,
71
+ getNextBlockClientId,
72
+ getSelectedBlockClientIds,
73
+ getSettings,
74
+ } = select( blockEditorStore );
75
+
76
+ const parents = getBlockParents( firstBlockClientId );
77
+ const _firstParentClientId = parents[ parents.length - 1 ];
78
+ const parentBlockName = getBlockName( _firstParentClientId );
79
+
52
80
  return {
81
+ firstParentClientId: _firstParentClientId,
82
+ hasReducedUI: getSettings().hasReducedUI,
53
83
  onlyBlock: 1 === getBlockCount(),
84
+ parentBlockType: getBlockType( parentBlockName ),
85
+ previousBlockClientId: getPreviousBlockClientId(
86
+ firstBlockClientId
87
+ ),
88
+ nextBlockClientId: getNextBlockClientId( firstBlockClientId ),
89
+ selectedBlockClientIds: getSelectedBlockClientIds(),
54
90
  };
55
91
  },
56
92
  [ firstBlockClientId ]
@@ -72,7 +108,11 @@ export function BlockSettingsDropdown( {
72
108
  };
73
109
  }, [] );
74
110
 
75
- const updateSelection = useCallback(
111
+ const { selectBlock, toggleBlockHighlight } = useDispatch(
112
+ blockEditorStore
113
+ );
114
+
115
+ const updateSelectionAfterDuplicate = useCallback(
76
116
  __experimentalSelectBlock
77
117
  ? async ( clientIdsPromise ) => {
78
118
  const ids = await clientIdsPromise;
@@ -86,6 +126,33 @@ export function BlockSettingsDropdown( {
86
126
 
87
127
  const blockTitle = useBlockDisplayTitle( firstBlockClientId, 25 );
88
128
 
129
+ const updateSelectionAfterRemove = useCallback(
130
+ __experimentalSelectBlock
131
+ ? () => {
132
+ const blockToSelect =
133
+ previousBlockClientId || nextBlockClientId;
134
+
135
+ if (
136
+ blockToSelect &&
137
+ // From the block options dropdown, it's possible to remove a block that is not selected,
138
+ // in this case, it's not necessary to update the selection since the selected block wasn't removed.
139
+ selectedBlockClientIds.includes( firstBlockClientId ) &&
140
+ // Don't update selection when next/prev block also is in the selection ( and gets removed ),
141
+ // In case someone selects all blocks and removes them at once.
142
+ ! selectedBlockClientIds.includes( blockToSelect )
143
+ ) {
144
+ __experimentalSelectBlock( blockToSelect );
145
+ }
146
+ }
147
+ : noop,
148
+ [
149
+ __experimentalSelectBlock,
150
+ previousBlockClientId,
151
+ nextBlockClientId,
152
+ selectedBlockClientIds,
153
+ ]
154
+ );
155
+
89
156
  const label = sprintf(
90
157
  /* translators: %s: block name */
91
158
  __( 'Remove %s' ),
@@ -93,6 +160,19 @@ export function BlockSettingsDropdown( {
93
160
  );
94
161
  const removeBlockLabel = count === 1 ? label : __( 'Remove blocks' );
95
162
 
163
+ // Allows highlighting the parent block outline when focusing or hovering
164
+ // the parent block selector within the child.
165
+ const selectParentButtonRef = useRef();
166
+ const { gestures: showParentOutlineGestures } = useShowMoversGestures( {
167
+ ref: selectParentButtonRef,
168
+ onChange( isFocused ) {
169
+ if ( isFocused && hasReducedUI ) {
170
+ return;
171
+ }
172
+ toggleBlockHighlight( firstParentClientId, isFocused );
173
+ },
174
+ } );
175
+
96
176
  return (
97
177
  <BlockActions
98
178
  clientIds={ clientIds }
@@ -125,6 +205,26 @@ export function BlockSettingsDropdown( {
125
205
  <__unstableBlockSettingsMenuFirstItem.Slot
126
206
  fillProps={ { onClose } }
127
207
  />
208
+ { firstParentClientId !== undefined && (
209
+ <MenuItem
210
+ { ...showParentOutlineGestures }
211
+ ref={ selectParentButtonRef }
212
+ icon={
213
+ <BlockIcon
214
+ icon={ parentBlockType.icon }
215
+ />
216
+ }
217
+ onClick={ () =>
218
+ selectBlock( firstParentClientId )
219
+ }
220
+ >
221
+ { sprintf(
222
+ /* translators: %s: Name of the block's parent. */
223
+ __( 'Select parent block (%s)' ),
224
+ parentBlockType.title
225
+ ) }
226
+ </MenuItem>
227
+ ) }
128
228
  { count === 1 && (
129
229
  <BlockHTMLConvertButton
130
230
  clientId={ firstBlockClientId }
@@ -139,7 +239,7 @@ export function BlockSettingsDropdown( {
139
239
  onClick={ flow(
140
240
  onClose,
141
241
  onDuplicate,
142
- updateSelection
242
+ updateSelectionAfterDuplicate
143
243
  ) }
144
244
  shortcut={ shortcuts.duplicate }
145
245
  >
@@ -197,7 +297,7 @@ export function BlockSettingsDropdown( {
197
297
  onClick={ flow(
198
298
  onClose,
199
299
  onRemove,
200
- updateSelection
300
+ updateSelectionAfterRemove
201
301
  ) }
202
302
  shortcut={ shortcuts.remove }
203
303
  >
@@ -20,16 +20,19 @@ import {
20
20
  useConvertToGroupButtonProps,
21
21
  ConvertToGroupButton,
22
22
  } from '../convert-to-group-buttons';
23
+ import { BlockLockMenuItem } from '../block-lock';
23
24
  import { store as blockEditorStore } from '../../store';
24
25
 
25
26
  const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
26
27
 
27
28
  const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
28
- const { selectedBlocks, selectedClientIds } = useSelect(
29
+ const { selectedBlocks, selectedClientIds, canRemove } = useSelect(
29
30
  ( select ) => {
30
- const { getBlocksByClientId, getSelectedBlockClientIds } = select(
31
- blockEditorStore
32
- );
31
+ const {
32
+ getBlocksByClientId,
33
+ getSelectedBlockClientIds,
34
+ canRemoveBlocks,
35
+ } = select( blockEditorStore );
33
36
  const ids =
34
37
  clientIds !== null ? clientIds : getSelectedBlockClientIds();
35
38
  return {
@@ -38,30 +41,48 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
38
41
  ( block ) => block.name
39
42
  ),
40
43
  selectedClientIds: ids,
44
+ canRemove: canRemoveBlocks( ids ),
41
45
  };
42
46
  },
43
47
  [ clientIds ]
44
48
  );
45
49
 
50
+ const showLockButton = selectedClientIds.length === 1;
51
+
46
52
  // Check if current selection of blocks is Groupable or Ungroupable
47
53
  // and pass this props down to ConvertToGroupButton.
48
54
  const convertToGroupButtonProps = useConvertToGroupButtonProps();
49
55
  const { isGroupable, isUngroupable } = convertToGroupButtonProps;
50
- const showConvertToGroupButton = isGroupable || isUngroupable;
56
+ const showConvertToGroupButton =
57
+ ( isGroupable || isUngroupable ) && canRemove;
58
+
51
59
  return (
52
60
  <Slot fillProps={ { ...fillProps, selectedBlocks, selectedClientIds } }>
53
61
  { ( fills ) => {
54
- if ( fills?.length > 0 || showConvertToGroupButton ) {
55
- return (
56
- <MenuGroup>
57
- { fills }
62
+ if (
63
+ ! fills?.length > 0 &&
64
+ ! showConvertToGroupButton &&
65
+ ! showLockButton
66
+ ) {
67
+ return null;
68
+ }
69
+
70
+ return (
71
+ <MenuGroup>
72
+ { showLockButton && (
73
+ <BlockLockMenuItem
74
+ clientId={ selectedClientIds[ 0 ] }
75
+ />
76
+ ) }
77
+ { fills }
78
+ { showConvertToGroupButton && (
58
79
  <ConvertToGroupButton
59
80
  { ...convertToGroupButtonProps }
60
81
  onClose={ fillProps?.onClose }
61
82
  />
62
- </MenuGroup>
63
- );
64
- }
83
+ ) }
84
+ </MenuGroup>
85
+ );
65
86
  } }
66
87
  </Slot>
67
88
  );
@@ -20,7 +20,7 @@ import {
20
20
  isTemplatePart,
21
21
  } from '@wordpress/blocks';
22
22
  import { useSelect, useDispatch } from '@wordpress/data';
23
- import { stack } from '@wordpress/icons';
23
+ import { copy } from '@wordpress/icons';
24
24
 
25
25
  /**
26
26
  * Internal dependencies
@@ -69,7 +69,7 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
69
69
  // appropriate icon to communicate the non-uniformity.
70
70
  _icon = isSelectionOfSameType
71
71
  ? getBlockType( firstBlockName )?.icon
72
- : stack;
72
+ : copy;
73
73
  }
74
74
  return {
75
75
  possibleBlockTransformations: getBlockTransformItems(
@@ -1,5 +1,13 @@
1
1
  .block-editor-block-switcher {
2
2
  position: relative;
3
+ padding: 0 ($grid-unit-15 * 0.5);
4
+
5
+ // @todo: override toolbar group inherited paddings from components/block-tools/style.scss.
6
+ // This is best fixed by making the mover control area a proper single toolbar group.
7
+ // It needs specificity due to style inherited from .components-accessible-toolbar .components-button.has-icon.has-icon.
8
+ .components-button.components-dropdown-menu__toggle.has-icon.has-icon {
9
+ min-width: $button-size;
10
+ }
3
11
  }
4
12
 
5
13
  // Show an indicator triangle.
@@ -8,7 +16,6 @@
8
16
  position: relative;
9
17
  }
10
18
 
11
-
12
19
  .components-button.block-editor-block-switcher__toggle,
13
20
  .components-button.block-editor-block-switcher__no-switcher-icon {
14
21
  margin: 0;
@@ -10,7 +10,7 @@ import { useSelect } from '@wordpress/data';
10
10
  import { registerBlockType, unregisterBlockType } from '@wordpress/blocks';
11
11
  import { DOWN } from '@wordpress/keycodes';
12
12
  import { Button } from '@wordpress/components';
13
- import { stack } from '@wordpress/icons';
13
+ import { copy } from '@wordpress/icons';
14
14
 
15
15
  /**
16
16
  * Internal dependencies
@@ -131,7 +131,7 @@ describe( 'BlockSwitcherDropdownMenu', () => {
131
131
  test( 'should render disabled block switcher with multi block of different types when no transforms', () => {
132
132
  useSelect.mockImplementation( () => ( {
133
133
  possibleBlockTransformations: [],
134
- icon: stack,
134
+ icon: copy,
135
135
  } ) );
136
136
  const wrapper = shallow(
137
137
  <BlockSwitcherDropdownMenu
@@ -1,6 +1,11 @@
1
1
  # Block Title
2
2
 
3
- Renders the block's configured title as a string, or empty if the title cannot be determined.
3
+ The Block Title component renders a block's configured title as a string.
4
+
5
+ It prioritizes contextual titles such as block variation and reusable block labels when returning a value. If none is found, it will return the display title specified in the block's metadata.
6
+
7
+ The component will be empty if a title cannot be determined.
8
+
4
9
 
5
10
  ## Usage
6
11
 
@@ -14,8 +14,8 @@ import useBlockDisplayTitle from './use-block-display-title';
14
14
  * <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" maximumLength={ 17 }/>
15
15
  * ```
16
16
  *
17
- * @param {Object} props
18
- * @param {string} props.clientId Client ID of block.
17
+ * @param {Object} props
18
+ * @param {string} props.clientId Client ID of block.
19
19
  * @param {number|undefined} props.maximumLength The maximum length that the block title string may be before truncated.
20
20
  *
21
21
  * @return {JSX.Element} Block title.
@@ -26,6 +26,9 @@ jest.mock( '@wordpress/blocks', () => {
26
26
  case 'name-with-label':
27
27
  return { title: 'Block With Label' };
28
28
 
29
+ case 'name-with-custom-label':
30
+ return { title: 'Block With Custom Label' };
31
+
29
32
  case 'name-with-long-label':
30
33
  return { title: 'Block With Long Label' };
31
34
  }
@@ -38,6 +41,9 @@ jest.mock( '@wordpress/blocks', () => {
38
41
  case 'Block With Long Label':
39
42
  return 'This is a longer label than typical for blocks to have.';
40
43
 
44
+ case 'Block With Custom Label':
45
+ return 'A Custom Label like a Block Variation Label';
46
+
41
47
  default:
42
48
  return title;
43
49
  }
@@ -61,7 +67,7 @@ jest.mock( '@wordpress/data/src/components/use-select', () => {
61
67
  } );
62
68
 
63
69
  describe( 'BlockTitle', () => {
64
- it( 'renders nothing if name is falsey2', () => {
70
+ it( 'renders nothing if name is falsey', () => {
65
71
  useSelect.mockImplementation( () => ( {
66
72
  name: null,
67
73
  attributes: null,
@@ -106,6 +112,42 @@ describe( 'BlockTitle', () => {
106
112
  expect( wrapper.text() ).toBe( 'Test Label' );
107
113
  } );
108
114
 
115
+ it( 'should prioritize reusable block title over title', () => {
116
+ useSelect.mockImplementation( () => ( {
117
+ name: 'name-with-label',
118
+ reusableBlockTitle: 'Reuse me!',
119
+ attributes: null,
120
+ } ) );
121
+
122
+ const wrapper = shallow( <BlockTitle clientId="id-name-with-label" /> );
123
+
124
+ expect( wrapper.text() ).toBe( 'Reuse me!' );
125
+ } );
126
+
127
+ it( 'should prioritize block label over title', () => {
128
+ useSelect.mockImplementation( () => ( {
129
+ name: 'name-with-custom-label',
130
+ attributes: null,
131
+ } ) );
132
+
133
+ const wrapper = shallow( <BlockTitle clientId="id-name-with-label" /> );
134
+
135
+ expect( wrapper.text() ).toBe(
136
+ 'A Custom Label like a Block Variation Label'
137
+ );
138
+ } );
139
+
140
+ it( 'should default to block information title if no reusable title or block name is available', () => {
141
+ useSelect.mockImplementation( () => ( {
142
+ name: 'some-rando-name',
143
+ attributes: null,
144
+ } ) );
145
+
146
+ const wrapper = shallow( <BlockTitle clientId="id-name-with-label" /> );
147
+
148
+ expect( wrapper.text() ).toBe( 'Block With Label' );
149
+ } );
150
+
109
151
  it( 'truncates the label with custom truncate length', () => {
110
152
  useSelect.mockImplementation( () => ( {
111
153
  name: 'name-with-long-label',
@@ -29,7 +29,7 @@ import { store as blockEditorStore } from '../../store';
29
29
  * useBlockDisplayTitle( 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1', 17 );
30
30
  * ```
31
31
  *
32
- * @param {string} clientId Client ID of block.
32
+ * @param {string} clientId Client ID of block.
33
33
  * @param {number|undefined} maximumLength The maximum length that the block title string may be before truncated.
34
34
  * @return {?string} Block title.
35
35
  */
@@ -70,14 +70,17 @@ export default function useBlockDisplayTitle( clientId, maximumLength ) {
70
70
  const blockLabel = blockType
71
71
  ? getBlockLabel( blockType, attributes )
72
72
  : null;
73
+
73
74
  const label = reusableBlockTitle || blockLabel;
74
75
  // Label will fallback to the title if no label is defined for the current
75
- // label context. If the label is defined we prioritize it over possible
76
+ // label context. If the label is defined we prioritize it over a
76
77
  // possible block variation title match.
77
- if ( label && label !== blockType.title ) {
78
- return maximumLength && maximumLength > 0
79
- ? truncate( label, { length: maximumLength } )
80
- : label;
78
+ const blockTitle =
79
+ label && label !== blockType.title ? label : blockInformation.title;
80
+
81
+ if ( maximumLength && maximumLength > 0 ) {
82
+ return truncate( blockTitle, { length: maximumLength } );
81
83
  }
82
- return blockInformation.title;
84
+
85
+ return blockTitle;
83
86
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { createContext } from '@wordpress/element';
5
+
6
+ const __unstableBlockNameContext = createContext( '' );
7
+
8
+ export default __unstableBlockNameContext;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { createSlotFill } from '@wordpress/components';
5
+
6
+ const { Fill: __unstableBlockToolbarLastItem, Slot } = createSlotFill(
7
+ '__unstableBlockToolbarLastItem'
8
+ );
9
+
10
+ __unstableBlockToolbarLastItem.Slot = Slot;
11
+
12
+ export default __unstableBlockToolbarLastItem;
@@ -19,11 +19,15 @@ import BlockMover from '../block-mover';
19
19
  import BlockParentSelector from '../block-parent-selector';
20
20
  import BlockSwitcher from '../block-switcher';
21
21
  import BlockControls from '../block-controls';
22
+ import __unstableBlockToolbarLastItem from './block-toolbar-last-item';
22
23
  import BlockSettingsMenu from '../block-settings-menu';
24
+ import { BlockLockToolbar } from '../block-lock';
25
+ import { BlockGroupToolbar } from '../convert-to-group-buttons';
23
26
  import { useShowMoversGestures } from './utils';
24
27
  import { store as blockEditorStore } from '../../store';
28
+ import __unstableBlockNameContext from './block-name-context';
25
29
 
26
- export default function BlockToolbar( { hideDragHandle } ) {
30
+ const BlockToolbar = ( { hideDragHandle } ) => {
27
31
  const {
28
32
  blockClientIds,
29
33
  blockClientId,
@@ -114,6 +118,11 @@ export default function BlockToolbar( { hideDragHandle } ) {
114
118
  { ( shouldShowVisualToolbar || isMultiToolbar ) && (
115
119
  <ToolbarGroup className="block-editor-block-toolbar__block-controls">
116
120
  <BlockSwitcher clientIds={ blockClientIds } />
121
+ { ! isMultiToolbar && (
122
+ <BlockLockToolbar
123
+ clientId={ blockClientIds[ 0 ] }
124
+ />
125
+ ) }
117
126
  <BlockMover
118
127
  clientIds={ blockClientIds }
119
128
  hideDragHandle={ hideDragHandle || hasReducedUI }
@@ -121,6 +130,9 @@ export default function BlockToolbar( { hideDragHandle } ) {
121
130
  </ToolbarGroup>
122
131
  ) }
123
132
  </div>
133
+ { shouldShowVisualToolbar && isMultiToolbar && (
134
+ <BlockGroupToolbar />
135
+ ) }
124
136
  { shouldShowVisualToolbar && (
125
137
  <>
126
138
  <BlockControls.Slot
@@ -140,9 +152,19 @@ export default function BlockToolbar( { hideDragHandle } ) {
140
152
  group="other"
141
153
  className="block-editor-block-toolbar__slot"
142
154
  />
155
+ <__unstableBlockNameContext.Provider
156
+ value={ blockType?.name }
157
+ >
158
+ <__unstableBlockToolbarLastItem.Slot />
159
+ </__unstableBlockNameContext.Provider>
143
160
  </>
144
161
  ) }
145
162
  <BlockSettingsMenu clientIds={ blockClientIds } />
146
163
  </div>
147
164
  );
148
- }
165
+ };
166
+
167
+ /**
168
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md
169
+ */
170
+ export default BlockToolbar;
@@ -91,6 +91,16 @@
91
91
  .block-editor-block-mover {
92
92
  margin-left: -$grid-unit-15 * 0.5;
93
93
  }
94
+
95
+ .block-editor-block-lock-toolbar {
96
+ margin-left: -$grid-unit-15 * 0.5 !important;
97
+ }
98
+
99
+ // @todo: override toolbar group inherited paddings from components/block-tools/style.scss.
100
+ // This is best fixed by making the mover control area a proper single toolbar group.
101
+ .components-toolbar-group {
102
+ padding: 0;
103
+ }
94
104
  }
95
105
 
96
106
  .block-editor-block-toolbar,
@@ -92,25 +92,6 @@ export default function BlockTools( {
92
92
  event.preventDefault();
93
93
  insertBeforeBlock( first( clientIds ) );
94
94
  }
95
- } else if (
96
- isMatch( 'core/block-editor/delete-multi-selection', event )
97
- ) {
98
- /**
99
- * Check if the target element is a text area, input or
100
- * event.defaultPrevented and return early. In all these
101
- * cases backspace could be handled elsewhere.
102
- */
103
- if (
104
- [ 'INPUT', 'TEXTAREA' ].includes( event.target.nodeName ) ||
105
- event.defaultPrevented
106
- ) {
107
- return;
108
- }
109
- const clientIds = getSelectedBlockClientIds();
110
- if ( clientIds.length > 1 ) {
111
- event.preventDefault();
112
- removeBlocks( clientIds );
113
- }
114
95
  } else if ( isMatch( 'core/block-editor/unselect', event ) ) {
115
96
  const clientIds = getSelectedBlockClientIds();
116
97
  if ( clientIds.length > 1 ) {
@@ -307,3 +307,30 @@
307
307
  .is-dragging-components-draggable .components-tooltip {
308
308
  display: none;
309
309
  }
310
+
311
+
312
+ // Size multiple sequential buttons to be optically balanced.
313
+ // Icons are 36px, as set by a 24px icon and 12px padding.
314
+ .block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot, // When a plugin adds to a slot, the segment has a `components-toolbar` class.
315
+ .block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar, // The nesting order is sometimes reversed.
316
+ .block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown, // Targets unique markup for the "Replace" button.
317
+ .block-editor-block-toolbar .components-toolbar-group {
318
+ padding-left: $grid-unit-15 * 0.5; // 6px.
319
+ padding-right: $grid-unit-15 * 0.5;
320
+
321
+ .components-button,
322
+ .components-button.has-icon.has-icon {
323
+ min-width: $block-toolbar-height - $grid-unit-15;
324
+ padding-left: $grid-unit-15 * 0.5; // 6px.
325
+ padding-right: $grid-unit-15 * 0.5;
326
+
327
+ svg {
328
+ min-width: $button-size-small; // This is the optimal icon size, and we size the whole button after this.
329
+ }
330
+
331
+ &::before {
332
+ left: 2px;
333
+ right: 2px;
334
+ }
335
+ }
336
+ }