@wordpress/block-editor 11.7.0 → 12.0.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 (357) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +56 -57
  3. package/build/components/block-info-slot-fill/index.js +47 -0
  4. package/build/components/block-info-slot-fill/index.js.map +1 -0
  5. package/build/components/block-inspector/index.js +4 -2
  6. package/build/components/block-inspector/index.js.map +1 -1
  7. package/build/components/block-list/index.native.js +11 -21
  8. package/build/components/block-list/index.native.js.map +1 -1
  9. package/build/components/block-list/use-in-between-inserter.js +3 -1
  10. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  11. package/build/components/block-popover/inbetween.js +2 -9
  12. package/build/components/block-popover/inbetween.js.map +1 -1
  13. package/build/components/block-settings-menu/block-settings-dropdown.js +1 -10
  14. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  15. package/build/components/block-toolbar/index.js +2 -1
  16. package/build/components/block-toolbar/index.js.map +1 -1
  17. package/build/components/block-tools/block-contextual-toolbar.js +83 -9
  18. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  19. package/build/components/block-tools/selected-block-popover.js +11 -28
  20. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  21. package/build/components/caption/index.native.js +0 -1
  22. package/build/components/caption/index.native.js.map +1 -1
  23. package/build/components/date-format-picker/index.js +1 -1
  24. package/build/components/date-format-picker/index.js.map +1 -1
  25. package/build/components/editor-styles/index.js +4 -3
  26. package/build/components/editor-styles/index.js.map +1 -1
  27. package/build/components/font-sizes/fluid-utils.js +21 -14
  28. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  29. package/build/components/global-styles/border-panel.js +15 -59
  30. package/build/components/global-styles/border-panel.js.map +1 -1
  31. package/build/components/global-styles/color-panel.js +12 -12
  32. package/build/components/global-styles/color-panel.js.map +1 -1
  33. package/build/components/global-styles/color-panel.native.js +174 -0
  34. package/build/components/global-styles/color-panel.native.js.map +1 -0
  35. package/build/components/global-styles/dimensions-panel.js +21 -20
  36. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  37. package/build/components/global-styles/effects-panel.js +244 -0
  38. package/build/components/global-styles/effects-panel.js.map +1 -0
  39. package/build/components/global-styles/filters-panel.js +215 -0
  40. package/build/components/global-styles/filters-panel.js.map +1 -0
  41. package/build/components/global-styles/get-block-css-selector.js +1 -12
  42. package/build/components/global-styles/get-block-css-selector.js.map +1 -1
  43. package/build/components/global-styles/hooks.js +7 -0
  44. package/build/components/global-styles/hooks.js.map +1 -1
  45. package/build/components/global-styles/index.js +28 -0
  46. package/build/components/global-styles/index.js.map +1 -1
  47. package/build/components/global-styles/typography-panel.js +9 -9
  48. package/build/components/global-styles/typography-panel.js.map +1 -1
  49. package/build/components/global-styles/use-global-styles-output.js +100 -82
  50. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  51. package/build/components/iframe/index.js +1 -1
  52. package/build/components/iframe/index.js.map +1 -1
  53. package/build/components/image-size-control/use-dimension-handler.js +5 -3
  54. package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
  55. package/build/components/index.js +23 -0
  56. package/build/components/index.js.map +1 -1
  57. package/build/components/inserter/block-patterns-tab.js +4 -2
  58. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  59. package/build/components/inserter/block-types-tab.js +12 -7
  60. package/build/components/inserter/block-types-tab.js.map +1 -1
  61. package/build/components/inserter/index.js +2 -1
  62. package/build/components/inserter/index.js.map +1 -1
  63. package/build/components/inspector-controls/groups.js +2 -0
  64. package/build/components/inspector-controls/groups.js.map +1 -1
  65. package/build/components/inspector-controls-tabs/styles-tab.js +2 -0
  66. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  67. package/build/components/inspector-controls-tabs/utils.js +5 -3
  68. package/build/components/inspector-controls-tabs/utils.js.map +1 -1
  69. package/build/components/list-view/block-select-button.js +7 -2
  70. package/build/components/list-view/block-select-button.js.map +1 -1
  71. package/build/components/list-view/block.js +13 -21
  72. package/build/components/list-view/block.js.map +1 -1
  73. package/build/components/list-view/drop-indicator.js +37 -10
  74. package/build/components/list-view/drop-indicator.js.map +1 -1
  75. package/build/components/list-view/index.js +31 -7
  76. package/build/components/list-view/index.js.map +1 -1
  77. package/build/components/list-view/leaf.js +2 -1
  78. package/build/components/list-view/leaf.js.map +1 -1
  79. package/build/components/list-view/use-block-selection.js +1 -1
  80. package/build/components/list-view/use-block-selection.js.map +1 -1
  81. package/build/components/list-view/use-list-view-client-ids.js +7 -3
  82. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  83. package/build/components/list-view/use-list-view-drop-zone.js +8 -2
  84. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  85. package/build/components/media-replace-flow/index.js +5 -5
  86. package/build/components/media-replace-flow/index.js.map +1 -1
  87. package/build/components/navigable-toolbar/index.js +12 -4
  88. package/build/components/navigable-toolbar/index.js.map +1 -1
  89. package/build/components/off-canvas-editor/appender.js +2 -7
  90. package/build/components/off-canvas-editor/appender.js.map +1 -1
  91. package/build/components/off-canvas-editor/block-contents.js +6 -1
  92. package/build/components/off-canvas-editor/block-contents.js.map +1 -1
  93. package/build/components/off-canvas-editor/index.js +17 -14
  94. package/build/components/off-canvas-editor/index.js.map +1 -1
  95. package/build/components/resizable-box-popover/index.js +38 -0
  96. package/build/components/resizable-box-popover/index.js.map +1 -0
  97. package/build/components/rich-text/index.js +0 -1
  98. package/build/components/rich-text/index.js.map +1 -1
  99. package/build/components/rich-text/index.native.js +7 -11
  100. package/build/components/rich-text/index.native.js.map +1 -1
  101. package/build/components/spacing-sizes-control/spacing-input-control.js +8 -0
  102. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  103. package/build/hooks/anchor.js +1 -1
  104. package/build/hooks/anchor.js.map +1 -1
  105. package/build/hooks/border.js +1 -1
  106. package/build/hooks/border.js.map +1 -1
  107. package/build/hooks/duotone.js +121 -70
  108. package/build/hooks/duotone.js.map +1 -1
  109. package/build/hooks/margin.js +27 -17
  110. package/build/hooks/margin.js.map +1 -1
  111. package/build/hooks/padding.js +19 -9
  112. package/build/hooks/padding.js.map +1 -1
  113. package/build/hooks/utils.js +22 -7
  114. package/build/hooks/utils.js.map +1 -1
  115. package/build/layouts/utils.js +3 -2
  116. package/build/layouts/utils.js.map +1 -1
  117. package/build/private-apis.js +13 -1
  118. package/build/private-apis.js.map +1 -1
  119. package/build/store/actions.js +8 -1
  120. package/build/store/actions.js.map +1 -1
  121. package/build/utils/object.js +6 -6
  122. package/build/utils/object.js.map +1 -1
  123. package/build/utils/transform-styles/index.js +2 -2
  124. package/build/utils/transform-styles/index.js.map +1 -1
  125. package/build/utils/use-should-contextual-toolbar-show.js +68 -0
  126. package/build/utils/use-should-contextual-toolbar-show.js.map +1 -0
  127. package/build-module/components/block-info-slot-fill/index.js +34 -0
  128. package/build-module/components/block-info-slot-fill/index.js.map +1 -0
  129. package/build-module/components/block-inspector/index.js +3 -2
  130. package/build-module/components/block-inspector/index.js.map +1 -1
  131. package/build-module/components/block-list/index.native.js +11 -19
  132. package/build-module/components/block-list/index.native.js.map +1 -1
  133. package/build-module/components/block-list/use-in-between-inserter.js +2 -1
  134. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  135. package/build-module/components/block-popover/inbetween.js +2 -9
  136. package/build-module/components/block-popover/inbetween.js.map +1 -1
  137. package/build-module/components/block-settings-menu/block-settings-dropdown.js +1 -9
  138. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  139. package/build-module/components/block-toolbar/index.js +2 -1
  140. package/build-module/components/block-toolbar/index.js.map +1 -1
  141. package/build-module/components/block-tools/block-contextual-toolbar.js +79 -9
  142. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  143. package/build-module/components/block-tools/selected-block-popover.js +10 -27
  144. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  145. package/build-module/components/caption/index.native.js +0 -1
  146. package/build-module/components/caption/index.native.js.map +1 -1
  147. package/build-module/components/date-format-picker/index.js +1 -1
  148. package/build-module/components/date-format-picker/index.js.map +1 -1
  149. package/build-module/components/editor-styles/index.js +4 -3
  150. package/build-module/components/editor-styles/index.js.map +1 -1
  151. package/build-module/components/font-sizes/fluid-utils.js +21 -14
  152. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  153. package/build-module/components/global-styles/border-panel.js +15 -59
  154. package/build-module/components/global-styles/border-panel.js.map +1 -1
  155. package/build-module/components/global-styles/color-panel.js +13 -13
  156. package/build-module/components/global-styles/color-panel.js.map +1 -1
  157. package/build-module/components/global-styles/color-panel.native.js +150 -0
  158. package/build-module/components/global-styles/color-panel.native.js.map +1 -0
  159. package/build-module/components/global-styles/dimensions-panel.js +22 -21
  160. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  161. package/build-module/components/global-styles/effects-panel.js +228 -0
  162. package/build-module/components/global-styles/effects-panel.js.map +1 -0
  163. package/build-module/components/global-styles/filters-panel.js +201 -0
  164. package/build-module/components/global-styles/filters-panel.js.map +1 -0
  165. package/build-module/components/global-styles/get-block-css-selector.js +1 -12
  166. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
  167. package/build-module/components/global-styles/hooks.js +7 -0
  168. package/build-module/components/global-styles/hooks.js.map +1 -1
  169. package/build-module/components/global-styles/index.js +2 -0
  170. package/build-module/components/global-styles/index.js.map +1 -1
  171. package/build-module/components/global-styles/typography-panel.js +10 -10
  172. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  173. package/build-module/components/global-styles/use-global-styles-output.js +101 -83
  174. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  175. package/build-module/components/iframe/index.js +1 -1
  176. package/build-module/components/iframe/index.js.map +1 -1
  177. package/build-module/components/image-size-control/use-dimension-handler.js +5 -3
  178. package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
  179. package/build-module/components/index.js +1 -0
  180. package/build-module/components/index.js.map +1 -1
  181. package/build-module/components/inserter/block-patterns-tab.js +5 -2
  182. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  183. package/build-module/components/inserter/block-types-tab.js +12 -6
  184. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  185. package/build-module/components/inserter/index.js +2 -1
  186. package/build-module/components/inserter/index.js.map +1 -1
  187. package/build-module/components/inspector-controls/groups.js +2 -0
  188. package/build-module/components/inspector-controls/groups.js.map +1 -1
  189. package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -0
  190. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  191. package/build-module/components/inspector-controls-tabs/utils.js +4 -3
  192. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
  193. package/build-module/components/list-view/block-select-button.js +7 -2
  194. package/build-module/components/list-view/block-select-button.js.map +1 -1
  195. package/build-module/components/list-view/block.js +15 -22
  196. package/build-module/components/list-view/block.js.map +1 -1
  197. package/build-module/components/list-view/drop-indicator.js +36 -10
  198. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  199. package/build-module/components/list-view/index.js +31 -8
  200. package/build-module/components/list-view/index.js.map +1 -1
  201. package/build-module/components/list-view/leaf.js +2 -1
  202. package/build-module/components/list-view/leaf.js.map +1 -1
  203. package/build-module/components/list-view/use-block-selection.js +1 -1
  204. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  205. package/build-module/components/list-view/use-list-view-client-ids.js +7 -3
  206. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  207. package/build-module/components/list-view/use-list-view-drop-zone.js +8 -4
  208. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  209. package/build-module/components/media-replace-flow/index.js +5 -5
  210. package/build-module/components/media-replace-flow/index.js.map +1 -1
  211. package/build-module/components/navigable-toolbar/index.js +12 -4
  212. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  213. package/build-module/components/off-canvas-editor/appender.js +1 -5
  214. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  215. package/build-module/components/off-canvas-editor/block-contents.js +5 -1
  216. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
  217. package/build-module/components/off-canvas-editor/index.js +17 -14
  218. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  219. package/build-module/components/resizable-box-popover/index.js +26 -0
  220. package/build-module/components/resizable-box-popover/index.js.map +1 -0
  221. package/build-module/components/rich-text/index.js +0 -1
  222. package/build-module/components/rich-text/index.js.map +1 -1
  223. package/build-module/components/rich-text/index.native.js +7 -10
  224. package/build-module/components/rich-text/index.native.js.map +1 -1
  225. package/build-module/components/spacing-sizes-control/spacing-input-control.js +7 -0
  226. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  227. package/build-module/hooks/anchor.js +1 -1
  228. package/build-module/hooks/anchor.js.map +1 -1
  229. package/build-module/hooks/border.js +1 -1
  230. package/build-module/hooks/border.js.map +1 -1
  231. package/build-module/hooks/duotone.js +118 -71
  232. package/build-module/hooks/duotone.js.map +1 -1
  233. package/build-module/hooks/margin.js +29 -18
  234. package/build-module/hooks/margin.js.map +1 -1
  235. package/build-module/hooks/padding.js +21 -10
  236. package/build-module/hooks/padding.js.map +1 -1
  237. package/build-module/hooks/utils.js +24 -9
  238. package/build-module/hooks/utils.js.map +1 -1
  239. package/build-module/layouts/utils.js +3 -2
  240. package/build-module/layouts/utils.js.map +1 -1
  241. package/build-module/private-apis.js +9 -1
  242. package/build-module/private-apis.js.map +1 -1
  243. package/build-module/store/actions.js +8 -1
  244. package/build-module/store/actions.js.map +1 -1
  245. package/build-module/utils/object.js +5 -5
  246. package/build-module/utils/object.js.map +1 -1
  247. package/build-module/utils/transform-styles/index.js +2 -2
  248. package/build-module/utils/transform-styles/index.js.map +1 -1
  249. package/build-module/utils/use-should-contextual-toolbar-show.js +56 -0
  250. package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -0
  251. package/build-style/content-rtl.css +9 -6
  252. package/build-style/content.css +9 -6
  253. package/build-style/style-rtl.css +272 -54
  254. package/build-style/style.css +272 -54
  255. package/package.json +32 -32
  256. package/src/components/block-info-slot-fill/index.js +24 -0
  257. package/src/components/block-inspector/index.js +3 -0
  258. package/src/components/block-inspector/style.scss +6 -4
  259. package/src/components/block-list/content.scss +16 -15
  260. package/src/components/block-list/index.native.js +19 -38
  261. package/src/components/block-list/use-in-between-inserter.js +4 -1
  262. package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +9 -9
  263. package/src/components/block-mover/style.scss +10 -4
  264. package/src/components/block-mover/test/index.native.js +4 -4
  265. package/src/components/block-popover/inbetween.js +2 -13
  266. package/src/components/block-settings-menu/block-settings-dropdown.js +2 -12
  267. package/src/components/block-toolbar/index.js +4 -3
  268. package/src/components/block-toolbar/style.scss +56 -33
  269. package/src/components/block-tools/block-contextual-toolbar.js +94 -11
  270. package/src/components/block-tools/selected-block-popover.js +11 -44
  271. package/src/components/block-tools/style.scss +157 -3
  272. package/src/components/caption/index.native.js +0 -1
  273. package/src/components/date-format-picker/index.js +1 -1
  274. package/src/components/editor-styles/index.js +9 -5
  275. package/src/components/font-sizes/fluid-utils.js +31 -14
  276. package/src/components/font-sizes/test/fluid-utils.js +5 -16
  277. package/src/components/global-styles/README.md +129 -16
  278. package/src/components/global-styles/border-panel.js +13 -61
  279. package/src/components/global-styles/color-panel.js +13 -13
  280. package/src/components/global-styles/color-panel.native.js +207 -0
  281. package/src/components/global-styles/dimensions-panel.js +47 -20
  282. package/src/components/global-styles/effects-panel.js +228 -0
  283. package/src/components/global-styles/filters-panel.js +230 -0
  284. package/src/components/global-styles/get-block-css-selector.js +0 -11
  285. package/src/components/global-styles/hooks.js +10 -0
  286. package/src/components/global-styles/index.js +2 -0
  287. package/src/components/global-styles/style.scss +43 -0
  288. package/src/components/global-styles/test/typography-utils.js +63 -22
  289. package/src/components/global-styles/test/use-global-styles-output.js +130 -8
  290. package/src/components/global-styles/typography-panel.js +37 -11
  291. package/src/components/global-styles/use-global-styles-output.js +88 -72
  292. package/src/components/iframe/index.js +1 -1
  293. package/src/components/image-size-control/use-dimension-handler.js +4 -3
  294. package/src/components/index.js +5 -1
  295. package/src/components/inserter/block-patterns-tab.js +3 -1
  296. package/src/components/inserter/block-types-tab.js +9 -6
  297. package/src/components/inserter/index.js +1 -1
  298. package/src/components/inspector-controls/groups.js +2 -0
  299. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  300. package/src/components/inspector-controls-tabs/utils.js +4 -3
  301. package/src/components/list-view/README.md +2 -0
  302. package/src/components/list-view/block-select-button.js +6 -1
  303. package/src/components/list-view/block.js +24 -31
  304. package/src/components/list-view/drop-indicator.js +67 -22
  305. package/src/components/list-view/index.js +26 -3
  306. package/src/components/list-view/leaf.js +1 -0
  307. package/src/components/list-view/style.scss +18 -4
  308. package/src/components/list-view/test/use-list-view-drop-zone.js +188 -0
  309. package/src/components/list-view/use-block-selection.js +1 -1
  310. package/src/components/list-view/use-list-view-client-ids.js +5 -3
  311. package/src/components/list-view/use-list-view-drop-zone.js +9 -3
  312. package/src/components/media-replace-flow/README.md +3 -2
  313. package/src/components/media-replace-flow/index.js +4 -5
  314. package/src/components/navigable-toolbar/index.js +12 -3
  315. package/src/components/off-canvas-editor/appender.js +1 -4
  316. package/src/components/off-canvas-editor/block-contents.js +4 -0
  317. package/src/components/off-canvas-editor/index.js +15 -11
  318. package/src/components/resizable-box-popover/index.js +27 -0
  319. package/src/components/rich-text/index.js +0 -1
  320. package/src/components/rich-text/index.native.js +2 -5
  321. package/src/components/spacing-sizes-control/spacing-input-control.js +10 -0
  322. package/src/components/spacing-sizes-control/style.scss +7 -7
  323. package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
  324. package/src/hooks/anchor.js +1 -1
  325. package/src/hooks/border.js +1 -1
  326. package/src/hooks/duotone.js +162 -99
  327. package/src/hooks/margin.js +31 -26
  328. package/src/hooks/padding.js +24 -18
  329. package/src/hooks/test/anchor.js +113 -0
  330. package/src/hooks/test/color.js +0 -9
  331. package/src/hooks/test/use-typography-props.js +2 -2
  332. package/src/hooks/test/utils.js +20 -101
  333. package/src/hooks/utils.js +23 -6
  334. package/src/layouts/utils.js +2 -2
  335. package/src/private-apis.js +8 -0
  336. package/src/store/actions.js +8 -1
  337. package/src/style.scss +1 -0
  338. package/src/utils/object.js +5 -5
  339. package/src/utils/test/object.js +53 -15
  340. package/src/utils/transform-styles/index.js +2 -2
  341. package/src/utils/use-should-contextual-toolbar-show.js +75 -0
  342. package/tsconfig.json +1 -0
  343. package/build/components/rich-text/use-native-props.js +0 -11
  344. package/build/components/rich-text/use-native-props.js.map +0 -1
  345. package/build/components/rich-text/use-native-props.native.js +0 -24
  346. package/build/components/rich-text/use-native-props.native.js.map +0 -1
  347. package/build/hooks/color-panel.native.js +0 -77
  348. package/build/hooks/color-panel.native.js.map +0 -1
  349. package/build-module/components/rich-text/use-native-props.js +0 -4
  350. package/build-module/components/rich-text/use-native-props.js.map +0 -1
  351. package/build-module/components/rich-text/use-native-props.native.js +0 -15
  352. package/build-module/components/rich-text/use-native-props.native.js.map +0 -1
  353. package/build-module/hooks/color-panel.native.js +0 -62
  354. package/build-module/hooks/color-panel.native.js.map +0 -1
  355. package/src/components/rich-text/use-native-props.js +0 -3
  356. package/src/components/rich-text/use-native-props.native.js +0 -17
  357. package/src/hooks/color-panel.native.js +0 -63
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { Popover } from '@wordpress/components';
5
+ import { getScrollContainer } from '@wordpress/dom';
5
6
  import { useCallback, useMemo } from '@wordpress/element';
6
7
 
7
8
  export default function ListViewDropIndicator( {
@@ -40,33 +41,74 @@ export default function ListViewDropIndicator( {
40
41
  // is undefined, so the indicator will appear after the rootBlockElement.
41
42
  const targetElement = blockElement || rootBlockElement;
42
43
 
43
- const getDropIndicatorIndent = useCallback( () => {
44
- if ( ! rootBlockElement ) {
45
- return 0;
46
- }
44
+ const getDropIndicatorIndent = useCallback(
45
+ ( targetElementRect ) => {
46
+ if ( ! rootBlockElement ) {
47
+ return 0;
48
+ }
49
+
50
+ // Calculate the indent using the block icon of the root block.
51
+ // Using a classname selector here might be flaky and could be
52
+ // improved.
53
+ const rootBlockIconElement = rootBlockElement.querySelector(
54
+ '.block-editor-block-icon'
55
+ );
56
+ const rootBlockIconRect =
57
+ rootBlockIconElement.getBoundingClientRect();
58
+ return rootBlockIconRect.right - targetElementRect.left;
59
+ },
60
+ [ rootBlockElement ]
61
+ );
47
62
 
48
- // Calculate the indent using the block icon of the root block.
49
- // Using a classname selector here might be flaky and could be
50
- // improved.
51
- const targetElementRect = targetElement.getBoundingClientRect();
52
- const rootBlockIconElement = rootBlockElement.querySelector(
53
- '.block-editor-block-icon'
54
- );
55
- const rootBlockIconRect = rootBlockIconElement.getBoundingClientRect();
56
- return rootBlockIconRect.right - targetElementRect.left;
57
- }, [ rootBlockElement, targetElement ] );
63
+ const getDropIndicatorWidth = useCallback(
64
+ ( targetElementRect, indent ) => {
65
+ if ( ! targetElement ) {
66
+ return 0;
67
+ }
68
+
69
+ // Default to assuming that the width of the drop indicator
70
+ // should be the same as the target element.
71
+ let width = targetElement.offsetWidth;
72
+
73
+ // In deeply nested lists, where a scrollbar is present,
74
+ // the width of the drop indicator should be the width of
75
+ // the scroll container, minus the distance from the left
76
+ // edge of the scroll container to the left edge of the
77
+ // target element.
78
+ const scrollContainer = getScrollContainer(
79
+ targetElement,
80
+ 'horizontal'
81
+ );
82
+
83
+ if ( scrollContainer ) {
84
+ const scrollContainerRect =
85
+ scrollContainer.getBoundingClientRect();
86
+
87
+ if ( scrollContainer.clientWidth < width ) {
88
+ width =
89
+ scrollContainer.clientWidth -
90
+ ( targetElementRect.left - scrollContainerRect.left );
91
+ }
92
+ }
93
+
94
+ // Subtract the indent from the final width of the indicator.
95
+ return width - indent;
96
+ },
97
+ [ targetElement ]
98
+ );
58
99
 
59
100
  const style = useMemo( () => {
60
101
  if ( ! targetElement ) {
61
102
  return {};
62
103
  }
63
104
 
64
- const indent = getDropIndicatorIndent();
105
+ const targetElementRect = targetElement.getBoundingClientRect();
106
+ const indent = getDropIndicatorIndent( targetElementRect );
65
107
 
66
108
  return {
67
- width: targetElement.offsetWidth - indent,
109
+ width: getDropIndicatorWidth( targetElementRect, indent ),
68
110
  };
69
- }, [ getDropIndicatorIndent, targetElement ] );
111
+ }, [ getDropIndicatorIndent, getDropIndicatorWidth, targetElement ] );
70
112
 
71
113
  const popoverAnchor = useMemo( () => {
72
114
  const isValidDropPosition =
@@ -81,10 +123,8 @@ export default function ListViewDropIndicator( {
81
123
  ownerDocument: targetElement.ownerDocument,
82
124
  getBoundingClientRect() {
83
125
  const rect = targetElement.getBoundingClientRect();
84
- const indent = getDropIndicatorIndent();
85
-
126
+ const indent = getDropIndicatorIndent( rect );
86
127
  const left = rect.left + indent;
87
- const right = rect.right;
88
128
  let top = 0;
89
129
  let bottom = 0;
90
130
 
@@ -97,13 +137,18 @@ export default function ListViewDropIndicator( {
97
137
  bottom = rect.bottom;
98
138
  }
99
139
 
100
- const width = right - left;
140
+ const width = getDropIndicatorWidth( rect, indent );
101
141
  const height = bottom - top;
102
142
 
103
143
  return new window.DOMRect( left, top, width, height );
104
144
  },
105
145
  };
106
- }, [ targetElement, dropPosition, getDropIndicatorIndent ] );
146
+ }, [
147
+ targetElement,
148
+ dropPosition,
149
+ getDropIndicatorIndent,
150
+ getDropIndicatorWidth,
151
+ ] );
107
152
 
108
153
  if ( ! targetElement ) {
109
154
  return null;
@@ -2,11 +2,13 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import {
5
+ useInstanceId,
5
6
  useMergeRefs,
6
7
  __experimentalUseFixedWindowList as useFixedWindowList,
7
8
  } from '@wordpress/compose';
8
9
  import { __experimentalTreeGrid as TreeGrid } from '@wordpress/components';
9
10
  import { AsyncModeProvider, useSelect } from '@wordpress/data';
11
+ import deprecated from '@wordpress/deprecated';
10
12
  import {
11
13
  useCallback,
12
14
  useEffect,
@@ -56,11 +58,13 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36;
56
58
  *
57
59
  * @param {Object} props Components props.
58
60
  * @param {string} props.id An HTML element id for the root element of ListView.
59
- * @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy.
61
+ * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.
60
62
  * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.
61
63
  * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.
62
64
  * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.
63
65
  * @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.
66
+ * @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.
67
+ * @param {string} props.description Optional accessible description for the tree grid component.
64
68
  * @param {Ref} ref Forwarded ref
65
69
  */
66
70
  function ListViewComponent(
@@ -71,11 +75,25 @@ function ListViewComponent(
71
75
  isExpanded = false,
72
76
  showAppender = false,
73
77
  blockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,
78
+ rootClientId,
79
+ description,
74
80
  },
75
81
  ref
76
82
  ) {
83
+ // This can be removed once we no longer need to support the blocks prop.
84
+ if ( blocks ) {
85
+ deprecated(
86
+ '`blocks` property in `wp.blockEditor.__experimentalListView`',
87
+ {
88
+ since: '6.3',
89
+ alternative: '`rootClientId` property',
90
+ }
91
+ );
92
+ }
93
+
94
+ const instanceId = useInstanceId( ListViewComponent );
77
95
  const { clientIdsTree, draggedClientIds, selectedClientIds } =
78
- useListViewClientIds( blocks );
96
+ useListViewClientIds( { blocks, rootClientId } );
79
97
 
80
98
  const { visibleBlockCount, shouldShowInnerBlocks } = useSelect(
81
99
  ( select ) => {
@@ -184,14 +202,15 @@ function ListViewComponent(
184
202
  expand,
185
203
  collapse,
186
204
  BlockSettingsMenu,
205
+ listViewInstanceId: instanceId,
187
206
  } ),
188
207
  [
189
- isMounted.current,
190
208
  draggedClientIds,
191
209
  expandedState,
192
210
  expand,
193
211
  collapse,
194
212
  BlockSettingsMenu,
213
+ instanceId,
195
214
  ]
196
215
  );
197
216
 
@@ -215,10 +234,13 @@ function ListViewComponent(
215
234
  onExpandRow={ expandRow }
216
235
  onFocusRow={ focusRow }
217
236
  applicationAriaLabel={ __( 'Block navigation structure' ) }
237
+ // eslint-disable-next-line jsx-a11y/aria-props
238
+ aria-description={ description }
218
239
  >
219
240
  <ListViewContext.Provider value={ contextValue }>
220
241
  <ListViewBranch
221
242
  blocks={ clientIdsTree }
243
+ parentId={ rootClientId }
222
244
  selectBlock={ selectEditorBlock }
223
245
  showBlockMovers={ showBlockMovers }
224
246
  fixedListWindow={ fixedListWindow }
@@ -241,6 +263,7 @@ export default forwardRef( ( props, ref ) => {
241
263
  { ...props }
242
264
  showAppender={ false }
243
265
  blockSettingsMenu={ BlockSettingsDropdown }
266
+ rootClientId={ null }
244
267
  />
245
268
  );
246
269
  } );
@@ -51,6 +51,7 @@ const ListViewLeaf = forwardRef(
51
51
  level={ level }
52
52
  positionInSet={ position }
53
53
  setSize={ rowCount }
54
+ isExpanded={ undefined }
54
55
  { ...props }
55
56
  >
56
57
  { children }
@@ -15,6 +15,18 @@
15
15
  // Use position relative for row animation.
16
16
  position: relative;
17
17
 
18
+ .components-button {
19
+ // When a row is expanded, retain the dark color.
20
+ &[aria-expanded="true"] {
21
+ color: $gray-900;
22
+ }
23
+
24
+ // Ensure that on hover, the admin color is still used.
25
+ &:hover {
26
+ color: var(--wp-admin-theme-color);
27
+ }
28
+ }
29
+
18
30
  // The background has to be applied to the td, not tr, or border-radius won't work.
19
31
  &.is-selected td {
20
32
  background: var(--wp-admin-theme-color);
@@ -93,7 +105,7 @@
93
105
  &.is-branch-selected.is-first-selected td:last-child {
94
106
  border-top-right-radius: $radius-block-ui;
95
107
  }
96
- &[aria-expanded="false"] {
108
+ &[data-expanded="false"] {
97
109
  &.is-branch-selected.is-first-selected td:first-child {
98
110
  border-top-left-radius: $radius-block-ui;
99
111
  }
@@ -380,7 +392,7 @@ $block-navigation-max-indent: 8;
380
392
  }
381
393
 
382
394
  // Point downwards when open.
383
- .block-editor-list-view-leaf[aria-expanded="true"] .block-editor-list-view__expander svg {
395
+ .block-editor-list-view-leaf[data-expanded="true"] .block-editor-list-view__expander svg {
384
396
  visibility: visible;
385
397
  transition: transform 0.2s ease;
386
398
  transform: rotate(90deg);
@@ -388,7 +400,7 @@ $block-navigation-max-indent: 8;
388
400
  }
389
401
 
390
402
  // Point rightwards when closed
391
- .block-editor-list-view-leaf[aria-expanded="false"] .block-editor-list-view__expander svg {
403
+ .block-editor-list-view-leaf[data-expanded="false"] .block-editor-list-view__expander svg {
392
404
  visibility: visible;
393
405
  transform: rotate(0deg);
394
406
  transition: transform 0.2s ease;
@@ -400,7 +412,9 @@ $block-navigation-max-indent: 8;
400
412
 
401
413
  .block-editor-list-view-drop-indicator__line {
402
414
  background: var(--wp-admin-theme-color);
403
- height: $border-width;
415
+ height: 6px;
416
+ border: 1px solid $white;
417
+ border-radius: 4px;
404
418
  }
405
419
  }
406
420
 
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { getListViewDropTarget } from '../use-list-view-drop-zone';
5
+
6
+ describe( 'getListViewDropTarget', () => {
7
+ const blocksData = [
8
+ {
9
+ blockIndex: 0,
10
+ canInsertDraggedBlocksAsChild: true,
11
+ canInsertDraggedBlocksAsSibling: true,
12
+ clientId: 'block-1',
13
+ element: {
14
+ getBoundingClientRect: () => ( {
15
+ top: 50,
16
+ bottom: 100,
17
+ left: 10,
18
+ right: 100,
19
+ x: 10,
20
+ y: 50,
21
+ width: 90,
22
+ height: 50,
23
+ } ),
24
+ },
25
+ innerBlockCount: 1,
26
+ isDraggedBlock: false,
27
+ isExpanded: true,
28
+ rootClientId: '',
29
+ },
30
+ {
31
+ blockIndex: 0,
32
+ canInsertDraggedBlocksAsChild: true,
33
+ canInsertDraggedBlocksAsSibling: true,
34
+ clientId: 'block-2',
35
+ element: {
36
+ getBoundingClientRect: () => ( {
37
+ top: 100,
38
+ bottom: 150,
39
+ left: 10,
40
+ right: 100,
41
+ x: 10,
42
+ y: 100,
43
+ width: 90,
44
+ height: 50,
45
+ } ),
46
+ },
47
+ innerBlockCount: 0,
48
+ isDraggedBlock: false,
49
+ isExpanded: false,
50
+ rootClientId: 'block-1',
51
+ },
52
+ {
53
+ blockIndex: 1,
54
+ canInsertDraggedBlocksAsChild: true,
55
+ canInsertDraggedBlocksAsSibling: true,
56
+ clientId: 'block-3',
57
+ element: {
58
+ getBoundingClientRect: () => ( {
59
+ top: 150,
60
+ bottom: 150,
61
+ left: 10,
62
+ right: 100,
63
+ x: 10,
64
+ y: 150,
65
+ width: 90,
66
+ height: 50,
67
+ } ),
68
+ },
69
+ innerBlockCount: 0,
70
+ isDraggedBlock: false,
71
+ isExpanded: false,
72
+ rootClientId: '',
73
+ },
74
+ ];
75
+
76
+ it( 'should return the correct target when dragging a block over the top half of the first block', () => {
77
+ const position = { x: 50, y: 70 };
78
+ const target = getListViewDropTarget( blocksData, position );
79
+
80
+ expect( target ).toEqual( {
81
+ blockIndex: 0,
82
+ clientId: 'block-1',
83
+ dropPosition: 'top',
84
+ rootClientId: '',
85
+ } );
86
+ } );
87
+
88
+ it( 'should nest when dragging a block over the bottom half of an expanded block', () => {
89
+ const position = { x: 50, y: 90 };
90
+ const target = getListViewDropTarget( blocksData, position );
91
+
92
+ expect( target ).toEqual( {
93
+ blockIndex: 0,
94
+ dropPosition: 'inside',
95
+ rootClientId: 'block-1',
96
+ } );
97
+ } );
98
+
99
+ 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 };
101
+
102
+ const collapsedBlockData = [ ...blocksData ];
103
+
104
+ // Set the first block to be collapsed.
105
+ collapsedBlockData[ 0 ] = {
106
+ ...collapsedBlockData[ 0 ],
107
+ isExpanded: false,
108
+ };
109
+
110
+ // Hide the first block's children.
111
+ collapsedBlockData.splice( 1, 1 );
112
+
113
+ const target = getListViewDropTarget( collapsedBlockData, position );
114
+
115
+ expect( target ).toEqual( {
116
+ blockIndex: 0,
117
+ dropPosition: 'inside',
118
+ rootClientId: 'block-1',
119
+ } );
120
+ } );
121
+
122
+ it( 'should drag below when dragging a block over the left side and bottom half of a collapsed block with children', () => {
123
+ const position = { x: 30, y: 90 };
124
+
125
+ const collapsedBlockData = [ ...blocksData ];
126
+
127
+ // Set the first block to be collapsed.
128
+ collapsedBlockData[ 0 ] = {
129
+ ...collapsedBlockData[ 0 ],
130
+ isExpanded: false,
131
+ };
132
+
133
+ // Hide the first block's children.
134
+ collapsedBlockData.splice( 1, 1 );
135
+
136
+ const target = getListViewDropTarget( collapsedBlockData, position );
137
+
138
+ expect( target ).toEqual( {
139
+ blockIndex: 1,
140
+ clientId: 'block-1',
141
+ dropPosition: 'bottom',
142
+ rootClientId: '',
143
+ } );
144
+ } );
145
+
146
+ it( 'should drag below when attempting to nest but the dragged block is not allowed as a child', () => {
147
+ const position = { x: 70, y: 90 };
148
+
149
+ const childNotAllowedBlockData = [ ...blocksData ];
150
+
151
+ // Set the first block to not be allowed as a child.
152
+ childNotAllowedBlockData[ 0 ] = {
153
+ ...childNotAllowedBlockData[ 0 ],
154
+ canInsertDraggedBlocksAsChild: false,
155
+ };
156
+
157
+ const target = getListViewDropTarget(
158
+ childNotAllowedBlockData,
159
+ position
160
+ );
161
+
162
+ expect( target ).toEqual( {
163
+ blockIndex: 1,
164
+ clientId: 'block-1',
165
+ dropPosition: 'bottom',
166
+ rootClientId: '',
167
+ } );
168
+ } );
169
+
170
+ it( 'should return undefined when the dragged block cannot be inserted as a sibling', () => {
171
+ const position = { x: 50, y: 70 };
172
+
173
+ const siblingNotAllowedBlockData = [ ...blocksData ];
174
+
175
+ // Set the first block to not be allowed as a sibling.
176
+ siblingNotAllowedBlockData[ 0 ] = {
177
+ ...siblingNotAllowedBlockData[ 0 ],
178
+ canInsertDraggedBlocksAsSibling: false,
179
+ };
180
+
181
+ const target = getListViewDropTarget(
182
+ siblingNotAllowedBlockData,
183
+ position
184
+ );
185
+
186
+ expect( target ).toBeUndefined();
187
+ } );
188
+ } );
@@ -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
  [
@@ -9,7 +9,7 @@ import { useSelect } from '@wordpress/data';
9
9
  */
10
10
  import { store as blockEditorStore } from '../../store';
11
11
 
12
- export default function useListViewClientIds( blocks ) {
12
+ export default function useListViewClientIds( { blocks, rootClientId } ) {
13
13
  return useSelect(
14
14
  ( select ) => {
15
15
  const {
@@ -21,9 +21,11 @@ export default function useListViewClientIds( blocks ) {
21
21
  return {
22
22
  selectedClientIds: getSelectedBlockClientIds(),
23
23
  draggedClientIds: getDraggedBlockClientIds(),
24
- clientIdsTree: blocks ? blocks : __unstableGetClientIdsTree(),
24
+ clientIdsTree: blocks
25
+ ? blocks
26
+ : __unstableGetClientIdsTree( rootClientId ),
25
27
  };
26
28
  },
27
- [ blocks ]
29
+ [ blocks, rootClientId ]
28
30
  );
29
31
  }
@@ -36,6 +36,7 @@ import { store as blockEditorStore } from '../../store';
36
36
  * @property {Element} element The DOM element representing the block.
37
37
  * @property {number} innerBlockCount The number of inner blocks the block has.
38
38
  * @property {boolean} isDraggedBlock Whether the block is currently being dragged.
39
+ * @property {boolean} isExpanded Whether the block is expanded in the UI.
39
40
  * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block.
40
41
  * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.
41
42
  */
@@ -78,7 +79,7 @@ const ALLOWED_DROP_EDGES = [ 'top', 'bottom' ];
78
79
  *
79
80
  * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.
80
81
  */
81
- function getListViewDropTarget( blocksData, position ) {
82
+ export function getListViewDropTarget( blocksData, position ) {
82
83
  let candidateEdge;
83
84
  let candidateBlockData;
84
85
  let candidateDistance;
@@ -146,12 +147,15 @@ function getListViewDropTarget( blocksData, position ) {
146
147
 
147
148
  // If the user is dragging towards the bottom of the block check whether
148
149
  // they might be trying to nest the block as a child.
149
- // If the block already has inner blocks, this should always be treated
150
+ // If the block already has inner blocks, and is expanded, this should be treated
150
151
  // as nesting since the next block in the tree will be the first child.
152
+ // However, if the block is collapsed, dragging beneath the block should
153
+ // still be allowed, as the next visible block in the tree will be a sibling.
151
154
  if (
152
155
  isDraggingBelow &&
153
156
  candidateBlockData.canInsertDraggedBlocksAsChild &&
154
- ( candidateBlockData.innerBlockCount > 0 ||
157
+ ( ( candidateBlockData.innerBlockCount > 0 &&
158
+ candidateBlockData.isExpanded ) ||
155
159
  isNestingGesture( position, candidateRect ) )
156
160
  ) {
157
161
  return {
@@ -208,10 +212,12 @@ export default function useListViewDropZone() {
208
212
 
209
213
  const blocksData = blockElements.map( ( blockElement ) => {
210
214
  const clientId = blockElement.dataset.block;
215
+ const isExpanded = blockElement.dataset.expanded === 'true';
211
216
  const rootClientId = getBlockRootClientId( clientId );
212
217
 
213
218
  return {
214
219
  clientId,
220
+ isExpanded,
215
221
  rootClientId,
216
222
  blockIndex: getBlockIndex( clientId ),
217
223
  element: blockElement,
@@ -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
@@ -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. */
@@ -19,6 +19,7 @@ import { store as blockEditorStore } from '../../store';
19
19
  import { updateAttributes } from './update-attributes';
20
20
  import { LinkUI } from './link-ui';
21
21
  import { useInsertedBlock } from './use-inserted-block';
22
+ import { useListViewContext } from './context';
22
23
 
23
24
  const BLOCKS_WITH_LINK_UI_SUPPORT = [
24
25
  'core/navigation-link',
@@ -90,6 +91,8 @@ const ListViewBlockContents = forwardRef(
90
91
  hasExistingLinkValue,
91
92
  ] );
92
93
 
94
+ const { renderAdditionalBlockUI } = useListViewContext();
95
+
93
96
  const isBlockMoveTarget =
94
97
  blockMovingClientId && selectedBlockInBlockEditor === clientId;
95
98
 
@@ -107,6 +110,7 @@ const ListViewBlockContents = forwardRef(
107
110
 
108
111
  return (
109
112
  <>
113
+ { renderAdditionalBlockUI && renderAdditionalBlockUI( block ) }
110
114
  { isLinkUIOpen && (
111
115
  <LinkUI
112
116
  clientId={ lastInsertedBlockClientId }