@wordpress/block-editor 12.0.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 (311) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -1
  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-list/block-invalid-warning.native.js +15 -7
  12. package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
  13. package/build/components/block-list/block-list-item-cell.native.js +15 -2
  14. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  15. package/build/components/block-list/block-list-item.native.js +158 -195
  16. package/build/components/block-list/block-list-item.native.js.map +1 -1
  17. package/build/components/block-list/block-outline.native.js +57 -0
  18. package/build/components/block-list/block-outline.native.js.map +1 -0
  19. package/build/components/block-list/block.native.js +343 -299
  20. package/build/components/block-list/block.native.js.map +1 -1
  21. package/build/components/block-list/index.native.js +202 -298
  22. package/build/components/block-list/index.native.js.map +1 -1
  23. package/build/components/block-list/insertion-point.native.js +4 -2
  24. package/build/components/block-list/insertion-point.native.js.map +1 -1
  25. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  26. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  27. package/build/components/block-settings-menu/block-settings-dropdown.js +8 -10
  28. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  29. package/build/components/block-settings-menu-controls/index.js +15 -4
  30. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  31. package/build/components/block-tools/block-contextual-toolbar.js +17 -62
  32. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  33. package/build/components/block-tools/selected-block-popover.js +3 -8
  34. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  35. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
  36. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  37. package/build/components/global-styles/advanced-panel.js +86 -0
  38. package/build/components/global-styles/advanced-panel.js.map +1 -0
  39. package/build/components/global-styles/color-panel.js +4 -1
  40. package/build/components/global-styles/color-panel.js.map +1 -1
  41. package/build/components/global-styles/dimensions-panel.js +6 -6
  42. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  43. package/build/components/global-styles/hooks.js +1 -2
  44. package/build/components/global-styles/hooks.js.map +1 -1
  45. package/build/components/global-styles/index.js +24 -0
  46. package/build/components/global-styles/index.js.map +1 -1
  47. package/build/components/global-styles/typography-panel.js +1 -1
  48. package/build/components/global-styles/typography-panel.js.map +1 -1
  49. package/build/components/global-styles/use-global-styles-output.js +27 -4
  50. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  51. package/build/components/global-styles/utils.js +30 -0
  52. package/build/components/global-styles/utils.js.map +1 -1
  53. package/build/components/image-editor/use-save-image.js +24 -8
  54. package/build/components/image-editor/use-save-image.js.map +1 -1
  55. package/build/components/inserter-draggable-blocks/index.js +5 -0
  56. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  57. package/build/components/inspector-controls/fill.js +1 -1
  58. package/build/components/inspector-controls/fill.js.map +1 -1
  59. package/build/components/inspector-controls/fill.native.js +1 -1
  60. package/build/components/inspector-controls/fill.native.js.map +1 -1
  61. package/build/components/inspector-controls/slot.js +3 -6
  62. package/build/components/inspector-controls/slot.js.map +1 -1
  63. package/build/components/inspector-controls/slot.native.js +1 -1
  64. package/build/components/inspector-controls/slot.native.js.map +1 -1
  65. package/build/components/line-height-control/index.js +7 -2
  66. package/build/components/line-height-control/index.js.map +1 -1
  67. package/build/components/link-control/use-internal-input-value.js +9 -8
  68. package/build/components/link-control/use-internal-input-value.js.map +1 -1
  69. package/build/components/list-view/block-contents.js +7 -2
  70. package/build/components/list-view/block-contents.js.map +1 -1
  71. package/build/components/list-view/block-select-button.js +2 -1
  72. package/build/components/list-view/block-select-button.js.map +1 -1
  73. package/build/components/list-view/block.js +4 -4
  74. package/build/components/list-view/block.js.map +1 -1
  75. package/build/components/list-view/index.js +32 -18
  76. package/build/components/list-view/index.js.map +1 -1
  77. package/build/components/list-view/use-list-view-drop-zone.js +163 -11
  78. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  79. package/build/components/media-placeholder/index.js +68 -7
  80. package/build/components/media-placeholder/index.js.map +1 -1
  81. package/build/components/multi-selection-inspector/index.js +2 -2
  82. package/build/components/multi-selection-inspector/index.js.map +1 -1
  83. package/build/components/off-canvas-editor/leaf-more-menu.js +3 -1
  84. package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  85. package/build/components/preview-options/index.js +6 -1
  86. package/build/components/preview-options/index.js.map +1 -1
  87. package/build/components/spacing-sizes-control/spacing-input-control.js +1 -1
  88. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  89. package/build/components/url-input/index.js +1 -2
  90. package/build/components/url-input/index.js.map +1 -1
  91. package/build/hooks/align.js +1 -1
  92. package/build/hooks/align.js.map +1 -1
  93. package/build/hooks/border.js +1 -1
  94. package/build/hooks/border.js.map +1 -1
  95. package/build/hooks/color.js +1 -1
  96. package/build/hooks/color.js.map +1 -1
  97. package/build/hooks/content-lock-ui.js +8 -12
  98. package/build/hooks/content-lock-ui.js.map +1 -1
  99. package/build/hooks/duotone.js +1 -1
  100. package/build/hooks/duotone.js.map +1 -1
  101. package/build/hooks/index.native.js +8 -0
  102. package/build/hooks/index.native.js.map +1 -1
  103. package/build/hooks/layout.js +2 -2
  104. package/build/hooks/layout.js.map +1 -1
  105. package/build/hooks/position.js +1 -1
  106. package/build/hooks/position.js.map +1 -1
  107. package/build/hooks/style.js +1 -1
  108. package/build/hooks/style.js.map +1 -1
  109. package/build/hooks/use-editor-wrapper-styles.native.js +255 -0
  110. package/build/hooks/use-editor-wrapper-styles.native.js.map +1 -0
  111. package/build/hooks/use-typography-props.js +14 -10
  112. package/build/hooks/use-typography-props.js.map +1 -1
  113. package/build/index.native.js +31 -0
  114. package/build/index.native.js.map +1 -0
  115. package/build/utils/use-should-contextual-toolbar-show.js +16 -12
  116. package/build/utils/use-should-contextual-toolbar-show.js.map +1 -1
  117. package/build-module/components/block-controls/slot.js +11 -4
  118. package/build-module/components/block-controls/slot.js.map +1 -1
  119. package/build-module/components/block-controls/slot.native.js +9 -1
  120. package/build-module/components/block-controls/slot.native.js.map +1 -1
  121. package/build-module/components/block-draggable/index.js +10 -6
  122. package/build-module/components/block-draggable/index.js.map +1 -1
  123. package/build-module/components/block-draggable/use-scroll-when-dragging.js +2 -2
  124. package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  125. package/build-module/components/block-list/block-invalid-warning.native.js +16 -8
  126. package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
  127. package/build-module/components/block-list/block-list-item-cell.native.js +13 -2
  128. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
  129. package/build-module/components/block-list/block-list-item.native.js +160 -190
  130. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  131. package/build-module/components/block-list/block-outline.native.js +44 -0
  132. package/build-module/components/block-list/block-outline.native.js.map +1 -0
  133. package/build-module/components/block-list/block.native.js +341 -298
  134. package/build-module/components/block-list/block.native.js.map +1 -1
  135. package/build-module/components/block-list/index.native.js +203 -293
  136. package/build-module/components/block-list/index.native.js.map +1 -1
  137. package/build-module/components/block-list/insertion-point.native.js +4 -2
  138. package/build-module/components/block-list/insertion-point.native.js.map +1 -1
  139. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  140. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  141. package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -9
  142. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  143. package/build-module/components/block-settings-menu-controls/index.js +13 -5
  144. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  145. package/build-module/components/block-tools/block-contextual-toolbar.js +18 -62
  146. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  147. package/build-module/components/block-tools/selected-block-popover.js +3 -7
  148. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  149. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
  150. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  151. package/build-module/components/global-styles/advanced-panel.js +74 -0
  152. package/build-module/components/global-styles/advanced-panel.js.map +1 -0
  153. package/build-module/components/global-styles/color-panel.js +5 -2
  154. package/build-module/components/global-styles/color-panel.js.map +1 -1
  155. package/build-module/components/global-styles/dimensions-panel.js +6 -6
  156. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  157. package/build-module/components/global-styles/hooks.js +1 -2
  158. package/build-module/components/global-styles/hooks.js.map +1 -1
  159. package/build-module/components/global-styles/index.js +3 -1
  160. package/build-module/components/global-styles/index.js.map +1 -1
  161. package/build-module/components/global-styles/typography-panel.js +1 -1
  162. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  163. package/build-module/components/global-styles/use-global-styles-output.js +25 -4
  164. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  165. package/build-module/components/global-styles/utils.js +25 -0
  166. package/build-module/components/global-styles/utils.js.map +1 -1
  167. package/build-module/components/image-editor/use-save-image.js +24 -8
  168. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  169. package/build-module/components/inserter-draggable-blocks/index.js +4 -0
  170. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  171. package/build-module/components/inspector-controls/fill.js +1 -1
  172. package/build-module/components/inspector-controls/fill.js.map +1 -1
  173. package/build-module/components/inspector-controls/fill.native.js +1 -1
  174. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  175. package/build-module/components/inspector-controls/slot.js +4 -7
  176. package/build-module/components/inspector-controls/slot.js.map +1 -1
  177. package/build-module/components/inspector-controls/slot.native.js +1 -1
  178. package/build-module/components/inspector-controls/slot.native.js.map +1 -1
  179. package/build-module/components/line-height-control/index.js +7 -2
  180. package/build-module/components/line-height-control/index.js.map +1 -1
  181. package/build-module/components/link-control/use-internal-input-value.js +9 -8
  182. package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
  183. package/build-module/components/list-view/block-contents.js +7 -3
  184. package/build-module/components/list-view/block-contents.js.map +1 -1
  185. package/build-module/components/list-view/block-select-button.js +2 -1
  186. package/build-module/components/list-view/block-select-button.js.map +1 -1
  187. package/build-module/components/list-view/block.js +4 -4
  188. package/build-module/components/list-view/block.js.map +1 -1
  189. package/build-module/components/list-view/index.js +32 -18
  190. package/build-module/components/list-view/index.js.map +1 -1
  191. package/build-module/components/list-view/use-list-view-drop-zone.js +160 -11
  192. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  193. package/build-module/components/media-placeholder/index.js +66 -7
  194. package/build-module/components/media-placeholder/index.js.map +1 -1
  195. package/build-module/components/multi-selection-inspector/index.js +2 -2
  196. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  197. package/build-module/components/off-canvas-editor/leaf-more-menu.js +3 -1
  198. package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  199. package/build-module/components/preview-options/index.js +7 -2
  200. package/build-module/components/preview-options/index.js.map +1 -1
  201. package/build-module/components/spacing-sizes-control/spacing-input-control.js +1 -1
  202. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  203. package/build-module/components/url-input/index.js +1 -2
  204. package/build-module/components/url-input/index.js.map +1 -1
  205. package/build-module/hooks/align.js +1 -1
  206. package/build-module/hooks/align.js.map +1 -1
  207. package/build-module/hooks/border.js +1 -1
  208. package/build-module/hooks/border.js.map +1 -1
  209. package/build-module/hooks/color.js +1 -1
  210. package/build-module/hooks/color.js.map +1 -1
  211. package/build-module/hooks/content-lock-ui.js +8 -11
  212. package/build-module/hooks/content-lock-ui.js.map +1 -1
  213. package/build-module/hooks/duotone.js +1 -1
  214. package/build-module/hooks/duotone.js.map +1 -1
  215. package/build-module/hooks/index.native.js +1 -0
  216. package/build-module/hooks/index.native.js.map +1 -1
  217. package/build-module/hooks/layout.js +2 -2
  218. package/build-module/hooks/layout.js.map +1 -1
  219. package/build-module/hooks/position.js +1 -1
  220. package/build-module/hooks/position.js.map +1 -1
  221. package/build-module/hooks/style.js +1 -1
  222. package/build-module/hooks/style.js.map +1 -1
  223. package/build-module/hooks/use-editor-wrapper-styles.native.js +242 -0
  224. package/build-module/hooks/use-editor-wrapper-styles.native.js.map +1 -0
  225. package/build-module/hooks/use-typography-props.js +14 -10
  226. package/build-module/hooks/use-typography-props.js.map +1 -1
  227. package/build-module/index.native.js +6 -0
  228. package/build-module/index.native.js.map +1 -0
  229. package/build-module/utils/use-should-contextual-toolbar-show.js +16 -12
  230. package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -1
  231. package/build-style/content-rtl.css +0 -1
  232. package/build-style/content.css +0 -1
  233. package/build-style/style-rtl.css +37 -13
  234. package/build-style/style.css +37 -13
  235. package/package.json +31 -31
  236. package/src/components/block-breadcrumb/style.scss +2 -1
  237. package/src/components/block-controls/slot.js +8 -4
  238. package/src/components/block-controls/slot.native.js +6 -1
  239. package/src/components/block-draggable/index.js +10 -6
  240. package/src/components/block-draggable/use-scroll-when-dragging.js +8 -2
  241. package/src/components/block-list/block-invalid-warning.native.js +17 -9
  242. package/src/components/block-list/block-list-item-cell.native.js +10 -1
  243. package/src/components/block-list/block-list-item.native.js +180 -208
  244. package/src/components/block-list/block-outline.native.js +58 -0
  245. package/src/components/block-list/block.native.js +564 -523
  246. package/src/components/block-list/content.scss +0 -1
  247. package/src/components/block-list/index.native.js +229 -298
  248. package/src/components/block-list/insertion-point.native.js +2 -2
  249. package/src/components/block-list/test/block-invalid-warning.native.js +48 -0
  250. package/src/components/block-list/test/index.native.js +205 -0
  251. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -1
  252. package/src/components/block-pattern-setup/style.scss +1 -4
  253. package/src/components/block-patterns-list/style.scss +1 -4
  254. package/src/components/block-settings-menu/block-settings-dropdown.js +10 -17
  255. package/src/components/block-settings-menu-controls/index.js +24 -4
  256. package/src/components/block-styles/style.scss +4 -4
  257. package/src/components/block-tools/block-contextual-toolbar.js +28 -62
  258. package/src/components/block-tools/selected-block-popover.js +3 -5
  259. package/src/components/block-tools/style.scss +8 -0
  260. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +16 -2
  261. package/src/components/global-styles/advanced-panel.js +82 -0
  262. package/src/components/global-styles/color-panel.js +6 -1
  263. package/src/components/global-styles/dimensions-panel.js +6 -6
  264. package/src/components/global-styles/hooks.js +1 -5
  265. package/src/components/global-styles/index.js +6 -1
  266. package/src/components/global-styles/style.scss +14 -0
  267. package/src/components/global-styles/test/utils.js +57 -1
  268. package/src/components/global-styles/typography-panel.js +1 -1
  269. package/src/components/global-styles/use-global-styles-output.js +21 -3
  270. package/src/components/global-styles/utils.js +27 -0
  271. package/src/components/image-editor/use-save-image.js +20 -9
  272. package/src/components/inserter-draggable-blocks/index.js +4 -0
  273. package/src/components/inspector-controls/fill.js +1 -1
  274. package/src/components/inspector-controls/fill.native.js +1 -1
  275. package/src/components/inspector-controls/slot.js +4 -9
  276. package/src/components/inspector-controls/slot.native.js +1 -1
  277. package/src/components/line-height-control/index.js +7 -2
  278. package/src/components/line-height-control/stories/index.js +1 -1
  279. package/src/components/link-control/test/index.js +42 -0
  280. package/src/components/link-control/use-internal-input-value.js +8 -7
  281. package/src/components/list-view/block-contents.js +26 -20
  282. package/src/components/list-view/block-select-button.js +5 -1
  283. package/src/components/list-view/block.js +5 -2
  284. package/src/components/list-view/index.js +26 -14
  285. package/src/components/list-view/style.scss +5 -2
  286. package/src/components/list-view/test/use-list-view-drop-zone.js +88 -12
  287. package/src/components/list-view/use-list-view-drop-zone.js +194 -11
  288. package/src/components/media-placeholder/index.js +74 -1
  289. package/src/components/multi-selection-inspector/index.js +2 -2
  290. package/src/components/off-canvas-editor/leaf-more-menu.js +2 -1
  291. package/src/components/preview-options/index.js +9 -2
  292. package/src/components/spacing-sizes-control/spacing-input-control.js +1 -0
  293. package/src/components/url-input/index.js +1 -2
  294. package/src/hooks/align.js +2 -1
  295. package/src/hooks/border.js +2 -1
  296. package/src/hooks/color.js +2 -1
  297. package/src/hooks/content-lock-ui.js +3 -15
  298. package/src/hooks/duotone.js +1 -0
  299. package/src/hooks/index.native.js +1 -0
  300. package/src/hooks/layout.js +4 -2
  301. package/src/hooks/position.js +2 -1
  302. package/src/hooks/style.js +2 -1
  303. package/src/hooks/test/use-editor-wrapper-styles.native.js +282 -0
  304. package/src/hooks/test/use-typography-props.js +47 -2
  305. package/src/hooks/use-editor-wrapper-styles.native.js +250 -0
  306. package/src/hooks/use-editor-wrapper-styles.native.scss +11 -0
  307. package/src/hooks/use-typography-props.js +10 -11
  308. package/src/index.native.js +6 -0
  309. package/src/utils/use-should-contextual-toolbar-show.js +19 -9
  310. package/tsconfig.json +1 -0
  311. package/tsconfig.tsbuildinfo +1 -1
@@ -56,16 +56,18 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36;
56
56
  /**
57
57
  * Show a hierarchical list of blocks.
58
58
  *
59
- * @param {Object} props Components props.
60
- * @param {string} props.id An HTML element id for the root element of ListView.
61
- * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.
62
- * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.
63
- * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.
64
- * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.
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.
68
- * @param {Ref} ref Forwarded ref
59
+ * @param {Object} props Components props.
60
+ * @param {string} props.id An HTML element id for the root element of ListView.
61
+ * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.
62
+ * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.
63
+ * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.
64
+ * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.
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.
68
+ * @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected.
69
+ * @param {Function} props.renderAdditionalBlockUI Function that renders additional block content UI.
70
+ * @param {Ref} ref Forwarded ref
69
71
  */
70
72
  function ListViewComponent(
71
73
  {
@@ -77,6 +79,8 @@ function ListViewComponent(
77
79
  blockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,
78
80
  rootClientId,
79
81
  description,
82
+ onSelect,
83
+ renderAdditionalBlockUI,
80
84
  },
81
85
  ref
82
86
  ) {
@@ -95,6 +99,7 @@ function ListViewComponent(
95
99
  const { clientIdsTree, draggedClientIds, selectedClientIds } =
96
100
  useListViewClientIds( { blocks, rootClientId } );
97
101
 
102
+ const { getBlock } = useSelect( blockEditorStore );
98
103
  const { visibleBlockCount, shouldShowInnerBlocks } = useSelect(
99
104
  ( select ) => {
100
105
  const {
@@ -128,11 +133,14 @@ function ListViewComponent(
128
133
  setExpandedState,
129
134
  } );
130
135
  const selectEditorBlock = useCallback(
131
- ( event, clientId ) => {
132
- updateBlockSelection( event, clientId );
133
- setSelectedTreeId( clientId );
136
+ ( event, blockClientId ) => {
137
+ updateBlockSelection( event, blockClientId );
138
+ setSelectedTreeId( blockClientId );
139
+ if ( onSelect ) {
140
+ onSelect( getBlock( blockClientId ) );
141
+ }
134
142
  },
135
- [ setSelectedTreeId, updateBlockSelection ]
143
+ [ setSelectedTreeId, updateBlockSelection, onSelect, getBlock ]
136
144
  );
137
145
  useEffect( () => {
138
146
  isMounted.current = true;
@@ -203,6 +211,7 @@ function ListViewComponent(
203
211
  collapse,
204
212
  BlockSettingsMenu,
205
213
  listViewInstanceId: instanceId,
214
+ renderAdditionalBlockUI,
206
215
  } ),
207
216
  [
208
217
  draggedClientIds,
@@ -211,6 +220,7 @@ function ListViewComponent(
211
220
  collapse,
212
221
  BlockSettingsMenu,
213
222
  instanceId,
223
+ renderAdditionalBlockUI,
214
224
  ]
215
225
  );
216
226
 
@@ -264,6 +274,8 @@ export default forwardRef( ( props, ref ) => {
264
274
  showAppender={ false }
265
275
  blockSettingsMenu={ BlockSettingsDropdown }
266
276
  rootClientId={ null }
277
+ onSelect={ null }
278
+ renderAdditionalBlockUICallback={ null }
267
279
  />
268
280
  );
269
281
  } );
@@ -15,10 +15,10 @@
15
15
  // Use position relative for row animation.
16
16
  position: relative;
17
17
 
18
- .components-button {
18
+ .block-editor-list-view-block-select-button {
19
19
  // When a row is expanded, retain the dark color.
20
20
  &[aria-expanded="true"] {
21
- color: $gray-900;
21
+ color: inherit;
22
22
  }
23
23
 
24
24
  // Ensure that on hover, the admin color is still used.
@@ -376,6 +376,9 @@ $block-navigation-max-indent: 8;
376
376
  }
377
377
  }
378
378
 
379
+ // When updating the margin for each indentation level, the corresponding
380
+ // indentation in `use-list-view-drop-zone.js` must be updated as well
381
+ // to ensure the drop zone is aligned with the indentation.
379
382
  @for $i from 0 to $block-navigation-max-indent {
380
383
  .block-editor-list-view-leaf[aria-level="#{ $i + 1 }"] .block-editor-list-view__expander {
381
384
  @if $i - 1 >= 0 {
@@ -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
 
@@ -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
  };
@@ -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>
@@ -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 );