@wordpress/block-editor 11.8.0 → 12.1.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 (454) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +16 -4
  3. package/build/components/block-controls/slot.js +12 -4
  4. package/build/components/block-controls/slot.js.map +1 -1
  5. package/build/components/block-controls/slot.native.js +10 -1
  6. package/build/components/block-controls/slot.native.js.map +1 -1
  7. package/build/components/block-draggable/index.js +11 -7
  8. package/build/components/block-draggable/index.js.map +1 -1
  9. package/build/components/block-draggable/use-scroll-when-dragging.js +2 -2
  10. package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  11. package/build/components/block-info-slot-fill/index.js +47 -0
  12. package/build/components/block-info-slot-fill/index.js.map +1 -0
  13. package/build/components/block-inspector/index.js +4 -2
  14. package/build/components/block-inspector/index.js.map +1 -1
  15. package/build/components/block-list/block-invalid-warning.native.js +15 -7
  16. package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
  17. package/build/components/block-list/block-list-item-cell.native.js +15 -2
  18. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  19. package/build/components/block-list/block-list-item.native.js +158 -195
  20. package/build/components/block-list/block-list-item.native.js.map +1 -1
  21. package/build/components/block-list/block-outline.native.js +57 -0
  22. package/build/components/block-list/block-outline.native.js.map +1 -0
  23. package/build/components/block-list/block.native.js +343 -300
  24. package/build/components/block-list/block.native.js.map +1 -1
  25. package/build/components/block-list/index.native.js +202 -298
  26. package/build/components/block-list/index.native.js.map +1 -1
  27. package/build/components/block-list/insertion-point.native.js +4 -2
  28. package/build/components/block-list/insertion-point.native.js.map +1 -1
  29. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  30. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  31. package/build/components/block-settings-menu/block-settings-dropdown.js +8 -10
  32. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  33. package/build/components/block-settings-menu-controls/index.js +15 -4
  34. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  35. package/build/components/block-toolbar/index.js +2 -1
  36. package/build/components/block-toolbar/index.js.map +1 -1
  37. package/build/components/block-tools/block-contextual-toolbar.js +40 -11
  38. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  39. package/build/components/block-tools/selected-block-popover.js +8 -30
  40. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  41. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
  42. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  43. package/build/components/editor-styles/index.js +4 -3
  44. package/build/components/editor-styles/index.js.map +1 -1
  45. package/build/components/font-sizes/fluid-utils.js +21 -14
  46. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  47. package/build/components/global-styles/advanced-panel.js +86 -0
  48. package/build/components/global-styles/advanced-panel.js.map +1 -0
  49. package/build/components/global-styles/border-panel.js +2 -32
  50. package/build/components/global-styles/border-panel.js.map +1 -1
  51. package/build/components/global-styles/color-panel.js +16 -13
  52. package/build/components/global-styles/color-panel.js.map +1 -1
  53. package/build/components/global-styles/color-panel.native.js +174 -0
  54. package/build/components/global-styles/color-panel.native.js.map +1 -0
  55. package/build/components/global-styles/dimensions-panel.js +12 -12
  56. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  57. package/build/components/global-styles/effects-panel.js +1 -1
  58. package/build/components/global-styles/effects-panel.js.map +1 -1
  59. package/build/components/global-styles/filters-panel.js +78 -14
  60. package/build/components/global-styles/filters-panel.js.map +1 -1
  61. package/build/components/global-styles/hooks.js +1 -2
  62. package/build/components/global-styles/hooks.js.map +1 -1
  63. package/build/components/global-styles/index.js +24 -0
  64. package/build/components/global-styles/index.js.map +1 -1
  65. package/build/components/global-styles/typography-panel.js +10 -10
  66. package/build/components/global-styles/typography-panel.js.map +1 -1
  67. package/build/components/global-styles/use-global-styles-output.js +114 -81
  68. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  69. package/build/components/global-styles/utils.js +30 -0
  70. package/build/components/global-styles/utils.js.map +1 -1
  71. package/build/components/image-editor/use-save-image.js +24 -8
  72. package/build/components/image-editor/use-save-image.js.map +1 -1
  73. package/build/components/index.js +7 -0
  74. package/build/components/index.js.map +1 -1
  75. package/build/components/inserter/block-types-tab.js +12 -7
  76. package/build/components/inserter/block-types-tab.js.map +1 -1
  77. package/build/components/inserter/index.js +2 -1
  78. package/build/components/inserter/index.js.map +1 -1
  79. package/build/components/inserter-draggable-blocks/index.js +5 -0
  80. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  81. package/build/components/inspector-controls/fill.js +1 -1
  82. package/build/components/inspector-controls/fill.js.map +1 -1
  83. package/build/components/inspector-controls/fill.native.js +1 -1
  84. package/build/components/inspector-controls/fill.native.js.map +1 -1
  85. package/build/components/inspector-controls/groups.js +2 -0
  86. package/build/components/inspector-controls/groups.js.map +1 -1
  87. package/build/components/inspector-controls/slot.js +3 -6
  88. package/build/components/inspector-controls/slot.js.map +1 -1
  89. package/build/components/inspector-controls/slot.native.js +1 -1
  90. package/build/components/inspector-controls/slot.native.js.map +1 -1
  91. package/build/components/inspector-controls-tabs/styles-tab.js +2 -0
  92. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  93. package/build/components/line-height-control/index.js +7 -2
  94. package/build/components/line-height-control/index.js.map +1 -1
  95. package/build/components/link-control/use-internal-input-value.js +9 -8
  96. package/build/components/link-control/use-internal-input-value.js.map +1 -1
  97. package/build/components/list-view/block-contents.js +7 -2
  98. package/build/components/list-view/block-contents.js.map +1 -1
  99. package/build/components/list-view/block-select-button.js +9 -3
  100. package/build/components/list-view/block-select-button.js.map +1 -1
  101. package/build/components/list-view/block.js +16 -25
  102. package/build/components/list-view/block.js.map +1 -1
  103. package/build/components/list-view/drop-indicator.js +37 -10
  104. package/build/components/list-view/drop-indicator.js.map +1 -1
  105. package/build/components/list-view/index.js +38 -18
  106. package/build/components/list-view/index.js.map +1 -1
  107. package/build/components/list-view/leaf.js +2 -1
  108. package/build/components/list-view/leaf.js.map +1 -1
  109. package/build/components/list-view/use-block-selection.js +1 -1
  110. package/build/components/list-view/use-block-selection.js.map +1 -1
  111. package/build/components/list-view/use-list-view-drop-zone.js +163 -11
  112. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  113. package/build/components/media-placeholder/index.js +68 -7
  114. package/build/components/media-placeholder/index.js.map +1 -1
  115. package/build/components/media-replace-flow/index.js +5 -5
  116. package/build/components/media-replace-flow/index.js.map +1 -1
  117. package/build/components/multi-selection-inspector/index.js +2 -2
  118. package/build/components/multi-selection-inspector/index.js.map +1 -1
  119. package/build/components/navigable-toolbar/index.js +12 -4
  120. package/build/components/navigable-toolbar/index.js.map +1 -1
  121. package/build/components/off-canvas-editor/appender.js +2 -7
  122. package/build/components/off-canvas-editor/appender.js.map +1 -1
  123. package/build/components/off-canvas-editor/leaf-more-menu.js +3 -1
  124. package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  125. package/build/components/preview-options/index.js +6 -1
  126. package/build/components/preview-options/index.js.map +1 -1
  127. package/build/components/spacing-sizes-control/spacing-input-control.js +1 -1
  128. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  129. package/build/components/url-input/index.js +1 -2
  130. package/build/components/url-input/index.js.map +1 -1
  131. package/build/hooks/align.js +1 -1
  132. package/build/hooks/align.js.map +1 -1
  133. package/build/hooks/border.js +1 -1
  134. package/build/hooks/border.js.map +1 -1
  135. package/build/hooks/color.js +1 -1
  136. package/build/hooks/color.js.map +1 -1
  137. package/build/hooks/content-lock-ui.js +8 -12
  138. package/build/hooks/content-lock-ui.js.map +1 -1
  139. package/build/hooks/duotone.js +29 -4
  140. package/build/hooks/duotone.js.map +1 -1
  141. package/build/hooks/index.native.js +8 -0
  142. package/build/hooks/index.native.js.map +1 -1
  143. package/build/hooks/layout.js +2 -2
  144. package/build/hooks/layout.js.map +1 -1
  145. package/build/hooks/position.js +1 -1
  146. package/build/hooks/position.js.map +1 -1
  147. package/build/hooks/style.js +1 -1
  148. package/build/hooks/style.js.map +1 -1
  149. package/build/hooks/use-editor-wrapper-styles.native.js +255 -0
  150. package/build/hooks/use-editor-wrapper-styles.native.js.map +1 -0
  151. package/build/hooks/use-typography-props.js +14 -10
  152. package/build/hooks/use-typography-props.js.map +1 -1
  153. package/build/hooks/utils.js +15 -3
  154. package/build/hooks/utils.js.map +1 -1
  155. package/build/index.native.js +31 -0
  156. package/build/index.native.js.map +1 -0
  157. package/build/private-apis.js +10 -1
  158. package/build/private-apis.js.map +1 -1
  159. package/build/store/actions.js +7 -0
  160. package/build/store/actions.js.map +1 -1
  161. package/build/utils/object.js +5 -5
  162. package/build/utils/object.js.map +1 -1
  163. package/build/utils/transform-styles/index.js +2 -2
  164. package/build/utils/transform-styles/index.js.map +1 -1
  165. package/build/utils/use-should-contextual-toolbar-show.js +72 -0
  166. package/build/utils/use-should-contextual-toolbar-show.js.map +1 -0
  167. package/build-module/components/block-controls/slot.js +11 -4
  168. package/build-module/components/block-controls/slot.js.map +1 -1
  169. package/build-module/components/block-controls/slot.native.js +9 -1
  170. package/build-module/components/block-controls/slot.native.js.map +1 -1
  171. package/build-module/components/block-draggable/index.js +10 -6
  172. package/build-module/components/block-draggable/index.js.map +1 -1
  173. package/build-module/components/block-draggable/use-scroll-when-dragging.js +2 -2
  174. package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  175. package/build-module/components/block-info-slot-fill/index.js +34 -0
  176. package/build-module/components/block-info-slot-fill/index.js.map +1 -0
  177. package/build-module/components/block-inspector/index.js +3 -2
  178. package/build-module/components/block-inspector/index.js.map +1 -1
  179. package/build-module/components/block-list/block-invalid-warning.native.js +16 -8
  180. package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
  181. package/build-module/components/block-list/block-list-item-cell.native.js +13 -2
  182. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
  183. package/build-module/components/block-list/block-list-item.native.js +160 -190
  184. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  185. package/build-module/components/block-list/block-outline.native.js +44 -0
  186. package/build-module/components/block-list/block-outline.native.js.map +1 -0
  187. package/build-module/components/block-list/block.native.js +341 -299
  188. package/build-module/components/block-list/block.native.js.map +1 -1
  189. package/build-module/components/block-list/index.native.js +203 -293
  190. package/build-module/components/block-list/index.native.js.map +1 -1
  191. package/build-module/components/block-list/insertion-point.native.js +4 -2
  192. package/build-module/components/block-list/insertion-point.native.js.map +1 -1
  193. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  194. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  195. package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -9
  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 +13 -5
  198. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  199. package/build-module/components/block-toolbar/index.js +2 -1
  200. package/build-module/components/block-toolbar/index.js.map +1 -1
  201. package/build-module/components/block-tools/block-contextual-toolbar.js +37 -11
  202. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  203. package/build-module/components/block-tools/selected-block-popover.js +8 -29
  204. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  205. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
  206. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  207. package/build-module/components/editor-styles/index.js +4 -3
  208. package/build-module/components/editor-styles/index.js.map +1 -1
  209. package/build-module/components/font-sizes/fluid-utils.js +21 -14
  210. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  211. package/build-module/components/global-styles/advanced-panel.js +74 -0
  212. package/build-module/components/global-styles/advanced-panel.js.map +1 -0
  213. package/build-module/components/global-styles/border-panel.js +2 -32
  214. package/build-module/components/global-styles/border-panel.js.map +1 -1
  215. package/build-module/components/global-styles/color-panel.js +18 -15
  216. package/build-module/components/global-styles/color-panel.js.map +1 -1
  217. package/build-module/components/global-styles/color-panel.native.js +150 -0
  218. package/build-module/components/global-styles/color-panel.native.js.map +1 -0
  219. package/build-module/components/global-styles/dimensions-panel.js +13 -13
  220. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  221. package/build-module/components/global-styles/effects-panel.js +2 -2
  222. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  223. package/build-module/components/global-styles/filters-panel.js +78 -16
  224. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  225. package/build-module/components/global-styles/hooks.js +1 -2
  226. package/build-module/components/global-styles/hooks.js.map +1 -1
  227. package/build-module/components/global-styles/index.js +3 -1
  228. package/build-module/components/global-styles/index.js.map +1 -1
  229. package/build-module/components/global-styles/typography-panel.js +11 -11
  230. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  231. package/build-module/components/global-styles/use-global-styles-output.js +112 -81
  232. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  233. package/build-module/components/global-styles/utils.js +25 -0
  234. package/build-module/components/global-styles/utils.js.map +1 -1
  235. package/build-module/components/image-editor/use-save-image.js +24 -8
  236. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  237. package/build-module/components/index.js +1 -1
  238. package/build-module/components/index.js.map +1 -1
  239. package/build-module/components/inserter/block-types-tab.js +12 -6
  240. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  241. package/build-module/components/inserter/index.js +2 -1
  242. package/build-module/components/inserter/index.js.map +1 -1
  243. package/build-module/components/inserter-draggable-blocks/index.js +4 -0
  244. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  245. package/build-module/components/inspector-controls/fill.js +1 -1
  246. package/build-module/components/inspector-controls/fill.js.map +1 -1
  247. package/build-module/components/inspector-controls/fill.native.js +1 -1
  248. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  249. package/build-module/components/inspector-controls/groups.js +2 -0
  250. package/build-module/components/inspector-controls/groups.js.map +1 -1
  251. package/build-module/components/inspector-controls/slot.js +4 -7
  252. package/build-module/components/inspector-controls/slot.js.map +1 -1
  253. package/build-module/components/inspector-controls/slot.native.js +1 -1
  254. package/build-module/components/inspector-controls/slot.native.js.map +1 -1
  255. package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -0
  256. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  257. package/build-module/components/line-height-control/index.js +7 -2
  258. package/build-module/components/line-height-control/index.js.map +1 -1
  259. package/build-module/components/link-control/use-internal-input-value.js +9 -8
  260. package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
  261. package/build-module/components/list-view/block-contents.js +7 -3
  262. package/build-module/components/list-view/block-contents.js.map +1 -1
  263. package/build-module/components/list-view/block-select-button.js +9 -3
  264. package/build-module/components/list-view/block-select-button.js.map +1 -1
  265. package/build-module/components/list-view/block.js +18 -26
  266. package/build-module/components/list-view/block.js.map +1 -1
  267. package/build-module/components/list-view/drop-indicator.js +36 -10
  268. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  269. package/build-module/components/list-view/index.js +39 -19
  270. package/build-module/components/list-view/index.js.map +1 -1
  271. package/build-module/components/list-view/leaf.js +2 -1
  272. package/build-module/components/list-view/leaf.js.map +1 -1
  273. package/build-module/components/list-view/use-block-selection.js +1 -1
  274. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  275. package/build-module/components/list-view/use-list-view-drop-zone.js +160 -11
  276. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  277. package/build-module/components/media-placeholder/index.js +66 -7
  278. package/build-module/components/media-placeholder/index.js.map +1 -1
  279. package/build-module/components/media-replace-flow/index.js +5 -5
  280. package/build-module/components/media-replace-flow/index.js.map +1 -1
  281. package/build-module/components/multi-selection-inspector/index.js +2 -2
  282. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  283. package/build-module/components/navigable-toolbar/index.js +12 -4
  284. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  285. package/build-module/components/off-canvas-editor/appender.js +1 -5
  286. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  287. package/build-module/components/off-canvas-editor/leaf-more-menu.js +3 -1
  288. package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  289. package/build-module/components/preview-options/index.js +7 -2
  290. package/build-module/components/preview-options/index.js.map +1 -1
  291. package/build-module/components/spacing-sizes-control/spacing-input-control.js +1 -1
  292. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  293. package/build-module/components/url-input/index.js +1 -2
  294. package/build-module/components/url-input/index.js.map +1 -1
  295. package/build-module/hooks/align.js +1 -1
  296. package/build-module/hooks/align.js.map +1 -1
  297. package/build-module/hooks/border.js +1 -1
  298. package/build-module/hooks/border.js.map +1 -1
  299. package/build-module/hooks/color.js +1 -1
  300. package/build-module/hooks/color.js.map +1 -1
  301. package/build-module/hooks/content-lock-ui.js +8 -11
  302. package/build-module/hooks/content-lock-ui.js.map +1 -1
  303. package/build-module/hooks/duotone.js +28 -5
  304. package/build-module/hooks/duotone.js.map +1 -1
  305. package/build-module/hooks/index.native.js +1 -0
  306. package/build-module/hooks/index.native.js.map +1 -1
  307. package/build-module/hooks/layout.js +2 -2
  308. package/build-module/hooks/layout.js.map +1 -1
  309. package/build-module/hooks/position.js +1 -1
  310. package/build-module/hooks/position.js.map +1 -1
  311. package/build-module/hooks/style.js +1 -1
  312. package/build-module/hooks/style.js.map +1 -1
  313. package/build-module/hooks/use-editor-wrapper-styles.native.js +242 -0
  314. package/build-module/hooks/use-editor-wrapper-styles.native.js.map +1 -0
  315. package/build-module/hooks/use-typography-props.js +14 -10
  316. package/build-module/hooks/use-typography-props.js.map +1 -1
  317. package/build-module/hooks/utils.js +16 -4
  318. package/build-module/hooks/utils.js.map +1 -1
  319. package/build-module/index.native.js +6 -0
  320. package/build-module/index.native.js.map +1 -0
  321. package/build-module/private-apis.js +7 -1
  322. package/build-module/private-apis.js.map +1 -1
  323. package/build-module/store/actions.js +7 -0
  324. package/build-module/store/actions.js.map +1 -1
  325. package/build-module/utils/object.js +4 -4
  326. package/build-module/utils/object.js.map +1 -1
  327. package/build-module/utils/transform-styles/index.js +2 -2
  328. package/build-module/utils/transform-styles/index.js.map +1 -1
  329. package/build-module/utils/use-should-contextual-toolbar-show.js +60 -0
  330. package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -0
  331. package/build-style/content-rtl.css +9 -7
  332. package/build-style/content.css +9 -7
  333. package/build-style/style-rtl.css +257 -56
  334. package/build-style/style.css +257 -56
  335. package/package.json +32 -32
  336. package/src/components/block-breadcrumb/style.scss +2 -1
  337. package/src/components/block-controls/slot.js +8 -4
  338. package/src/components/block-controls/slot.native.js +6 -1
  339. package/src/components/block-draggable/index.js +10 -6
  340. package/src/components/block-draggable/use-scroll-when-dragging.js +8 -2
  341. package/src/components/block-info-slot-fill/index.js +24 -0
  342. package/src/components/block-inspector/index.js +3 -0
  343. package/src/components/block-list/block-invalid-warning.native.js +17 -9
  344. package/src/components/block-list/block-list-item-cell.native.js +10 -1
  345. package/src/components/block-list/block-list-item.native.js +180 -208
  346. package/src/components/block-list/block-outline.native.js +58 -0
  347. package/src/components/block-list/block.native.js +564 -524
  348. package/src/components/block-list/content.scss +16 -16
  349. package/src/components/block-list/index.native.js +229 -298
  350. package/src/components/block-list/insertion-point.native.js +2 -2
  351. package/src/components/block-list/test/block-invalid-warning.native.js +48 -0
  352. package/src/components/block-list/test/index.native.js +205 -0
  353. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -1
  354. package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +9 -9
  355. package/src/components/block-mover/style.scss +10 -4
  356. package/src/components/block-mover/test/index.native.js +4 -4
  357. package/src/components/block-pattern-setup/style.scss +1 -4
  358. package/src/components/block-patterns-list/style.scss +1 -4
  359. package/src/components/block-settings-menu/block-settings-dropdown.js +10 -17
  360. package/src/components/block-settings-menu-controls/index.js +24 -4
  361. package/src/components/block-styles/style.scss +4 -4
  362. package/src/components/block-toolbar/index.js +4 -3
  363. package/src/components/block-toolbar/style.scss +56 -33
  364. package/src/components/block-tools/block-contextual-toolbar.js +64 -15
  365. package/src/components/block-tools/selected-block-popover.js +11 -46
  366. package/src/components/block-tools/style.scss +165 -3
  367. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +16 -2
  368. package/src/components/editor-styles/index.js +9 -5
  369. package/src/components/font-sizes/fluid-utils.js +31 -14
  370. package/src/components/font-sizes/test/fluid-utils.js +5 -16
  371. package/src/components/global-styles/advanced-panel.js +82 -0
  372. package/src/components/global-styles/border-panel.js +1 -30
  373. package/src/components/global-styles/color-panel.js +19 -14
  374. package/src/components/global-styles/color-panel.native.js +207 -0
  375. package/src/components/global-styles/dimensions-panel.js +23 -13
  376. package/src/components/global-styles/effects-panel.js +2 -2
  377. package/src/components/global-styles/filters-panel.js +90 -17
  378. package/src/components/global-styles/hooks.js +1 -5
  379. package/src/components/global-styles/index.js +6 -1
  380. package/src/components/global-styles/style.scss +16 -1
  381. package/src/components/global-styles/test/typography-utils.js +63 -22
  382. package/src/components/global-styles/test/use-global-styles-output.js +126 -4
  383. package/src/components/global-styles/test/utils.js +57 -1
  384. package/src/components/global-styles/typography-panel.js +38 -12
  385. package/src/components/global-styles/use-global-styles-output.js +85 -67
  386. package/src/components/global-styles/utils.js +27 -0
  387. package/src/components/image-editor/use-save-image.js +20 -9
  388. package/src/components/index.js +1 -0
  389. package/src/components/inserter/block-types-tab.js +9 -6
  390. package/src/components/inserter/index.js +1 -1
  391. package/src/components/inserter-draggable-blocks/index.js +4 -0
  392. package/src/components/inspector-controls/fill.js +1 -1
  393. package/src/components/inspector-controls/fill.native.js +1 -1
  394. package/src/components/inspector-controls/groups.js +2 -0
  395. package/src/components/inspector-controls/slot.js +4 -9
  396. package/src/components/inspector-controls/slot.native.js +1 -1
  397. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  398. package/src/components/line-height-control/index.js +7 -2
  399. package/src/components/line-height-control/stories/index.js +1 -1
  400. package/src/components/link-control/test/index.js +42 -0
  401. package/src/components/link-control/use-internal-input-value.js +8 -7
  402. package/src/components/list-view/block-contents.js +26 -20
  403. package/src/components/list-view/block-select-button.js +11 -2
  404. package/src/components/list-view/block.js +28 -33
  405. package/src/components/list-view/drop-indicator.js +67 -22
  406. package/src/components/list-view/index.js +33 -14
  407. package/src/components/list-view/leaf.js +1 -0
  408. package/src/components/list-view/style.scss +18 -3
  409. package/src/components/list-view/test/use-list-view-drop-zone.js +88 -12
  410. package/src/components/list-view/use-block-selection.js +1 -1
  411. package/src/components/list-view/use-list-view-drop-zone.js +194 -11
  412. package/src/components/media-placeholder/index.js +74 -1
  413. package/src/components/media-replace-flow/README.md +3 -2
  414. package/src/components/media-replace-flow/index.js +4 -5
  415. package/src/components/multi-selection-inspector/index.js +2 -2
  416. package/src/components/navigable-toolbar/index.js +12 -3
  417. package/src/components/off-canvas-editor/appender.js +1 -4
  418. package/src/components/off-canvas-editor/leaf-more-menu.js +2 -1
  419. package/src/components/preview-options/index.js +9 -2
  420. package/src/components/spacing-sizes-control/spacing-input-control.js +1 -0
  421. package/src/components/url-input/index.js +1 -2
  422. package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
  423. package/src/hooks/align.js +2 -1
  424. package/src/hooks/border.js +2 -1
  425. package/src/hooks/color.js +2 -1
  426. package/src/hooks/content-lock-ui.js +3 -15
  427. package/src/hooks/duotone.js +47 -25
  428. package/src/hooks/index.native.js +1 -0
  429. package/src/hooks/layout.js +4 -2
  430. package/src/hooks/position.js +2 -1
  431. package/src/hooks/style.js +2 -1
  432. package/src/hooks/test/anchor.js +113 -0
  433. package/src/hooks/test/color.js +0 -9
  434. package/src/hooks/test/use-editor-wrapper-styles.native.js +282 -0
  435. package/src/hooks/test/use-typography-props.js +49 -4
  436. package/src/hooks/test/utils.js +20 -101
  437. package/src/hooks/use-editor-wrapper-styles.native.js +250 -0
  438. package/src/hooks/use-editor-wrapper-styles.native.scss +11 -0
  439. package/src/hooks/use-typography-props.js +10 -11
  440. package/src/hooks/utils.js +20 -3
  441. package/src/index.native.js +6 -0
  442. package/src/private-apis.js +6 -0
  443. package/src/store/actions.js +7 -0
  444. package/src/utils/object.js +4 -4
  445. package/src/utils/test/object.js +21 -21
  446. package/src/utils/transform-styles/index.js +2 -2
  447. package/src/utils/use-should-contextual-toolbar-show.js +85 -0
  448. package/tsconfig.json +2 -0
  449. package/tsconfig.tsbuildinfo +1 -1
  450. package/build/hooks/color-panel.native.js +0 -77
  451. package/build/hooks/color-panel.native.js.map +0 -1
  452. package/build-module/hooks/color-panel.native.js +0 -62
  453. package/build-module/hooks/color-panel.native.js.map +0 -1
  454. package/src/hooks/color-panel.native.js +0 -63
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { getListViewDropTarget } from '../use-list-view-drop-zone';
4
+ import {
5
+ getListViewDropTarget,
6
+ NESTING_LEVEL_INDENTATION,
7
+ } from '../use-list-view-drop-zone';
5
8
 
6
9
  describe( 'getListViewDropTarget', () => {
7
10
  const blocksData = [
@@ -15,10 +18,10 @@ describe( 'getListViewDropTarget', () => {
15
18
  top: 50,
16
19
  bottom: 100,
17
20
  left: 10,
18
- right: 100,
21
+ right: 300,
19
22
  x: 10,
20
23
  y: 50,
21
- width: 90,
24
+ width: 290,
22
25
  height: 50,
23
26
  } ),
24
27
  },
@@ -26,6 +29,7 @@ describe( 'getListViewDropTarget', () => {
26
29
  isDraggedBlock: false,
27
30
  isExpanded: true,
28
31
  rootClientId: '',
32
+ nestingLevel: 1,
29
33
  },
30
34
  {
31
35
  blockIndex: 0,
@@ -37,32 +41,56 @@ describe( 'getListViewDropTarget', () => {
37
41
  top: 100,
38
42
  bottom: 150,
39
43
  left: 10,
40
- right: 100,
44
+ right: 300,
41
45
  x: 10,
42
46
  y: 100,
43
- width: 90,
47
+ width: 290,
44
48
  height: 50,
45
49
  } ),
46
50
  },
47
- innerBlockCount: 0,
51
+ innerBlockCount: 1,
48
52
  isDraggedBlock: false,
49
- isExpanded: false,
53
+ isExpanded: true,
50
54
  rootClientId: 'block-1',
55
+ nestingLevel: 2,
51
56
  },
52
57
  {
53
- blockIndex: 1,
58
+ blockIndex: 0,
54
59
  canInsertDraggedBlocksAsChild: true,
55
60
  canInsertDraggedBlocksAsSibling: true,
56
61
  clientId: 'block-3',
57
62
  element: {
58
63
  getBoundingClientRect: () => ( {
59
64
  top: 150,
60
- bottom: 150,
65
+ bottom: 200,
61
66
  left: 10,
62
- right: 100,
67
+ right: 300,
63
68
  x: 10,
64
69
  y: 150,
65
- width: 90,
70
+ width: 290,
71
+ height: 50,
72
+ } ),
73
+ },
74
+ innerBlockCount: 0,
75
+ isDraggedBlock: false,
76
+ isExpanded: true,
77
+ rootClientId: 'block-2',
78
+ nestingLevel: 3,
79
+ },
80
+ {
81
+ blockIndex: 1,
82
+ canInsertDraggedBlocksAsChild: true,
83
+ canInsertDraggedBlocksAsSibling: true,
84
+ clientId: 'block-4',
85
+ element: {
86
+ getBoundingClientRect: () => ( {
87
+ top: 200,
88
+ bottom: 250,
89
+ left: 10,
90
+ right: 300,
91
+ x: 10,
92
+ y: 200,
93
+ width: 290,
66
94
  height: 50,
67
95
  } ),
68
96
  },
@@ -70,6 +98,7 @@ describe( 'getListViewDropTarget', () => {
70
98
  isDraggedBlock: false,
71
99
  isExpanded: false,
72
100
  rootClientId: '',
101
+ nestingLevel: 1,
73
102
  },
74
103
  ];
75
104
 
@@ -96,8 +125,55 @@ describe( 'getListViewDropTarget', () => {
96
125
  } );
97
126
  } );
98
127
 
128
+ it( 'should nest when dragging a block over the right side of the bottom half of a block nested to three levels', () => {
129
+ const position = { x: 250, y: 180 };
130
+ const target = getListViewDropTarget( blocksData, position );
131
+
132
+ expect( target ).toEqual( {
133
+ blockIndex: 0,
134
+ dropPosition: 'inside',
135
+ rootClientId: 'block-3',
136
+ } );
137
+ } );
138
+
139
+ it( 'should drag below when positioned at the bottom half of a block nested to three levels, and over the third level horizontally', () => {
140
+ const position = { x: 10 + NESTING_LEVEL_INDENTATION * 3, y: 180 };
141
+ const target = getListViewDropTarget( blocksData, position );
142
+
143
+ expect( target ).toEqual( {
144
+ blockIndex: 1,
145
+ clientId: 'block-3',
146
+ dropPosition: 'bottom',
147
+ rootClientId: 'block-2',
148
+ } );
149
+ } );
150
+
151
+ it( 'should drag one level up below when positioned at the bottom half of a block nested to three levels, and over the second level horizontally', () => {
152
+ const position = { x: 10 + NESTING_LEVEL_INDENTATION * 2, y: 180 };
153
+ const target = getListViewDropTarget( blocksData, position );
154
+
155
+ expect( target ).toEqual( {
156
+ blockIndex: 1,
157
+ clientId: 'block-3',
158
+ dropPosition: 'bottom',
159
+ rootClientId: 'block-1',
160
+ } );
161
+ } );
162
+
163
+ it( 'should drag two levels up below when positioned at the bottom half of a block nested to three levels, and over the first level horizontally', () => {
164
+ const position = { x: 10 + NESTING_LEVEL_INDENTATION, y: 180 };
165
+ const target = getListViewDropTarget( blocksData, position );
166
+
167
+ expect( target ).toEqual( {
168
+ blockIndex: 1,
169
+ clientId: 'block-3',
170
+ dropPosition: 'bottom',
171
+ rootClientId: '',
172
+ } );
173
+ } );
174
+
99
175
  it( 'should nest when dragging a block over the right side and bottom half of a collapsed block with children', () => {
100
- const position = { x: 70, y: 90 };
176
+ const position = { x: 160, y: 90 };
101
177
 
102
178
  const collapsedBlockData = [ ...blocksData ];
103
179
 
@@ -144,7 +144,7 @@ export default function useBlockSelection() {
144
144
  }
145
145
 
146
146
  if ( label ) {
147
- speak( label );
147
+ speak( label, 'assertive' );
148
148
  }
149
149
  },
150
150
  [
@@ -27,9 +27,9 @@ import { store as blockEditorStore } from '../../store';
27
27
  */
28
28
 
29
29
  /**
30
- * An array representing data for blocks in the DOM used by drag and drop.
30
+ * An object representing data for blocks in the DOM used by drag and drop.
31
31
  *
32
- * @typedef {Object} WPListViewDropZoneBlocks
32
+ * @typedef {Object} WPListViewDropZoneBlock
33
33
  * @property {string} clientId The client id for the block.
34
34
  * @property {string} rootClientId The root client id for the block.
35
35
  * @property {number} blockIndex The block's index.
@@ -41,6 +41,12 @@ import { store as blockEditorStore } from '../../store';
41
41
  * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.
42
42
  */
43
43
 
44
+ /**
45
+ * An array representing data for blocks in the DOM used by drag and drop.
46
+ *
47
+ * @typedef {WPListViewDropZoneBlock[]} WPListViewDropZoneBlocks
48
+ */
49
+
44
50
  /**
45
51
  * An object containing details of a drop target.
46
52
  *
@@ -52,19 +58,110 @@ import { store as blockEditorStore } from '../../store';
52
58
  * 'inside' refers to nesting as an inner block.
53
59
  */
54
60
 
61
+ // When the indentation level, the corresponding left margin in `style.scss`
62
+ // must be updated as well to ensure the drop zone is aligned with the indentation.
63
+ export const NESTING_LEVEL_INDENTATION = 28;
64
+
65
+ /**
66
+ * Determines whether the user is positioning the dragged block to be
67
+ * moved up to a parent level.
68
+ *
69
+ * Determined based on nesting level indentation of the current block.
70
+ *
71
+ * @param {WPPoint} point The point representing the cursor position when dragging.
72
+ * @param {DOMRect} rect The rectangle.
73
+ * @param {number} nestingLevel The nesting level of the block.
74
+ * @return {boolean} Whether the gesture is an upward gesture.
75
+ */
76
+ function isUpGesture( point, rect, nestingLevel = 1 ) {
77
+ // If the block is nested, and the user is dragging to the bottom
78
+ // left of the block, then it is an upward gesture.
79
+ const blockIndentPosition =
80
+ rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
81
+ return point.x < blockIndentPosition;
82
+ }
83
+
84
+ /**
85
+ * Returns how many nesting levels up the user is attempting to drag to.
86
+ *
87
+ * The relative parent level is calculated based on how far
88
+ * the cursor is from the provided nesting level (e.g. of a candidate block
89
+ * that the user is hovering over). The nesting level is considered "desired"
90
+ * because it is not guaranteed that the user will be able to drag to the desired level.
91
+ *
92
+ * The returned integer can be used to access an ascending array
93
+ * of parent blocks, where the first item is the block the user
94
+ * is hovering over, and the last item is the root block.
95
+ *
96
+ * @param {WPPoint} point The point representing the cursor position when dragging.
97
+ * @param {DOMRect} rect The rectangle.
98
+ * @param {number} nestingLevel The nesting level of the block.
99
+ * @return {number} The desired relative parent level.
100
+ */
101
+ function getDesiredRelativeParentLevel( point, rect, nestingLevel = 1 ) {
102
+ const blockIndentPosition =
103
+ rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
104
+ const desiredParentLevel = Math.round(
105
+ ( point.x - blockIndentPosition ) / NESTING_LEVEL_INDENTATION
106
+ );
107
+ return Math.abs( desiredParentLevel );
108
+ }
109
+
110
+ /**
111
+ * Returns an array of the parent blocks of the block the user is dropping to.
112
+ *
113
+ * @param {WPListViewDropZoneBlock} candidateBlockData The block the user is dropping to.
114
+ * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.
115
+ * @return {WPListViewDropZoneBlocks} An array of block parents, including the block the user is dropping to.
116
+ */
117
+ function getCandidateBlockParents( candidateBlockData, blocksData ) {
118
+ const candidateBlockParents = [];
119
+ let currentBlockData = candidateBlockData;
120
+
121
+ while ( currentBlockData ) {
122
+ candidateBlockParents.push( { ...currentBlockData } );
123
+ currentBlockData = blocksData.find(
124
+ ( blockData ) =>
125
+ blockData.clientId === currentBlockData.rootClientId
126
+ );
127
+ }
128
+
129
+ return candidateBlockParents;
130
+ }
131
+
132
+ /**
133
+ * Given a list of blocks data and a block index, return the next non-dragged
134
+ * block. This is used to determine the block that the user is dropping to,
135
+ * while ignoring the dragged block.
136
+ *
137
+ * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.
138
+ * @param {number} index The index to begin searching from.
139
+ * @return {WPListViewDropZoneBlock | undefined} The next non-dragged block.
140
+ */
141
+ function getNextNonDraggedBlock( blocksData, index ) {
142
+ const nextBlockData = blocksData[ index + 1 ];
143
+ if ( nextBlockData && nextBlockData.isDraggedBlock ) {
144
+ return getNextNonDraggedBlock( blocksData, index + 1 );
145
+ }
146
+
147
+ return nextBlockData;
148
+ }
149
+
55
150
  /**
56
151
  * Determines whether the user positioning the dragged block to nest as an
57
152
  * inner block.
58
153
  *
59
- * Presently this is determined by whether the cursor is on the right hand side
60
- * of the block.
154
+ * Determined based on nesting level indentation of the current block, plus
155
+ * the indentation of the next level of nesting.
61
156
  *
62
- * @param {WPPoint} point The point representing the cursor position when dragging.
63
- * @param {DOMRect} rect The rectangle.
157
+ * @param {WPPoint} point The point representing the cursor position when dragging.
158
+ * @param {DOMRect} rect The rectangle.
159
+ * @param {number} nestingLevel The nesting level of the block.
64
160
  */
65
- function isNestingGesture( point, rect ) {
66
- const blockCenterX = rect.left + rect.width / 2;
67
- return point.x > blockCenterX;
161
+ function isNestingGesture( point, rect, nestingLevel = 1 ) {
162
+ const blockIndentPosition =
163
+ rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
164
+ return point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;
68
165
  }
69
166
 
70
167
  // Block navigation is always a vertical list, so only allow dropping
@@ -84,8 +181,10 @@ export function getListViewDropTarget( blocksData, position ) {
84
181
  let candidateBlockData;
85
182
  let candidateDistance;
86
183
  let candidateRect;
184
+ let candidateBlockIndex;
87
185
 
88
- for ( const blockData of blocksData ) {
186
+ for ( let i = 0; i < blocksData.length; i++ ) {
187
+ const blockData = blocksData[ i ];
89
188
  if ( blockData.isDraggedBlock ) {
90
189
  continue;
91
190
  }
@@ -121,10 +220,12 @@ export function getListViewDropTarget( blocksData, position ) {
121
220
  candidateEdge = 'bottom';
122
221
  candidateRect =
123
222
  previousBlockData.element.getBoundingClientRect();
223
+ candidateBlockIndex = index - 1;
124
224
  } else {
125
225
  candidateBlockData = blockData;
126
226
  candidateEdge = edge;
127
227
  candidateRect = rect;
228
+ candidateBlockIndex = index;
128
229
  }
129
230
 
130
231
  // If the mouse position is within the block, break early
@@ -143,8 +244,79 @@ export function getListViewDropTarget( blocksData, position ) {
143
244
  return;
144
245
  }
145
246
 
247
+ const candidateBlockParents = getCandidateBlockParents(
248
+ candidateBlockData,
249
+ blocksData
250
+ );
251
+
146
252
  const isDraggingBelow = candidateEdge === 'bottom';
147
253
 
254
+ // If the user is dragging towards the bottom of the block check whether
255
+ // they might be trying to move the block to be at a parent level.
256
+ if (
257
+ isDraggingBelow &&
258
+ candidateBlockData.rootClientId &&
259
+ isUpGesture( position, candidateRect, candidateBlockParents.length )
260
+ ) {
261
+ const nextBlock = getNextNonDraggedBlock(
262
+ blocksData,
263
+ candidateBlockIndex
264
+ );
265
+ const currentLevel = candidateBlockData.nestingLevel;
266
+ const nextLevel = nextBlock ? nextBlock.nestingLevel : 1;
267
+
268
+ if ( currentLevel && nextLevel ) {
269
+ // Determine the desired relative level of the block to be dropped.
270
+ const desiredRelativeLevel = getDesiredRelativeParentLevel(
271
+ position,
272
+ candidateRect,
273
+ candidateBlockParents.length
274
+ );
275
+
276
+ const targetParentIndex = Math.max(
277
+ Math.min( desiredRelativeLevel, currentLevel - nextLevel ),
278
+ 0
279
+ );
280
+
281
+ if ( candidateBlockParents[ targetParentIndex ] ) {
282
+ // Default to the block index of the candidate block.
283
+ let newBlockIndex = candidateBlockData.blockIndex;
284
+
285
+ // If the next block is at the same level, use that as the default
286
+ // block index. This ensures that the block is dropped in the correct
287
+ // position when dragging to the bottom of a block.
288
+ if (
289
+ candidateBlockParents[ targetParentIndex ].nestingLevel ===
290
+ nextBlock?.nestingLevel
291
+ ) {
292
+ newBlockIndex = nextBlock?.blockIndex;
293
+ } else {
294
+ // Otherwise, search from the current block index back
295
+ // to find the last block index within the same target parent.
296
+ for ( let i = candidateBlockIndex; i >= 0; i-- ) {
297
+ const blockData = blocksData[ i ];
298
+ if (
299
+ blockData.rootClientId ===
300
+ candidateBlockParents[ targetParentIndex ]
301
+ .rootClientId
302
+ ) {
303
+ newBlockIndex = blockData.blockIndex + 1;
304
+ break;
305
+ }
306
+ }
307
+ }
308
+
309
+ return {
310
+ rootClientId:
311
+ candidateBlockParents[ targetParentIndex ].rootClientId,
312
+ clientId: candidateBlockData.clientId,
313
+ blockIndex: newBlockIndex,
314
+ dropPosition: candidateEdge,
315
+ };
316
+ }
317
+ }
318
+ }
319
+
148
320
  // If the user is dragging towards the bottom of the block check whether
149
321
  // they might be trying to nest the block as a child.
150
322
  // If the block already has inner blocks, and is expanded, this should be treated
@@ -156,7 +328,11 @@ export function getListViewDropTarget( blocksData, position ) {
156
328
  candidateBlockData.canInsertDraggedBlocksAsChild &&
157
329
  ( ( candidateBlockData.innerBlockCount > 0 &&
158
330
  candidateBlockData.isExpanded ) ||
159
- isNestingGesture( position, candidateRect ) )
331
+ isNestingGesture(
332
+ position,
333
+ candidateRect,
334
+ candidateBlockParents.length
335
+ ) )
160
336
  ) {
161
337
  return {
162
338
  rootClientId: candidateBlockData.clientId,
@@ -213,6 +389,12 @@ export default function useListViewDropZone() {
213
389
  const blocksData = blockElements.map( ( blockElement ) => {
214
390
  const clientId = blockElement.dataset.block;
215
391
  const isExpanded = blockElement.dataset.expanded === 'true';
392
+
393
+ // Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.
394
+ const nestingLevel = parseInt(
395
+ blockElement.getAttribute( 'aria-level' ),
396
+ 10
397
+ );
216
398
  const rootClientId = getBlockRootClientId( clientId );
217
399
 
218
400
  return {
@@ -221,6 +403,7 @@ export default function useListViewDropZone() {
221
403
  rootClientId,
222
404
  blockIndex: getBlockIndex( clientId ),
223
405
  element: blockElement,
406
+ nestingLevel: nestingLevel || undefined,
224
407
  isDraggedBlock: isBlockDrag
225
408
  ? draggedBlockClientIds.includes( clientId )
226
409
  : false,
@@ -17,6 +17,8 @@ import { __ } from '@wordpress/i18n';
17
17
  import { useState, useEffect } from '@wordpress/element';
18
18
  import { useSelect } from '@wordpress/data';
19
19
  import { keyboardReturn } from '@wordpress/icons';
20
+ import { pasteHandler } from '@wordpress/blocks';
21
+ import deprecated from '@wordpress/deprecated';
20
22
 
21
23
  /**
22
24
  * Internal dependencies
@@ -74,12 +76,19 @@ export function MediaPlaceholder( {
74
76
  onToggleFeaturedImage,
75
77
  onDoubleClick,
76
78
  onFilesPreUpload = noop,
77
- onHTMLDrop = noop,
79
+ onHTMLDrop: deprecatedOnHTMLDrop,
78
80
  children,
79
81
  mediaLibraryButton,
80
82
  placeholder,
81
83
  style,
82
84
  } ) {
85
+ if ( deprecatedOnHTMLDrop ) {
86
+ deprecated( 'wp.blockEditor.MediaPlaceholder onHTMLDrop prop', {
87
+ since: '6.2',
88
+ version: '6.4',
89
+ } );
90
+ }
91
+
83
92
  const mediaUpload = useSelect( ( select ) => {
84
93
  const { getSettings } = select( blockEditorStore );
85
94
  return getSettings().mediaUpload;
@@ -177,6 +186,70 @@ export function MediaPlaceholder( {
177
186
  } );
178
187
  };
179
188
 
189
+ async function handleBlocksDrop( blocks ) {
190
+ if ( ! blocks || ! Array.isArray( blocks ) ) {
191
+ return;
192
+ }
193
+
194
+ function recursivelyFindMediaFromBlocks( _blocks ) {
195
+ return _blocks.flatMap( ( block ) =>
196
+ ( block.name === 'core/image' ||
197
+ block.name === 'core/audio' ||
198
+ block.name === 'core/video' ) &&
199
+ block.attributes.url
200
+ ? [ block ]
201
+ : recursivelyFindMediaFromBlocks( block.innerBlocks )
202
+ );
203
+ }
204
+
205
+ const mediaBlocks = recursivelyFindMediaFromBlocks( blocks );
206
+
207
+ if ( ! mediaBlocks.length ) {
208
+ return;
209
+ }
210
+
211
+ const uploadedMediaList = await Promise.all(
212
+ mediaBlocks.map( ( block ) =>
213
+ block.attributes.id
214
+ ? block.attributes
215
+ : new Promise( ( resolve, reject ) => {
216
+ window
217
+ .fetch( block.attributes.url )
218
+ .then( ( response ) => response.blob() )
219
+ .then( ( blob ) =>
220
+ mediaUpload( {
221
+ filesList: [ blob ],
222
+ additionalData: {
223
+ title: block.attributes.title,
224
+ alt_text: block.attributes.alt,
225
+ caption: block.attributes.caption,
226
+ },
227
+ onFileChange: ( [ media ] ) => {
228
+ if ( media.id ) {
229
+ resolve( media );
230
+ }
231
+ },
232
+ allowedTypes,
233
+ onError: reject,
234
+ } )
235
+ )
236
+ .catch( () => resolve( block.attributes.url ) );
237
+ } )
238
+ )
239
+ ).catch( ( err ) => onError( err ) );
240
+
241
+ if ( multiple ) {
242
+ onSelect( uploadedMediaList );
243
+ } else {
244
+ onSelect( uploadedMediaList[ 0 ] );
245
+ }
246
+ }
247
+
248
+ async function onHTMLDrop( HTML ) {
249
+ const blocks = pasteHandler( { HTML } );
250
+ return await handleBlocksDrop( blocks );
251
+ }
252
+
180
253
  const onUpload = ( event ) => {
181
254
  onFilesUpload( event.target.files );
182
255
  };
@@ -65,10 +65,11 @@ Callback called when an upload error happens and receives an error message as an
65
65
 
66
66
  ### name
67
67
 
68
- The label of the replace button.
68
+ A `string` value will be used as the label of the replace button. It can also accept `Phrasing content` elements(ex. `span`).
69
69
 
70
- - Type: `string`
70
+ - Type: `string|Element`
71
71
  - Required: No
72
+ - Default: `Replace`
72
73
 
73
74
  ### createNotice
74
75
 
@@ -59,6 +59,9 @@ const MediaReplaceFlow = ( {
59
59
  multiple = false,
60
60
  addToGallery,
61
61
  handleUpload = true,
62
+ popoverProps = {
63
+ variant: 'toolbar',
64
+ },
62
65
  } ) => {
63
66
  const mediaUpload = useSelect( ( select ) => {
64
67
  return select( blockEditorStore ).getSettings().mediaUpload;
@@ -136,13 +139,9 @@ const MediaReplaceFlow = ( {
136
139
 
137
140
  const gallery = multiple && onlyAllowsImages();
138
141
 
139
- const POPOVER_PROPS = {
140
- variant: 'toolbar',
141
- };
142
-
143
142
  return (
144
143
  <Dropdown
145
- popoverProps={ POPOVER_PROPS }
144
+ popoverProps={ popoverProps }
146
145
  contentClassName="block-editor-media-replace-flow__options"
147
146
  renderToggle={ ( { isOpen, onToggle } ) => (
148
147
  <ToolbarButton
@@ -23,14 +23,14 @@ function MultiSelectionInspector( { blocks } ) {
23
23
  <div className="block-editor-multi-selection-inspector__card-title">
24
24
  { sprintf(
25
25
  /* translators: %d: number of blocks */
26
- _n( '%d block', '%d blocks', blocks.length ),
26
+ _n( '%d Block', '%d Blocks', blocks.length ),
27
27
  blocks.length
28
28
  ) }
29
29
  </div>
30
30
  <div className="block-editor-multi-selection-inspector__card-description">
31
31
  { sprintf(
32
32
  /* translators: %d: number of words */
33
- _n( '%d word', '%d words', words ),
33
+ _n( '%d word selected.', '%d words selected.', words ),
34
34
  words
35
35
  ) }
36
36
  </div>
@@ -93,7 +93,8 @@ function useToolbarFocus(
93
93
  focusOnMount,
94
94
  isAccessibleToolbar,
95
95
  defaultIndex,
96
- onIndexChange
96
+ onIndexChange,
97
+ shouldUseKeyboardFocusShortcut
97
98
  ) {
98
99
  // Make sure we don't use modified versions of this prop.
99
100
  const [ initialFocusOnMount ] = useState( focusOnMount );
@@ -103,8 +104,14 @@ function useToolbarFocus(
103
104
  focusFirstTabbableIn( ref.current );
104
105
  }, [] );
105
106
 
107
+ const focusToolbarViaShortcut = () => {
108
+ if ( shouldUseKeyboardFocusShortcut ) {
109
+ focusToolbar();
110
+ }
111
+ };
112
+
106
113
  // Focus on toolbar when pressing alt+F10 when the toolbar is visible.
107
- useShortcut( 'core/block-editor/focus-toolbar', focusToolbar );
114
+ useShortcut( 'core/block-editor/focus-toolbar', focusToolbarViaShortcut );
108
115
 
109
116
  useEffect( () => {
110
117
  if ( initialFocusOnMount ) {
@@ -147,6 +154,7 @@ function useToolbarFocus(
147
154
  function NavigableToolbar( {
148
155
  children,
149
156
  focusOnMount,
157
+ shouldUseKeyboardFocusShortcut = true,
150
158
  __experimentalInitialIndex: initialIndex,
151
159
  __experimentalOnIndexChange: onIndexChange,
152
160
  ...props
@@ -159,7 +167,8 @@ function NavigableToolbar( {
159
167
  focusOnMount,
160
168
  isAccessibleToolbar,
161
169
  initialIndex,
162
- onIndexChange
170
+ onIndexChange,
171
+ shouldUseKeyboardFocusShortcut
163
172
  );
164
173
 
165
174
  if ( isAccessibleToolbar ) {
@@ -17,9 +17,7 @@ import { __, sprintf } from '@wordpress/i18n';
17
17
  */
18
18
  import { store as blockEditorStore } from '../../store';
19
19
  import useBlockDisplayTitle from '../block-title/use-block-display-title';
20
-
21
- import { unlock } from '../../lock-unlock';
22
- import { privateApis as blockEditorPrivateApis } from '../../private-apis';
20
+ import { ComposedPrivateInserter as PrivateInserter } from '../inserter';
23
21
 
24
22
  const prioritizedInserterBlocks = [
25
23
  'core/navigation-link/page',
@@ -86,7 +84,6 @@ export const Appender = forwardRef(
86
84
  if ( hideInserter ) {
87
85
  return null;
88
86
  }
89
- const { PrivateInserter } = unlock( blockEditorPrivateApis );
90
87
  const descriptionId = `off-canvas-editor-appender__${ instanceId }`;
91
88
  const description = sprintf(
92
89
  /* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */
@@ -88,7 +88,8 @@ function AddSubmenuItem( { block, onClose } ) {
88
88
  }
89
89
 
90
90
  export default function LeafMoreMenu( props ) {
91
- const { clientId, block } = props;
91
+ const { block } = props;
92
+ const { clientId } = block;
92
93
 
93
94
  const { moveBlocksDown, moveBlocksUp, removeBlocks } =
94
95
  useDispatch( blockEditorStore );