@wordpress/block-editor 12.3.0 → 12.3.2

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 (971) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +13 -0
  3. package/build/autocompleters/block.js +5 -3
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/alignment-control/index.js +4 -6
  6. package/build/components/alignment-control/index.js.map +1 -1
  7. package/build/components/alignment-control/ui.js +5 -9
  8. package/build/components/alignment-control/ui.js.map +1 -1
  9. package/build/components/autocomplete/index.js +2 -4
  10. package/build/components/autocomplete/index.js.map +1 -1
  11. package/build/components/block-actions/index.js +4 -0
  12. package/build/components/block-actions/index.js.map +1 -1
  13. package/build/components/block-alignment-control/constants.js +1 -5
  14. package/build/components/block-alignment-control/constants.js.map +1 -1
  15. package/build/components/block-alignment-control/index.js +4 -6
  16. package/build/components/block-alignment-control/index.js.map +1 -1
  17. package/build/components/block-alignment-control/ui.js +3 -4
  18. package/build/components/block-alignment-control/ui.js.map +1 -1
  19. package/build/components/block-alignment-control/ui.native.js +3 -3
  20. package/build/components/block-alignment-control/ui.native.js.map +1 -1
  21. package/build/components/block-alignment-matrix-control/index.js +0 -1
  22. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  23. package/build/components/block-breadcrumb/index.js +2 -3
  24. package/build/components/block-breadcrumb/index.js.map +1 -1
  25. package/build/components/block-controls/fill.js +2 -1
  26. package/build/components/block-controls/fill.js.map +1 -1
  27. package/build/components/block-controls/index.js +8 -8
  28. package/build/components/block-controls/index.js.map +1 -1
  29. package/build/components/block-controls/slot.js +2 -4
  30. package/build/components/block-controls/slot.js.map +1 -1
  31. package/build/components/block-controls/slot.native.js +4 -2
  32. package/build/components/block-controls/slot.native.js.map +1 -1
  33. package/build/components/block-edit/edit.js +4 -6
  34. package/build/components/block-edit/edit.js.map +1 -1
  35. package/build/components/block-edit/edit.native.js +2 -4
  36. package/build/components/block-edit/edit.native.js.map +1 -1
  37. package/build/components/block-edit/index.js +3 -2
  38. package/build/components/block-edit/index.js.map +1 -1
  39. package/build/components/block-heading-level-dropdown/heading-level-icon.js +47 -0
  40. package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -0
  41. package/build/components/block-heading-level-dropdown/index.js +83 -0
  42. package/build/components/block-heading-level-dropdown/index.js.map +1 -0
  43. package/build/components/block-heading-level-dropdown/index.native.js +72 -0
  44. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -0
  45. package/build/components/block-icon/index.native.js +6 -7
  46. package/build/components/block-icon/index.native.js.map +1 -1
  47. package/build/components/block-info-slot-fill/index.js +4 -2
  48. package/build/components/block-info-slot-fill/index.js.map +1 -1
  49. package/build/components/block-inspector/index.js +20 -87
  50. package/build/components/block-inspector/index.js.map +1 -1
  51. package/build/components/block-list/block-list-item.native.js +4 -2
  52. package/build/components/block-list/block-list-item.native.js.map +1 -1
  53. package/build/components/block-list/block.js +6 -4
  54. package/build/components/block-list/block.js.map +1 -1
  55. package/build/components/block-list/block.native.js +1 -0
  56. package/build/components/block-list/block.native.js.map +1 -1
  57. package/build/components/block-list/index.js +7 -4
  58. package/build/components/block-list/index.js.map +1 -1
  59. package/build/components/block-list/index.native.js +8 -9
  60. package/build/components/block-list/index.native.js.map +1 -1
  61. package/build/components/block-list/subdirectory-icon.js +4 -7
  62. package/build/components/block-list/subdirectory-icon.js.map +1 -1
  63. package/build/components/block-list/use-in-between-inserter.js +1 -3
  64. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  65. package/build/components/block-list-appender/index.js +21 -19
  66. package/build/components/block-list-appender/index.js.map +1 -1
  67. package/build/components/block-lock/toolbar.js +25 -6
  68. package/build/components/block-lock/toolbar.js.map +1 -1
  69. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  70. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  71. package/build/components/block-mover/button.js +12 -12
  72. package/build/components/block-mover/button.js.map +1 -1
  73. package/build/components/block-mover/index.js +11 -10
  74. package/build/components/block-mover/index.js.map +1 -1
  75. package/build/components/block-navigation/dropdown.js +4 -6
  76. package/build/components/block-navigation/dropdown.js.map +1 -1
  77. package/build/components/block-parent-selector/index.js +4 -5
  78. package/build/components/block-parent-selector/index.js.map +1 -1
  79. package/build/components/block-pattern-setup/index.js +6 -8
  80. package/build/components/block-pattern-setup/index.js.map +1 -1
  81. package/build/components/block-patterns-list/index.js +6 -8
  82. package/build/components/block-patterns-list/index.js.map +1 -1
  83. package/build/components/block-popover/inbetween.js +4 -6
  84. package/build/components/block-popover/inbetween.js.map +1 -1
  85. package/build/components/block-popover/index.js +4 -6
  86. package/build/components/block-popover/index.js.map +1 -1
  87. package/build/components/block-preview/auto.js +2 -4
  88. package/build/components/block-preview/auto.js.map +1 -1
  89. package/build/components/block-preview/index.js +7 -7
  90. package/build/components/block-preview/index.js.map +1 -1
  91. package/build/components/block-quick-navigation/index.js +83 -0
  92. package/build/components/block-quick-navigation/index.js.map +1 -0
  93. package/build/components/block-removal-warning-modal/index.js +90 -0
  94. package/build/components/block-removal-warning-modal/index.js.map +1 -0
  95. package/build/components/block-selection-clearer/index.js +4 -7
  96. package/build/components/block-selection-clearer/index.js.map +1 -1
  97. package/build/components/block-settings/button.native.js +2 -1
  98. package/build/components/block-settings/button.native.js.map +1 -1
  99. package/build/components/block-settings/container.native.js +6 -6
  100. package/build/components/block-settings/container.native.js.map +1 -1
  101. package/build/components/block-settings-menu/block-settings-dropdown.js +10 -11
  102. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  103. package/build/components/block-settings-menu/index.js +4 -5
  104. package/build/components/block-settings-menu/index.js.map +1 -1
  105. package/build/components/block-settings-menu-controls/index.js +4 -5
  106. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  107. package/build/components/block-switcher/index.js +1 -2
  108. package/build/components/block-switcher/index.js.map +1 -1
  109. package/build/components/block-switcher/pattern-transformations-menu.js +6 -8
  110. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  111. package/build/components/block-toolbar/index.js +10 -8
  112. package/build/components/block-toolbar/index.js.map +1 -1
  113. package/build/components/block-tools/block-contextual-toolbar.js +4 -5
  114. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  115. package/build/components/block-tools/block-selection-button.js +4 -5
  116. package/build/components/block-tools/block-selection-button.js.map +1 -1
  117. package/build/components/block-tools/index.js +13 -6
  118. package/build/components/block-tools/index.js.map +1 -1
  119. package/build/components/block-tools/insertion-point.js +5 -5
  120. package/build/components/block-tools/insertion-point.js.map +1 -1
  121. package/build/components/block-tools/selected-block-popover.js +8 -8
  122. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  123. package/build/components/block-types-list/index.native.js +4 -6
  124. package/build/components/block-types-list/index.native.js.map +1 -1
  125. package/build/components/block-vertical-alignment-control/index.js +4 -6
  126. package/build/components/block-vertical-alignment-control/index.js.map +1 -1
  127. package/build/components/block-vertical-alignment-control/ui.js +5 -12
  128. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  129. package/build/components/border-radius-control/all-input-control.js +2 -6
  130. package/build/components/border-radius-control/all-input-control.js.map +1 -1
  131. package/build/components/border-radius-control/input-controls.js +2 -6
  132. package/build/components/border-radius-control/input-controls.js.map +1 -1
  133. package/build/components/border-radius-control/linked-button.js +2 -6
  134. package/build/components/border-radius-control/linked-button.js.map +1 -1
  135. package/build/components/color-palette/control.js +2 -4
  136. package/build/components/color-palette/control.js.map +1 -1
  137. package/build/components/color-palette/with-color-context.js +2 -4
  138. package/build/components/color-palette/with-color-context.js.map +1 -1
  139. package/build/components/colors/utils.js +7 -3
  140. package/build/components/colors/utils.js.map +1 -1
  141. package/build/components/colors/with-colors.js +11 -16
  142. package/build/components/colors/with-colors.js.map +1 -1
  143. package/build/components/colors-gradients/control.js +7 -5
  144. package/build/components/colors-gradients/control.js.map +1 -1
  145. package/build/components/colors-gradients/dropdown.js +12 -11
  146. package/build/components/colors-gradients/dropdown.js.map +1 -1
  147. package/build/components/colors-gradients/panel-color-gradient-settings.js +7 -5
  148. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  149. package/build/components/copy-handler/index.js +5 -6
  150. package/build/components/copy-handler/index.js.map +1 -1
  151. package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
  152. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  153. package/build/components/dimensions-tool/index.js +207 -0
  154. package/build/components/dimensions-tool/index.js.map +1 -0
  155. package/build/components/dimensions-tool/scale-tool.js +111 -0
  156. package/build/components/dimensions-tool/scale-tool.js.map +1 -0
  157. package/build/components/dimensions-tool/width-height-tool.js +125 -0
  158. package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
  159. package/build/components/duotone-control/index.js +1 -2
  160. package/build/components/duotone-control/index.js.map +1 -1
  161. package/build/components/editable-text/index.js +6 -7
  162. package/build/components/editable-text/index.js.map +1 -1
  163. package/build/components/font-appearance-control/index.js +2 -6
  164. package/build/components/font-appearance-control/index.js.map +1 -1
  165. package/build/components/font-family/index.js +4 -5
  166. package/build/components/font-family/index.js.map +1 -1
  167. package/build/components/font-sizes/font-size-picker.js +2 -4
  168. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  169. package/build/components/font-sizes/utils.js +3 -3
  170. package/build/components/font-sizes/utils.js.map +1 -1
  171. package/build/components/font-sizes/with-font-sizes.js +7 -7
  172. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  173. package/build/components/global-styles/color-panel.js +15 -16
  174. package/build/components/global-styles/color-panel.js.map +1 -1
  175. package/build/components/global-styles/effects-panel.js +2 -1
  176. package/build/components/global-styles/effects-panel.js.map +1 -1
  177. package/build/components/global-styles/filters-panel.js +2 -1
  178. package/build/components/global-styles/filters-panel.js.map +1 -1
  179. package/build/components/global-styles/index.js +6 -0
  180. package/build/components/global-styles/index.js.map +1 -1
  181. package/build/components/global-styles/typography-panel.js +7 -7
  182. package/build/components/global-styles/typography-panel.js.map +1 -1
  183. package/build/components/global-styles/use-global-styles-output.js +19 -16
  184. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  185. package/build/components/gradients/with-gradient.js +2 -6
  186. package/build/components/gradients/with-gradient.js.map +1 -1
  187. package/build/components/iframe/index.js +5 -7
  188. package/build/components/iframe/index.js.map +1 -1
  189. package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
  190. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  191. package/build/components/image-editor/constants.js +1 -2
  192. package/build/components/image-editor/constants.js.map +1 -1
  193. package/build/components/image-editor/use-save-image.js +1 -2
  194. package/build/components/image-editor/use-save-image.js.map +1 -1
  195. package/build/components/image-size-control/index.js +6 -0
  196. package/build/components/image-size-control/index.js.map +1 -1
  197. package/build/components/index.js +9 -9
  198. package/build/components/index.js.map +1 -1
  199. package/build/components/index.native.js +9 -0
  200. package/build/components/index.native.js.map +1 -1
  201. package/build/components/inner-blocks/index.js +9 -8
  202. package/build/components/inner-blocks/index.js.map +1 -1
  203. package/build/components/inner-blocks/index.native.js +8 -7
  204. package/build/components/inner-blocks/index.native.js.map +1 -1
  205. package/build/components/inner-blocks/use-nested-settings-update.js +24 -30
  206. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  207. package/build/components/inner-blocks/with-client-id.js +2 -6
  208. package/build/components/inner-blocks/with-client-id.js.map +1 -1
  209. package/build/components/inserter/block-patterns-explorer/explorer.js +2 -1
  210. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  211. package/build/components/inserter/block-patterns-tab.js +33 -5
  212. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  213. package/build/components/inserter/hooks/use-block-types-state.js +4 -3
  214. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  215. package/build/components/inserter/hooks/use-insertion-point.js +1 -1
  216. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  217. package/build/components/inserter/index.js +8 -8
  218. package/build/components/inserter/index.js.map +1 -1
  219. package/build/components/inserter/index.native.js +4 -5
  220. package/build/components/inserter/index.native.js.map +1 -1
  221. package/build/components/inserter/library.js +1 -1
  222. package/build/components/inserter/library.js.map +1 -1
  223. package/build/components/inserter/media-tab/media-list.js +2 -6
  224. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  225. package/build/components/inserter/media-tab/media-preview.js +4 -6
  226. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  227. package/build/components/inserter/media-tab/media-tab.js +1 -1
  228. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  229. package/build/components/inserter/reusable-blocks-tab.js +3 -3
  230. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  231. package/build/components/inserter/tabs.js +3 -3
  232. package/build/components/inserter/tabs.js.map +1 -1
  233. package/build/components/inserter-list-item/index.js +4 -5
  234. package/build/components/inserter-list-item/index.js.map +1 -1
  235. package/build/components/inserter-listbox/group.js +4 -7
  236. package/build/components/inserter-listbox/group.js.map +1 -1
  237. package/build/components/inserter-listbox/item.js +8 -7
  238. package/build/components/inserter-listbox/item.js.map +1 -1
  239. package/build/components/inserter-listbox/row.js +4 -5
  240. package/build/components/inserter-listbox/row.js.map +1 -1
  241. package/build/components/inspector-controls/block-support-slot-container.js +2 -6
  242. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
  243. package/build/components/inspector-controls/fill.native.js +2 -1
  244. package/build/components/inspector-controls/fill.native.js.map +1 -1
  245. package/build/components/inspector-controls/index.js +4 -6
  246. package/build/components/inspector-controls/index.js.map +1 -1
  247. package/build/components/inspector-controls/slot.js +4 -6
  248. package/build/components/inspector-controls/slot.js.map +1 -1
  249. package/build/components/inspector-controls/slot.native.js +2 -1
  250. package/build/components/inspector-controls/slot.native.js.map +1 -1
  251. package/build/components/justify-content-control/index.js +4 -6
  252. package/build/components/justify-content-control/index.js.map +1 -1
  253. package/build/components/justify-content-control/ui.js +4 -7
  254. package/build/components/justify-content-control/ui.js.map +1 -1
  255. package/build/components/letter-spacing-control/index.js +2 -4
  256. package/build/components/letter-spacing-control/index.js.map +1 -1
  257. package/build/components/line-height-control/index.js +2 -4
  258. package/build/components/line-height-control/index.js.map +1 -1
  259. package/build/components/link-control/index.js +20 -24
  260. package/build/components/link-control/index.js.map +1 -1
  261. package/build/components/link-control/search-create-button.js +2 -4
  262. package/build/components/link-control/search-create-button.js.map +1 -1
  263. package/build/components/link-control/search-input.js +7 -5
  264. package/build/components/link-control/search-input.js.map +1 -1
  265. package/build/components/link-control/search-item.js +2 -4
  266. package/build/components/link-control/search-item.js.map +1 -1
  267. package/build/components/link-control/search-results.js +2 -4
  268. package/build/components/link-control/search-results.js.map +1 -1
  269. package/build/components/link-control/settings-drawer.js +2 -3
  270. package/build/components/link-control/settings-drawer.js.map +1 -1
  271. package/build/components/list-view/appender.js +4 -6
  272. package/build/components/list-view/appender.js.map +1 -1
  273. package/build/components/list-view/aria-referenced-text.js +4 -8
  274. package/build/components/list-view/aria-referenced-text.js.map +1 -1
  275. package/build/components/list-view/block-contents.js +4 -5
  276. package/build/components/list-view/block-contents.js.map +1 -1
  277. package/build/components/list-view/block-select-button.js +13 -2
  278. package/build/components/list-view/block-select-button.js.map +1 -1
  279. package/build/components/list-view/branch.js +9 -8
  280. package/build/components/list-view/branch.js.map +1 -1
  281. package/build/components/list-view/drop-indicator.js +62 -11
  282. package/build/components/list-view/drop-indicator.js.map +1 -1
  283. package/build/components/list-view/index.js +4 -6
  284. package/build/components/list-view/index.js.map +1 -1
  285. package/build/components/list-view/leaf.js +4 -5
  286. package/build/components/list-view/leaf.js.map +1 -1
  287. package/build/components/list-view/use-list-view-client-ids.js +2 -22
  288. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  289. package/build/components/list-view/use-list-view-drop-zone.js +46 -34
  290. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  291. package/build/components/media-placeholder/index.js +38 -13
  292. package/build/components/media-placeholder/index.js.map +1 -1
  293. package/build/components/media-replace-flow/index.js +1 -3
  294. package/build/components/media-replace-flow/index.js.map +1 -1
  295. package/build/components/navigable-toolbar/index.js +8 -8
  296. package/build/components/navigable-toolbar/index.js.map +1 -1
  297. package/build/components/panel-color-settings/index.js +4 -5
  298. package/build/components/panel-color-settings/index.js.map +1 -1
  299. package/build/components/plain-text/index.js +8 -8
  300. package/build/components/plain-text/index.js.map +1 -1
  301. package/build/components/plain-text/index.native.js +7 -6
  302. package/build/components/plain-text/index.native.js.map +1 -1
  303. package/build/components/preview-options/index.js +5 -4
  304. package/build/components/preview-options/index.js.map +1 -1
  305. package/build/components/provider/index.js +2 -4
  306. package/build/components/provider/index.js.map +1 -1
  307. package/build/components/provider/use-block-sync.js +21 -0
  308. package/build/components/provider/use-block-sync.js.map +1 -1
  309. package/build/components/provider/with-registry-provider.js +8 -10
  310. package/build/components/provider/with-registry-provider.js.map +1 -1
  311. package/build/components/publish-date-time-picker/index.js +4 -5
  312. package/build/components/publish-date-time-picker/index.js.map +1 -1
  313. package/build/components/resizable-box-popover/index.js +5 -5
  314. package/build/components/resizable-box-popover/index.js.map +1 -1
  315. package/build/components/resolution-tool/index.js +55 -0
  316. package/build/components/resolution-tool/index.js.map +1 -0
  317. package/build/components/rich-text/content.js +99 -0
  318. package/build/components/rich-text/content.js.map +1 -0
  319. package/build/components/rich-text/format-toolbar/index.js +1 -2
  320. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  321. package/build/components/rich-text/index.js +8 -42
  322. package/build/components/rich-text/index.js.map +1 -1
  323. package/build/components/rich-text/index.native.js +6 -34
  324. package/build/components/rich-text/index.native.js.map +1 -1
  325. package/build/components/rich-text/toolbar-button.js +2 -6
  326. package/build/components/rich-text/toolbar-button.js.map +1 -1
  327. package/build/components/spacing-sizes-control/index.js +8 -8
  328. package/build/components/spacing-sizes-control/index.js.map +1 -1
  329. package/build/components/tool-selector/index.js +2 -6
  330. package/build/components/tool-selector/index.js.map +1 -1
  331. package/build/components/unit-control/index.js +4 -5
  332. package/build/components/unit-control/index.js.map +1 -1
  333. package/build/components/url-input/index.js +12 -10
  334. package/build/components/url-input/index.js.map +1 -1
  335. package/build/components/url-input/index.native.js +4 -7
  336. package/build/components/url-input/index.native.js.map +1 -1
  337. package/build/components/url-popover/image-url-input-ui.js +21 -14
  338. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  339. package/build/components/url-popover/index.js +4 -5
  340. package/build/components/url-popover/index.js.map +1 -1
  341. package/build/components/url-popover/link-editor.js +4 -5
  342. package/build/components/url-popover/link-editor.js.map +1 -1
  343. package/build/components/url-popover/link-viewer.js +4 -5
  344. package/build/components/url-popover/link-viewer.js.map +1 -1
  345. package/build/components/use-block-display-information/index.js +30 -2
  346. package/build/components/use-block-display-information/index.js.map +1 -1
  347. package/build/components/video-player/index.native.js +2 -4
  348. package/build/components/video-player/index.native.js.map +1 -1
  349. package/build/components/warning/index.native.js +4 -5
  350. package/build/components/warning/index.native.js.map +1 -1
  351. package/build/components/writing-flow/index.js +2 -4
  352. package/build/components/writing-flow/index.js.map +1 -1
  353. package/build/components/writing-flow/use-drag-selection.js +1 -1
  354. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  355. package/build/components/writing-flow/use-tab-nav.js +32 -4
  356. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  357. package/build/hooks/align.js +8 -8
  358. package/build/hooks/align.js.map +1 -1
  359. package/build/hooks/anchor.js +4 -2
  360. package/build/hooks/anchor.js.map +1 -1
  361. package/build/hooks/behaviors.js +75 -37
  362. package/build/hooks/behaviors.js.map +1 -1
  363. package/build/hooks/border.js +4 -5
  364. package/build/hooks/border.js.map +1 -1
  365. package/build/hooks/color.js +4 -5
  366. package/build/hooks/color.js.map +1 -1
  367. package/build/hooks/content-lock-ui.js +8 -10
  368. package/build/hooks/content-lock-ui.js.map +1 -1
  369. package/build/hooks/custom-class-name.js +4 -2
  370. package/build/hooks/custom-class-name.js.map +1 -1
  371. package/build/hooks/dimensions.js +7 -7
  372. package/build/hooks/dimensions.js.map +1 -1
  373. package/build/hooks/duotone.js +5 -5
  374. package/build/hooks/duotone.js.map +1 -1
  375. package/build/hooks/font-family.js +2 -6
  376. package/build/hooks/font-family.js.map +1 -1
  377. package/build/hooks/font-size.js +10 -8
  378. package/build/hooks/font-size.js.map +1 -1
  379. package/build/hooks/layout.js +30 -28
  380. package/build/hooks/layout.js.map +1 -1
  381. package/build/hooks/position.js +24 -16
  382. package/build/hooks/position.js.map +1 -1
  383. package/build/hooks/style.js +8 -5
  384. package/build/hooks/style.js.map +1 -1
  385. package/build/hooks/supports.js +1 -1
  386. package/build/hooks/supports.js.map +1 -1
  387. package/build/hooks/typography.native.js +3 -1
  388. package/build/hooks/typography.native.js.map +1 -1
  389. package/build/hooks/use-typography-props.js +10 -17
  390. package/build/hooks/use-typography-props.js.map +1 -1
  391. package/build/index.js +0 -14
  392. package/build/index.js.map +1 -1
  393. package/build/layouts/constrained.js +3 -1
  394. package/build/layouts/constrained.js.map +1 -1
  395. package/build/layouts/definitions.js +154 -0
  396. package/build/layouts/definitions.js.map +1 -0
  397. package/build/layouts/flex.js +8 -5
  398. package/build/layouts/flex.js.map +1 -1
  399. package/build/layouts/flow.js +3 -1
  400. package/build/layouts/flow.js.map +1 -1
  401. package/build/layouts/grid.js +3 -1
  402. package/build/layouts/grid.js.map +1 -1
  403. package/build/layouts/utils.js +8 -2
  404. package/build/layouts/utils.js.map +1 -1
  405. package/build/private-apis.js +23 -1
  406. package/build/private-apis.js.map +1 -1
  407. package/build/store/actions.js +2 -62
  408. package/build/store/actions.js.map +1 -1
  409. package/build/store/defaults.js +1 -0
  410. package/build/store/defaults.js.map +1 -1
  411. package/build/store/private-actions.js +200 -0
  412. package/build/store/private-actions.js.map +1 -1
  413. package/build/store/private-selectors.js +72 -4
  414. package/build/store/private-selectors.js.map +1 -1
  415. package/build/store/reducer.js +52 -1
  416. package/build/store/reducer.js.map +1 -1
  417. package/build/store/selectors.js +42 -42
  418. package/build/store/selectors.js.map +1 -1
  419. package/build/utils/object.js +39 -0
  420. package/build/utils/object.js.map +1 -1
  421. package/build-module/autocompleters/block.js +5 -3
  422. package/build-module/autocompleters/block.js.map +1 -1
  423. package/build-module/components/alignment-control/index.js +4 -5
  424. package/build-module/components/alignment-control/index.js.map +1 -1
  425. package/build-module/components/alignment-control/ui.js +5 -6
  426. package/build-module/components/alignment-control/ui.js.map +1 -1
  427. package/build-module/components/autocomplete/index.js +2 -3
  428. package/build-module/components/autocomplete/index.js.map +1 -1
  429. package/build-module/components/block-actions/index.js +4 -0
  430. package/build-module/components/block-actions/index.js.map +1 -1
  431. package/build-module/components/block-alignment-control/constants.js +0 -3
  432. package/build-module/components/block-alignment-control/constants.js.map +1 -1
  433. package/build-module/components/block-alignment-control/index.js +4 -5
  434. package/build-module/components/block-alignment-control/index.js.map +1 -1
  435. package/build-module/components/block-alignment-control/ui.js +4 -4
  436. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  437. package/build-module/components/block-alignment-control/ui.native.js +3 -2
  438. package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
  439. package/build-module/components/block-alignment-matrix-control/index.js +0 -1
  440. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  441. package/build-module/components/block-breadcrumb/index.js +2 -3
  442. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  443. package/build-module/components/block-controls/fill.js +2 -1
  444. package/build-module/components/block-controls/fill.js.map +1 -1
  445. package/build-module/components/block-controls/index.js +8 -7
  446. package/build-module/components/block-controls/index.js.map +1 -1
  447. package/build-module/components/block-controls/slot.js +2 -3
  448. package/build-module/components/block-controls/slot.js.map +1 -1
  449. package/build-module/components/block-controls/slot.native.js +4 -2
  450. package/build-module/components/block-controls/slot.native.js.map +1 -1
  451. package/build-module/components/block-edit/edit.js +4 -5
  452. package/build-module/components/block-edit/edit.js.map +1 -1
  453. package/build-module/components/block-edit/edit.native.js +2 -3
  454. package/build-module/components/block-edit/edit.native.js.map +1 -1
  455. package/build-module/components/block-edit/index.js +3 -2
  456. package/build-module/components/block-edit/index.js.map +1 -1
  457. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +39 -0
  458. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -0
  459. package/build-module/components/block-heading-level-dropdown/index.js +71 -0
  460. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -0
  461. package/build-module/components/block-heading-level-dropdown/index.native.js +60 -0
  462. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -0
  463. package/build-module/components/block-icon/index.native.js +6 -6
  464. package/build-module/components/block-icon/index.native.js.map +1 -1
  465. package/build-module/components/block-info-slot-fill/index.js +4 -2
  466. package/build-module/components/block-info-slot-fill/index.js.map +1 -1
  467. package/build-module/components/block-inspector/index.js +20 -88
  468. package/build-module/components/block-inspector/index.js.map +1 -1
  469. package/build-module/components/block-list/block-list-item.native.js +4 -2
  470. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  471. package/build-module/components/block-list/block.js +6 -4
  472. package/build-module/components/block-list/block.js.map +1 -1
  473. package/build-module/components/block-list/block.native.js +1 -0
  474. package/build-module/components/block-list/block.native.js.map +1 -1
  475. package/build-module/components/block-list/index.js +7 -4
  476. package/build-module/components/block-list/index.js.map +1 -1
  477. package/build-module/components/block-list/index.native.js +8 -8
  478. package/build-module/components/block-list/index.native.js.map +1 -1
  479. package/build-module/components/block-list/subdirectory-icon.js +4 -4
  480. package/build-module/components/block-list/subdirectory-icon.js.map +1 -1
  481. package/build-module/components/block-list/use-in-between-inserter.js +1 -3
  482. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  483. package/build-module/components/block-list-appender/index.js +21 -19
  484. package/build-module/components/block-list-appender/index.js.map +1 -1
  485. package/build-module/components/block-lock/toolbar.js +25 -7
  486. package/build-module/components/block-lock/toolbar.js.map +1 -1
  487. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  488. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  489. package/build-module/components/block-mover/button.js +12 -11
  490. package/build-module/components/block-mover/button.js.map +1 -1
  491. package/build-module/components/block-mover/index.js +11 -9
  492. package/build-module/components/block-mover/index.js.map +1 -1
  493. package/build-module/components/block-navigation/dropdown.js +4 -5
  494. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  495. package/build-module/components/block-parent-selector/index.js +4 -4
  496. package/build-module/components/block-parent-selector/index.js.map +1 -1
  497. package/build-module/components/block-pattern-setup/index.js +6 -7
  498. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  499. package/build-module/components/block-patterns-list/index.js +6 -7
  500. package/build-module/components/block-patterns-list/index.js.map +1 -1
  501. package/build-module/components/block-popover/inbetween.js +4 -5
  502. package/build-module/components/block-popover/inbetween.js.map +1 -1
  503. package/build-module/components/block-popover/index.js +4 -5
  504. package/build-module/components/block-popover/index.js.map +1 -1
  505. package/build-module/components/block-preview/auto.js +2 -3
  506. package/build-module/components/block-preview/auto.js.map +1 -1
  507. package/build-module/components/block-preview/index.js +7 -7
  508. package/build-module/components/block-preview/index.js.map +1 -1
  509. package/build-module/components/block-quick-navigation/index.js +69 -0
  510. package/build-module/components/block-quick-navigation/index.js.map +1 -0
  511. package/build-module/components/block-removal-warning-modal/index.js +76 -0
  512. package/build-module/components/block-removal-warning-modal/index.js.map +1 -0
  513. package/build-module/components/block-selection-clearer/index.js +4 -4
  514. package/build-module/components/block-selection-clearer/index.js.map +1 -1
  515. package/build-module/components/block-settings/button.native.js +2 -1
  516. package/build-module/components/block-settings/button.native.js.map +1 -1
  517. package/build-module/components/block-settings/container.native.js +6 -5
  518. package/build-module/components/block-settings/container.native.js.map +1 -1
  519. package/build-module/components/block-settings-menu/block-settings-dropdown.js +10 -10
  520. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  521. package/build-module/components/block-settings-menu/index.js +4 -4
  522. package/build-module/components/block-settings-menu/index.js.map +1 -1
  523. package/build-module/components/block-settings-menu-controls/index.js +4 -4
  524. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  525. package/build-module/components/block-switcher/index.js +1 -2
  526. package/build-module/components/block-switcher/index.js.map +1 -1
  527. package/build-module/components/block-switcher/pattern-transformations-menu.js +6 -7
  528. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  529. package/build-module/components/block-toolbar/index.js +10 -7
  530. package/build-module/components/block-toolbar/index.js.map +1 -1
  531. package/build-module/components/block-tools/block-contextual-toolbar.js +4 -4
  532. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  533. package/build-module/components/block-tools/block-selection-button.js +4 -4
  534. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  535. package/build-module/components/block-tools/index.js +13 -5
  536. package/build-module/components/block-tools/index.js.map +1 -1
  537. package/build-module/components/block-tools/insertion-point.js +5 -4
  538. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  539. package/build-module/components/block-tools/selected-block-popover.js +8 -7
  540. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  541. package/build-module/components/block-types-list/index.native.js +4 -5
  542. package/build-module/components/block-types-list/index.native.js.map +1 -1
  543. package/build-module/components/block-vertical-alignment-control/index.js +4 -5
  544. package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
  545. package/build-module/components/block-vertical-alignment-control/ui.js +5 -9
  546. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  547. package/build-module/components/border-radius-control/all-input-control.js +2 -3
  548. package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
  549. package/build-module/components/border-radius-control/input-controls.js +2 -3
  550. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  551. package/build-module/components/border-radius-control/linked-button.js +2 -3
  552. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  553. package/build-module/components/color-palette/control.js +2 -3
  554. package/build-module/components/color-palette/control.js.map +1 -1
  555. package/build-module/components/color-palette/with-color-context.js +2 -3
  556. package/build-module/components/color-palette/with-color-context.js.map +1 -1
  557. package/build-module/components/colors/utils.js +5 -1
  558. package/build-module/components/colors/utils.js.map +1 -1
  559. package/build-module/components/colors/with-colors.js +10 -14
  560. package/build-module/components/colors/with-colors.js.map +1 -1
  561. package/build-module/components/colors-gradients/control.js +7 -4
  562. package/build-module/components/colors-gradients/control.js.map +1 -1
  563. package/build-module/components/colors-gradients/dropdown.js +12 -10
  564. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  565. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +7 -4
  566. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  567. package/build-module/components/copy-handler/index.js +5 -6
  568. package/build-module/components/copy-handler/index.js.map +1 -1
  569. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
  570. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  571. package/build-module/components/dimensions-tool/index.js +195 -0
  572. package/build-module/components/dimensions-tool/index.js.map +1 -0
  573. package/build-module/components/dimensions-tool/scale-tool.js +103 -0
  574. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
  575. package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
  576. package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
  577. package/build-module/components/duotone-control/index.js +1 -2
  578. package/build-module/components/duotone-control/index.js.map +1 -1
  579. package/build-module/components/editable-text/index.js +6 -6
  580. package/build-module/components/editable-text/index.js.map +1 -1
  581. package/build-module/components/font-appearance-control/index.js +2 -3
  582. package/build-module/components/font-appearance-control/index.js.map +1 -1
  583. package/build-module/components/font-family/index.js +4 -4
  584. package/build-module/components/font-family/index.js.map +1 -1
  585. package/build-module/components/font-sizes/font-size-picker.js +2 -3
  586. package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
  587. package/build-module/components/font-sizes/utils.js +2 -2
  588. package/build-module/components/font-sizes/utils.js.map +1 -1
  589. package/build-module/components/font-sizes/with-font-sizes.js +7 -6
  590. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  591. package/build-module/components/global-styles/color-panel.js +15 -15
  592. package/build-module/components/global-styles/color-panel.js.map +1 -1
  593. package/build-module/components/global-styles/effects-panel.js +2 -1
  594. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  595. package/build-module/components/global-styles/filters-panel.js +2 -1
  596. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  597. package/build-module/components/global-styles/index.js +1 -1
  598. package/build-module/components/global-styles/index.js.map +1 -1
  599. package/build-module/components/global-styles/typography-panel.js +7 -7
  600. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  601. package/build-module/components/global-styles/use-global-styles-output.js +11 -10
  602. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  603. package/build-module/components/gradients/with-gradient.js +2 -3
  604. package/build-module/components/gradients/with-gradient.js.map +1 -1
  605. package/build-module/components/iframe/index.js +5 -6
  606. package/build-module/components/iframe/index.js.map +1 -1
  607. package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
  608. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  609. package/build-module/components/image-editor/constants.js +1 -2
  610. package/build-module/components/image-editor/constants.js.map +1 -1
  611. package/build-module/components/image-editor/use-save-image.js +1 -2
  612. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  613. package/build-module/components/image-size-control/index.js +5 -0
  614. package/build-module/components/image-size-control/index.js.map +1 -1
  615. package/build-module/components/index.js +1 -1
  616. package/build-module/components/index.js.map +1 -1
  617. package/build-module/components/index.native.js +1 -0
  618. package/build-module/components/index.native.js.map +1 -1
  619. package/build-module/components/inner-blocks/index.js +9 -7
  620. package/build-module/components/inner-blocks/index.js.map +1 -1
  621. package/build-module/components/inner-blocks/index.native.js +8 -6
  622. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  623. package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -27
  624. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  625. package/build-module/components/inner-blocks/with-client-id.js +2 -3
  626. package/build-module/components/inner-blocks/with-client-id.js.map +1 -1
  627. package/build-module/components/inserter/block-patterns-explorer/explorer.js +2 -1
  628. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  629. package/build-module/components/inserter/block-patterns-tab.js +33 -7
  630. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  631. package/build-module/components/inserter/hooks/use-block-types-state.js +4 -3
  632. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  633. package/build-module/components/inserter/hooks/use-insertion-point.js +1 -1
  634. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  635. package/build-module/components/inserter/index.js +8 -7
  636. package/build-module/components/inserter/index.js.map +1 -1
  637. package/build-module/components/inserter/index.native.js +4 -4
  638. package/build-module/components/inserter/index.native.js.map +1 -1
  639. package/build-module/components/inserter/library.js +1 -1
  640. package/build-module/components/inserter/library.js.map +1 -1
  641. package/build-module/components/inserter/media-tab/media-list.js +2 -3
  642. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  643. package/build-module/components/inserter/media-tab/media-preview.js +4 -5
  644. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  645. package/build-module/components/inserter/media-tab/media-tab.js +3 -3
  646. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  647. package/build-module/components/inserter/reusable-blocks-tab.js +3 -3
  648. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  649. package/build-module/components/inserter/tabs.js +3 -3
  650. package/build-module/components/inserter/tabs.js.map +1 -1
  651. package/build-module/components/inserter-list-item/index.js +4 -4
  652. package/build-module/components/inserter-list-item/index.js.map +1 -1
  653. package/build-module/components/inserter-listbox/group.js +4 -4
  654. package/build-module/components/inserter-listbox/group.js.map +1 -1
  655. package/build-module/components/inserter-listbox/item.js +8 -6
  656. package/build-module/components/inserter-listbox/item.js.map +1 -1
  657. package/build-module/components/inserter-listbox/row.js +4 -4
  658. package/build-module/components/inserter-listbox/row.js.map +1 -1
  659. package/build-module/components/inspector-controls/block-support-slot-container.js +2 -3
  660. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
  661. package/build-module/components/inspector-controls/fill.native.js +2 -1
  662. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  663. package/build-module/components/inspector-controls/index.js +4 -5
  664. package/build-module/components/inspector-controls/index.js.map +1 -1
  665. package/build-module/components/inspector-controls/slot.js +4 -5
  666. package/build-module/components/inspector-controls/slot.js.map +1 -1
  667. package/build-module/components/inspector-controls/slot.native.js +2 -1
  668. package/build-module/components/inspector-controls/slot.native.js.map +1 -1
  669. package/build-module/components/justify-content-control/index.js +4 -5
  670. package/build-module/components/justify-content-control/index.js.map +1 -1
  671. package/build-module/components/justify-content-control/ui.js +4 -4
  672. package/build-module/components/justify-content-control/ui.js.map +1 -1
  673. package/build-module/components/letter-spacing-control/index.js +2 -3
  674. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  675. package/build-module/components/line-height-control/index.js +2 -3
  676. package/build-module/components/line-height-control/index.js.map +1 -1
  677. package/build-module/components/link-control/index.js +20 -24
  678. package/build-module/components/link-control/index.js.map +1 -1
  679. package/build-module/components/link-control/search-create-button.js +2 -3
  680. package/build-module/components/link-control/search-create-button.js.map +1 -1
  681. package/build-module/components/link-control/search-input.js +7 -5
  682. package/build-module/components/link-control/search-input.js.map +1 -1
  683. package/build-module/components/link-control/search-item.js +2 -3
  684. package/build-module/components/link-control/search-item.js.map +1 -1
  685. package/build-module/components/link-control/search-results.js +2 -3
  686. package/build-module/components/link-control/search-results.js.map +1 -1
  687. package/build-module/components/link-control/settings-drawer.js +4 -5
  688. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  689. package/build-module/components/list-view/appender.js +4 -5
  690. package/build-module/components/list-view/appender.js.map +1 -1
  691. package/build-module/components/list-view/aria-referenced-text.js +4 -5
  692. package/build-module/components/list-view/aria-referenced-text.js.map +1 -1
  693. package/build-module/components/list-view/block-contents.js +4 -4
  694. package/build-module/components/list-view/block-contents.js.map +1 -1
  695. package/build-module/components/list-view/block-select-button.js +14 -4
  696. package/build-module/components/list-view/block-select-button.js.map +1 -1
  697. package/build-module/components/list-view/branch.js +9 -7
  698. package/build-module/components/list-view/branch.js.map +1 -1
  699. package/build-module/components/list-view/drop-indicator.js +61 -11
  700. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  701. package/build-module/components/list-view/index.js +4 -5
  702. package/build-module/components/list-view/index.js.map +1 -1
  703. package/build-module/components/list-view/leaf.js +4 -4
  704. package/build-module/components/list-view/leaf.js.map +1 -1
  705. package/build-module/components/list-view/use-list-view-client-ids.js +2 -22
  706. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  707. package/build-module/components/list-view/use-list-view-drop-zone.js +45 -34
  708. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  709. package/build-module/components/media-placeholder/index.js +38 -13
  710. package/build-module/components/media-placeholder/index.js.map +1 -1
  711. package/build-module/components/media-replace-flow/index.js +1 -3
  712. package/build-module/components/media-replace-flow/index.js.map +1 -1
  713. package/build-module/components/navigable-toolbar/index.js +8 -7
  714. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  715. package/build-module/components/panel-color-settings/index.js +4 -4
  716. package/build-module/components/panel-color-settings/index.js.map +1 -1
  717. package/build-module/components/plain-text/index.js +8 -7
  718. package/build-module/components/plain-text/index.js.map +1 -1
  719. package/build-module/components/plain-text/index.native.js +7 -5
  720. package/build-module/components/plain-text/index.native.js.map +1 -1
  721. package/build-module/components/preview-options/index.js +5 -4
  722. package/build-module/components/preview-options/index.js.map +1 -1
  723. package/build-module/components/provider/index.js +2 -3
  724. package/build-module/components/provider/index.js.map +1 -1
  725. package/build-module/components/provider/use-block-sync.js +21 -0
  726. package/build-module/components/provider/use-block-sync.js.map +1 -1
  727. package/build-module/components/provider/with-registry-provider.js +8 -7
  728. package/build-module/components/provider/with-registry-provider.js.map +1 -1
  729. package/build-module/components/publish-date-time-picker/index.js +4 -4
  730. package/build-module/components/publish-date-time-picker/index.js.map +1 -1
  731. package/build-module/components/resizable-box-popover/index.js +5 -4
  732. package/build-module/components/resizable-box-popover/index.js.map +1 -1
  733. package/build-module/components/resolution-tool/index.js +45 -0
  734. package/build-module/components/resolution-tool/index.js.map +1 -0
  735. package/build-module/components/rich-text/content.js +85 -0
  736. package/build-module/components/rich-text/content.js.map +1 -0
  737. package/build-module/components/rich-text/format-toolbar/index.js +1 -2
  738. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  739. package/build-module/components/rich-text/index.js +8 -42
  740. package/build-module/components/rich-text/index.js.map +1 -1
  741. package/build-module/components/rich-text/index.native.js +6 -34
  742. package/build-module/components/rich-text/index.native.js.map +1 -1
  743. package/build-module/components/rich-text/toolbar-button.js +2 -3
  744. package/build-module/components/rich-text/toolbar-button.js.map +1 -1
  745. package/build-module/components/spacing-sizes-control/index.js +8 -7
  746. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  747. package/build-module/components/tool-selector/index.js +2 -3
  748. package/build-module/components/tool-selector/index.js.map +1 -1
  749. package/build-module/components/unit-control/index.js +4 -4
  750. package/build-module/components/unit-control/index.js.map +1 -1
  751. package/build-module/components/url-input/index.js +12 -9
  752. package/build-module/components/url-input/index.js.map +1 -1
  753. package/build-module/components/url-input/index.native.js +4 -4
  754. package/build-module/components/url-input/index.native.js.map +1 -1
  755. package/build-module/components/url-popover/image-url-input-ui.js +22 -15
  756. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  757. package/build-module/components/url-popover/index.js +4 -4
  758. package/build-module/components/url-popover/index.js.map +1 -1
  759. package/build-module/components/url-popover/link-editor.js +4 -4
  760. package/build-module/components/url-popover/link-editor.js.map +1 -1
  761. package/build-module/components/url-popover/link-viewer.js +4 -4
  762. package/build-module/components/url-popover/link-viewer.js.map +1 -1
  763. package/build-module/components/use-block-display-information/index.js +29 -2
  764. package/build-module/components/use-block-display-information/index.js.map +1 -1
  765. package/build-module/components/video-player/index.native.js +2 -3
  766. package/build-module/components/video-player/index.native.js.map +1 -1
  767. package/build-module/components/warning/index.native.js +4 -4
  768. package/build-module/components/warning/index.native.js.map +1 -1
  769. package/build-module/components/writing-flow/index.js +2 -3
  770. package/build-module/components/writing-flow/index.js.map +1 -1
  771. package/build-module/components/writing-flow/use-drag-selection.js +1 -1
  772. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  773. package/build-module/components/writing-flow/use-tab-nav.js +32 -5
  774. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  775. package/build-module/hooks/align.js +8 -7
  776. package/build-module/hooks/align.js.map +1 -1
  777. package/build-module/hooks/anchor.js +4 -2
  778. package/build-module/hooks/anchor.js.map +1 -1
  779. package/build-module/hooks/behaviors.js +76 -34
  780. package/build-module/hooks/behaviors.js.map +1 -1
  781. package/build-module/hooks/border.js +4 -4
  782. package/build-module/hooks/border.js.map +1 -1
  783. package/build-module/hooks/color.js +4 -4
  784. package/build-module/hooks/color.js.map +1 -1
  785. package/build-module/hooks/content-lock-ui.js +8 -7
  786. package/build-module/hooks/content-lock-ui.js.map +1 -1
  787. package/build-module/hooks/custom-class-name.js +4 -2
  788. package/build-module/hooks/custom-class-name.js.map +1 -1
  789. package/build-module/hooks/dimensions.js +7 -6
  790. package/build-module/hooks/dimensions.js.map +1 -1
  791. package/build-module/hooks/duotone.js +5 -4
  792. package/build-module/hooks/duotone.js.map +1 -1
  793. package/build-module/hooks/font-family.js +1 -5
  794. package/build-module/hooks/font-family.js.map +1 -1
  795. package/build-module/hooks/font-size.js +10 -9
  796. package/build-module/hooks/font-size.js.map +1 -1
  797. package/build-module/hooks/layout.js +26 -24
  798. package/build-module/hooks/layout.js.map +1 -1
  799. package/build-module/hooks/position.js +23 -15
  800. package/build-module/hooks/position.js.map +1 -1
  801. package/build-module/hooks/style.js +8 -4
  802. package/build-module/hooks/style.js.map +1 -1
  803. package/build-module/hooks/supports.js +1 -1
  804. package/build-module/hooks/supports.js.map +1 -1
  805. package/build-module/hooks/typography.native.js +3 -1
  806. package/build-module/hooks/typography.native.js.map +1 -1
  807. package/build-module/hooks/use-typography-props.js +8 -15
  808. package/build-module/hooks/use-typography-props.js.map +1 -1
  809. package/build-module/index.js +1 -1
  810. package/build-module/index.js.map +1 -1
  811. package/build-module/layouts/constrained.js +2 -1
  812. package/build-module/layouts/constrained.js.map +1 -1
  813. package/build-module/layouts/definitions.js +147 -0
  814. package/build-module/layouts/definitions.js.map +1 -0
  815. package/build-module/layouts/flex.js +8 -6
  816. package/build-module/layouts/flex.js.map +1 -1
  817. package/build-module/layouts/flow.js +2 -1
  818. package/build-module/layouts/flow.js.map +1 -1
  819. package/build-module/layouts/grid.js +2 -1
  820. package/build-module/layouts/grid.js.map +1 -1
  821. package/build-module/layouts/utils.js +7 -2
  822. package/build-module/layouts/utils.js.map +1 -1
  823. package/build-module/private-apis.js +16 -1
  824. package/build-module/private-apis.js.map +1 -1
  825. package/build-module/store/actions.js +2 -62
  826. package/build-module/store/actions.js.map +1 -1
  827. package/build-module/store/defaults.js +1 -0
  828. package/build-module/store/defaults.js.map +1 -1
  829. package/build-module/store/private-actions.js +186 -0
  830. package/build-module/store/private-actions.js.map +1 -1
  831. package/build-module/store/private-selectors.js +63 -3
  832. package/build-module/store/private-selectors.js.map +1 -1
  833. package/build-module/store/reducer.js +52 -1
  834. package/build-module/store/reducer.js.map +1 -1
  835. package/build-module/store/selectors.js +42 -42
  836. package/build-module/store/selectors.js.map +1 -1
  837. package/build-module/utils/object.js +37 -1
  838. package/build-module/utils/object.js.map +1 -1
  839. package/build-style/style-rtl.css +58 -67
  840. package/build-style/style.css +58 -67
  841. package/package.json +32 -31
  842. package/src/autocompleters/block.js +4 -2
  843. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
  844. package/src/components/alignment-control/ui.js +1 -2
  845. package/src/components/block-actions/index.js +10 -0
  846. package/src/components/block-alignment-control/constants.js +0 -4
  847. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
  848. package/src/components/block-alignment-control/ui.js +1 -6
  849. package/src/components/block-alignment-matrix-control/index.js +1 -1
  850. package/src/components/block-breadcrumb/index.js +2 -6
  851. package/src/components/block-edit/index.js +3 -5
  852. package/src/components/block-heading-level-dropdown/README.md +52 -0
  853. package/src/components/block-heading-level-dropdown/heading-level-icon.js +43 -0
  854. package/src/components/block-heading-level-dropdown/index.js +77 -0
  855. package/src/components/block-heading-level-dropdown/index.native.js +63 -0
  856. package/src/components/block-inspector/index.js +18 -92
  857. package/src/components/block-inspector/style.scss +0 -5
  858. package/src/components/block-list/block.native.js +1 -0
  859. package/src/components/block-list/index.js +1 -1
  860. package/src/components/block-list/use-in-between-inserter.js +0 -4
  861. package/src/components/block-list-appender/index.js +29 -22
  862. package/src/components/block-lock/style.scss +11 -4
  863. package/src/components/block-lock/toolbar.js +34 -6
  864. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  865. package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +2 -2
  866. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +3 -3
  867. package/src/components/block-mover/test/index.native.js +1 -20
  868. package/src/components/block-preview/index.js +7 -14
  869. package/src/components/block-quick-navigation/index.js +81 -0
  870. package/src/components/block-removal-warning-modal/index.js +94 -0
  871. package/src/components/block-settings-menu/block-settings-dropdown.js +15 -13
  872. package/src/components/block-switcher/index.js +1 -2
  873. package/src/components/block-toolbar/index.js +9 -6
  874. package/src/components/block-toolbar/style.scss +0 -4
  875. package/src/components/block-tools/index.js +10 -1
  876. package/src/components/block-tools/style.scss +4 -0
  877. package/src/components/block-vertical-alignment-control/ui.js +1 -3
  878. package/src/components/colors/utils.js +5 -1
  879. package/src/components/colors/with-colors.js +1 -5
  880. package/src/components/copy-handler/index.js +5 -5
  881. package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
  882. package/src/components/dimensions-tool/index.js +212 -0
  883. package/src/components/dimensions-tool/scale-tool.js +124 -0
  884. package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
  885. package/src/components/dimensions-tool/stories/index.js +54 -0
  886. package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
  887. package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
  888. package/src/components/dimensions-tool/test/index.js +641 -0
  889. package/src/components/dimensions-tool/width-height-tool.js +113 -0
  890. package/src/components/duotone-control/index.js +0 -1
  891. package/src/components/font-sizes/test/fluid-utils.js +97 -76
  892. package/src/components/font-sizes/utils.js +2 -2
  893. package/src/components/global-styles/color-panel.js +3 -3
  894. package/src/components/global-styles/index.js +1 -0
  895. package/src/components/global-styles/test/use-global-styles-output.js +14 -9
  896. package/src/components/global-styles/typography-panel.js +19 -16
  897. package/src/components/global-styles/use-global-styles-output.js +12 -12
  898. package/src/components/iframe/index.js +1 -1
  899. package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
  900. package/src/components/image-editor/constants.js +0 -1
  901. package/src/components/image-editor/use-save-image.js +0 -1
  902. package/src/components/image-size-control/index.js +6 -0
  903. package/src/components/index.js +1 -1
  904. package/src/components/index.native.js +1 -0
  905. package/src/components/inner-blocks/index.js +4 -2
  906. package/src/components/inner-blocks/index.native.js +1 -1
  907. package/src/components/inner-blocks/use-nested-settings-update.js +31 -36
  908. package/src/components/inserter/block-patterns-tab.js +63 -8
  909. package/src/components/inserter/hooks/use-block-types-state.js +4 -3
  910. package/src/components/inserter/hooks/use-insertion-point.js +1 -0
  911. package/src/components/inserter/library.js +2 -1
  912. package/src/components/inserter/media-tab/media-tab.js +9 -3
  913. package/src/components/inserter/reusable-blocks-tab.js +3 -3
  914. package/src/components/inserter/tabs.js +3 -3
  915. package/src/components/link-control/index.js +34 -37
  916. package/src/components/link-control/search-input.js +5 -3
  917. package/src/components/link-control/settings-drawer.js +6 -5
  918. package/src/components/link-control/style.scss +33 -55
  919. package/src/components/link-control/test/index.js +161 -159
  920. package/src/components/list-view/block-select-button.js +19 -1
  921. package/src/components/list-view/branch.js +6 -3
  922. package/src/components/list-view/drop-indicator.js +94 -9
  923. package/src/components/list-view/style.scss +13 -12
  924. package/src/components/list-view/test/use-list-view-drop-zone.js +188 -93
  925. package/src/components/list-view/use-list-view-client-ids.js +3 -20
  926. package/src/components/list-view/use-list-view-drop-zone.js +97 -54
  927. package/src/components/media-placeholder/index.js +54 -20
  928. package/src/components/media-replace-flow/index.js +1 -3
  929. package/src/components/media-replace-flow/test/index.js +1 -1
  930. package/src/components/preview-options/index.js +3 -2
  931. package/src/components/provider/test/experimental-provider.js +9 -6
  932. package/src/components/provider/test/use-block-sync.js +21 -6
  933. package/src/components/provider/use-block-sync.js +19 -0
  934. package/src/components/resolution-tool/index.js +56 -0
  935. package/src/components/resolution-tool/stories/index.js +48 -0
  936. package/src/components/rich-text/content.js +85 -0
  937. package/src/components/rich-text/format-toolbar/index.js +1 -2
  938. package/src/components/rich-text/index.js +2 -35
  939. package/src/components/rich-text/index.native.js +3 -33
  940. package/src/components/url-input/index.js +2 -0
  941. package/src/components/url-popover/image-url-input-ui.js +15 -15
  942. package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
  943. package/src/components/use-block-display-information/index.js +26 -0
  944. package/src/components/writing-flow/use-drag-selection.js +1 -1
  945. package/src/components/writing-flow/use-tab-nav.js +42 -6
  946. package/src/hooks/behaviors.js +82 -39
  947. package/src/hooks/font-family.js +1 -5
  948. package/src/hooks/font-size.js +12 -17
  949. package/src/hooks/layout.js +17 -25
  950. package/src/hooks/position.js +24 -12
  951. package/src/hooks/supports.js +1 -1
  952. package/src/hooks/use-typography-props.js +14 -19
  953. package/src/index.js +0 -2
  954. package/src/layouts/constrained.js +2 -1
  955. package/src/layouts/definitions.js +174 -0
  956. package/src/layouts/flex.js +7 -5
  957. package/src/layouts/flow.js +2 -1
  958. package/src/layouts/grid.js +2 -1
  959. package/src/layouts/test/utils.js +2 -7
  960. package/src/layouts/utils.js +7 -2
  961. package/src/private-apis.js +15 -0
  962. package/src/store/actions.js +7 -56
  963. package/src/store/defaults.js +1 -0
  964. package/src/store/private-actions.js +193 -0
  965. package/src/store/private-selectors.js +108 -35
  966. package/src/store/reducer.js +44 -0
  967. package/src/store/selectors.js +61 -39
  968. package/src/store/test/private-selectors.js +269 -1
  969. package/src/store/test/selectors.js +18 -17
  970. package/src/utils/object.js +35 -0
  971. package/src/utils/test/object.js +96 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/leaf.js"],"names":["AnimatedTreeGridRow","TreeGridRow","ListViewLeaf","isSelected","position","level","rowCount","children","className","path","props","ref","animationRef","adjustScrolling","enableAnimation","triggerAnimationOnChange","mergedRef","undefined"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AACA;;AAKA;;AACA;;AAMA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AAGA,MAAMA,mBAAmB,GAAG,mBAAUC,qCAAV,CAA5B;AAEA,MAAMC,YAAY,GAAG,yBACpB,CACC;AACCC,EAAAA,UADD;AAECC,EAAAA,QAFD;AAGCC,EAAAA,KAHD;AAICC,EAAAA,QAJD;AAKCC,EAAAA,QALD;AAMCC,EAAAA,SAND;AAOCC,EAAAA,IAPD;AAQC,KAAGC;AARJ,CADD,EAWCC,GAXD,KAYK;AACJ,QAAMC,YAAY,GAAG,iCAAoB;AACxCT,IAAAA,UADwC;AAExCU,IAAAA,eAAe,EAAE,KAFuB;AAGxCC,IAAAA,eAAe,EAAE,IAHuB;AAIxCC,IAAAA,wBAAwB,EAAEN;AAJc,GAApB,CAArB;AAOA,QAAMO,SAAS,GAAG,2BAAc,CAAEL,GAAF,EAAOC,YAAP,CAAd,CAAlB;AAEA,SACC,4BAAC,mBAAD;AACC,IAAA,GAAG,EAAGI,SADP;AAEC,IAAA,SAAS,EAAG,yBACX,6BADW,EAEXR,SAFW,CAFb;AAMC,IAAA,KAAK,EAAGH,KANT;AAOC,IAAA,aAAa,EAAGD,QAPjB;AAQC,IAAA,OAAO,EAAGE,QARX;AASC,IAAA,UAAU,EAAGW;AATd,KAUMP,KAVN,GAYGH,QAZH,CADD;AAgBA,CAvCmB,CAArB;eA0CeL,Y","sourcesContent":["/**\n * External dependencies\n */\nimport { animated } from '@react-spring/web';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalTreeGridRow as TreeGridRow } from '@wordpress/components';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../use-moving-animation';\n\nconst AnimatedTreeGridRow = animated( TreeGridRow );\n\nconst ListViewLeaf = forwardRef(\n\t(\n\t\t{\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tlevel,\n\t\t\trowCount,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tpath,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst animationRef = useMovingAnimation( {\n\t\t\tisSelected,\n\t\t\tadjustScrolling: false,\n\t\t\tenableAnimation: true,\n\t\t\ttriggerAnimationOnChange: path,\n\t\t} );\n\n\t\tconst mergedRef = useMergeRefs( [ ref, animationRef ] );\n\n\t\treturn (\n\t\t\t<AnimatedTreeGridRow\n\t\t\t\tref={ mergedRef }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-leaf',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tlevel={ level }\n\t\t\t\tpositionInSet={ position }\n\t\t\t\tsetSize={ rowCount }\n\t\t\t\tisExpanded={ undefined }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</AnimatedTreeGridRow>\n\t\t);\n\t}\n);\n\nexport default ListViewLeaf;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/leaf.js"],"names":["AnimatedTreeGridRow","TreeGridRow","ListViewLeaf","isSelected","position","level","rowCount","children","className","path","props","ref","animationRef","adjustScrolling","enableAnimation","triggerAnimationOnChange","mergedRef","undefined"],"mappings":";;;;;;;;;AAWA;;AARA;;AACA;;AAKA;;AACA;;AAMA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AAGA,MAAMA,mBAAmB,GAAG,mBAAUC,qCAAV,CAA5B;AAEA,MAAMC,YAAY,GAAG,yBACpB,CACC;AACCC,EAAAA,UADD;AAECC,EAAAA,QAFD;AAGCC,EAAAA,KAHD;AAICC,EAAAA,QAJD;AAKCC,EAAAA,QALD;AAMCC,EAAAA,SAND;AAOCC,EAAAA,IAPD;AAQC,KAAGC;AARJ,CADD,EAWCC,GAXD,KAYK;AACJ,QAAMC,YAAY,GAAG,iCAAoB;AACxCT,IAAAA,UADwC;AAExCU,IAAAA,eAAe,EAAE,KAFuB;AAGxCC,IAAAA,eAAe,EAAE,IAHuB;AAIxCC,IAAAA,wBAAwB,EAAEN;AAJc,GAApB,CAArB;AAOA,QAAMO,SAAS,GAAG,2BAAc,CAAEL,GAAF,EAAOC,YAAP,CAAd,CAAlB;AAEA,SACC,4BAAC,mBAAD;AACC,IAAA,GAAG,EAAGI,SADP;AAEC,IAAA,SAAS,EAAG,yBACX,6BADW,EAEXR,SAFW,CAFb;AAMC,IAAA,KAAK,EAAGH,KANT;AAOC,IAAA,aAAa,EAAGD,QAPjB;AAQC,IAAA,OAAO,EAAGE,QARX;AASC,IAAA,UAAU,EAAGW,SATd;AAAA,OAUMP;AAVN,KAYGH,QAZH,CADD;AAgBA,CAvCmB,CAArB;eA0CeL,Y","sourcesContent":["/**\n * External dependencies\n */\nimport { animated } from '@react-spring/web';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalTreeGridRow as TreeGridRow } from '@wordpress/components';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../use-moving-animation';\n\nconst AnimatedTreeGridRow = animated( TreeGridRow );\n\nconst ListViewLeaf = forwardRef(\n\t(\n\t\t{\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tlevel,\n\t\t\trowCount,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tpath,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst animationRef = useMovingAnimation( {\n\t\t\tisSelected,\n\t\t\tadjustScrolling: false,\n\t\t\tenableAnimation: true,\n\t\t\ttriggerAnimationOnChange: path,\n\t\t} );\n\n\t\tconst mergedRef = useMergeRefs( [ ref, animationRef ] );\n\n\t\treturn (\n\t\t\t<AnimatedTreeGridRow\n\t\t\t\tref={ mergedRef }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-leaf',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tlevel={ level }\n\t\t\t\tpositionInSet={ position }\n\t\t\t\tsetSize={ rowCount }\n\t\t\t\tisExpanded={ undefined }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</AnimatedTreeGridRow>\n\t\t);\n\t}\n);\n\nexport default ListViewLeaf;\n"]}
@@ -26,32 +26,12 @@ function useListViewClientIds({
26
26
  const {
27
27
  getDraggedBlockClientIds,
28
28
  getSelectedBlockClientIds,
29
- __unstableGetClientIdsTree,
30
- getBlockEditingMode
29
+ getListViewClientIdsTree
31
30
  } = (0, _lockUnlock.unlock)(select(_store.store));
32
-
33
- const removeDisabledBlocks = tree => {
34
- return tree.flatMap(({
35
- clientId,
36
- innerBlocks,
37
- ...rest
38
- }) => {
39
- if (getBlockEditingMode(clientId) === 'disabled') {
40
- return removeDisabledBlocks(innerBlocks);
41
- }
42
-
43
- return [{
44
- clientId,
45
- innerBlocks: removeDisabledBlocks(innerBlocks),
46
- ...rest
47
- }];
48
- });
49
- };
50
-
51
31
  return {
52
32
  selectedClientIds: getSelectedBlockClientIds(),
53
33
  draggedClientIds: getDraggedBlockClientIds(),
54
- clientIdsTree: removeDisabledBlocks(blocks !== null && blocks !== void 0 ? blocks : __unstableGetClientIdsTree(rootClientId))
34
+ clientIdsTree: blocks !== null && blocks !== void 0 ? blocks : getListViewClientIdsTree(rootClientId)
55
35
  };
56
36
  }, [blocks, rootClientId]);
57
37
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-client-ids.js"],"names":["useListViewClientIds","blocks","rootClientId","select","getDraggedBlockClientIds","getSelectedBlockClientIds","__unstableGetClientIdsTree","getBlockEditingMode","blockEditorStore","removeDisabledBlocks","tree","flatMap","clientId","innerBlocks","rest","selectedClientIds","draggedClientIds","clientIdsTree"],"mappings":";;;;;;;AAIA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,oBAAT,CAA+B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA/B,EAA0D;AACxE,SAAO,qBACJC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,wBADK;AAELC,MAAAA,yBAFK;AAGLC,MAAAA,0BAHK;AAILC,MAAAA;AAJK,QAKF,wBAAQJ,MAAM,CAAEK,YAAF,CAAd,CALJ;;AAOA,UAAMC,oBAAoB,GAAKC,IAAF,IAAY;AACxC,aAAOA,IAAI,CAACC,OAAL,CAAc,CAAE;AAAEC,QAAAA,QAAF;AAAYC,QAAAA,WAAZ;AAAyB,WAAGC;AAA5B,OAAF,KAA0C;AAC9D,YAAKP,mBAAmB,CAAEK,QAAF,CAAnB,KAAoC,UAAzC,EAAsD;AACrD,iBAAOH,oBAAoB,CAAEI,WAAF,CAA3B;AACA;;AACD,eAAO,CACN;AACCD,UAAAA,QADD;AAECC,UAAAA,WAAW,EAAEJ,oBAAoB,CAAEI,WAAF,CAFlC;AAGC,aAAGC;AAHJ,SADM,CAAP;AAOA,OAXM,CAAP;AAYA,KAbD;;AAeA,WAAO;AACNC,MAAAA,iBAAiB,EAAEV,yBAAyB,EADtC;AAENW,MAAAA,gBAAgB,EAAEZ,wBAAwB,EAFpC;AAGNa,MAAAA,aAAa,EAAER,oBAAoB,CAClCR,MADkC,aAClCA,MADkC,cAClCA,MADkC,GACxBK,0BAA0B,CAAEJ,YAAF,CADF;AAH7B,KAAP;AAOA,GA/BK,EAgCN,CAAED,MAAF,EAAUC,YAAV,CAhCM,CAAP;AAkCA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useListViewClientIds( { blocks, rootClientId } ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\t__unstableGetClientIdsTree,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst removeDisabledBlocks = ( tree ) => {\n\t\t\t\treturn tree.flatMap( ( { clientId, innerBlocks, ...rest } ) => {\n\t\t\t\t\tif ( getBlockEditingMode( clientId ) === 'disabled' ) {\n\t\t\t\t\t\treturn removeDisabledBlocks( innerBlocks );\n\t\t\t\t\t}\n\t\t\t\t\treturn [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tinnerBlocks: removeDisabledBlocks( innerBlocks ),\n\t\t\t\t\t\t\t...rest,\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t} );\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tselectedClientIds: getSelectedBlockClientIds(),\n\t\t\t\tdraggedClientIds: getDraggedBlockClientIds(),\n\t\t\t\tclientIdsTree: removeDisabledBlocks(\n\t\t\t\t\tblocks ?? __unstableGetClientIdsTree( rootClientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ blocks, rootClientId ]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-client-ids.js"],"names":["useListViewClientIds","blocks","rootClientId","select","getDraggedBlockClientIds","getSelectedBlockClientIds","getListViewClientIdsTree","blockEditorStore","selectedClientIds","draggedClientIds","clientIdsTree"],"mappings":";;;;;;;AAIA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,oBAAT,CAA+B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA/B,EAA0D;AACxE,SAAO,qBACJC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,wBADK;AAELC,MAAAA,yBAFK;AAGLC,MAAAA;AAHK,QAIF,wBAAQH,MAAM,CAAEI,YAAF,CAAd,CAJJ;AAMA,WAAO;AACNC,MAAAA,iBAAiB,EAAEH,yBAAyB,EADtC;AAENI,MAAAA,gBAAgB,EAAEL,wBAAwB,EAFpC;AAGNM,MAAAA,aAAa,EACZT,MADY,aACZA,MADY,cACZA,MADY,GACFK,wBAAwB,CAAEJ,YAAF;AAJ7B,KAAP;AAMA,GAdK,EAeN,CAAED,MAAF,EAAUC,YAAV,CAfM,CAAP;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useListViewClientIds( { blocks, rootClientId } ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetListViewClientIdsTree,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\treturn {\n\t\t\t\tselectedClientIds: getSelectedBlockClientIds(),\n\t\t\t\tdraggedClientIds: getDraggedBlockClientIds(),\n\t\t\t\tclientIdsTree:\n\t\t\t\t\tblocks ?? getListViewClientIdsTree( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ blocks, rootClientId ]\n\t);\n}\n"]}
@@ -15,6 +15,8 @@ var _element = require("@wordpress/element");
15
15
 
16
16
  var _compose = require("@wordpress/compose");
17
17
 
18
+ var _i18n = require("@wordpress/i18n");
19
+
18
20
  var _math = require("../../utils/math");
19
21
 
20
22
  var _useOnBlockDrop = _interopRequireDefault(require("../use-on-block-drop"));
@@ -80,16 +82,17 @@ const NESTING_LEVEL_INDENTATION = 28;
80
82
  * @param {WPPoint} point The point representing the cursor position when dragging.
81
83
  * @param {DOMRect} rect The rectangle.
82
84
  * @param {number} nestingLevel The nesting level of the block.
85
+ * @param {boolean} rtl Whether the editor is in RTL mode.
83
86
  * @return {boolean} Whether the gesture is an upward gesture.
84
87
  */
85
88
 
86
89
  exports.NESTING_LEVEL_INDENTATION = NESTING_LEVEL_INDENTATION;
87
90
 
88
- function isUpGesture(point, rect, nestingLevel = 1) {
91
+ function isUpGesture(point, rect, nestingLevel = 1, rtl = false) {
89
92
  // If the block is nested, and the user is dragging to the bottom
90
- // left of the block, then it is an upward gesture.
91
- const blockIndentPosition = rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
92
- return point.x < blockIndentPosition;
93
+ // left of the block (or bottom right in RTL languages), then it is an upward gesture.
94
+ const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
95
+ return rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition;
93
96
  }
94
97
  /**
95
98
  * Returns how many nesting levels up the user is attempting to drag to.
@@ -106,13 +109,17 @@ function isUpGesture(point, rect, nestingLevel = 1) {
106
109
  * @param {WPPoint} point The point representing the cursor position when dragging.
107
110
  * @param {DOMRect} rect The rectangle.
108
111
  * @param {number} nestingLevel The nesting level of the block.
112
+ * @param {boolean} rtl Whether the editor is in RTL mode.
109
113
  * @return {number} The desired relative parent level.
110
114
  */
111
115
 
112
116
 
113
- function getDesiredRelativeParentLevel(point, rect, nestingLevel = 1) {
114
- const blockIndentPosition = rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
115
- const desiredParentLevel = Math.round((point.x - blockIndentPosition) / NESTING_LEVEL_INDENTATION);
117
+ function getDesiredRelativeParentLevel(point, rect, nestingLevel = 1, rtl = false) {
118
+ // In RTL languages, the block indent position is from the right edge of the block.
119
+ // In LTR languages, the block indent position is from the left edge of the block.
120
+ const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
121
+ const distanceBetweenPointAndBlockIndentPosition = rtl ? blockIndentPosition - point.x : point.x - blockIndentPosition;
122
+ const desiredParentLevel = Math.round(distanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION);
116
123
  return Math.abs(desiredParentLevel);
117
124
  }
118
125
  /**
@@ -167,12 +174,14 @@ function getNextNonDraggedBlock(blocksData, index) {
167
174
  * @param {WPPoint} point The point representing the cursor position when dragging.
168
175
  * @param {DOMRect} rect The rectangle.
169
176
  * @param {number} nestingLevel The nesting level of the block.
177
+ * @param {boolean} rtl Whether the editor is in RTL mode.
170
178
  */
171
179
 
172
180
 
173
- function isNestingGesture(point, rect, nestingLevel = 1) {
174
- const blockIndentPosition = rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
175
- return point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION && point.y < rect.bottom;
181
+ function isNestingGesture(point, rect, nestingLevel = 1, rtl = false) {
182
+ const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
183
+ const isNestingHorizontalGesture = rtl ? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION : point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;
184
+ return isNestingHorizontalGesture && point.y < rect.bottom;
176
185
  } // Block navigation is always a vertical list, so only allow dropping
177
186
  // to the above or below a block.
178
187
 
@@ -183,11 +192,12 @@ const ALLOWED_DROP_EDGES = ['top', 'bottom'];
183
192
  *
184
193
  * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.
185
194
  * @param {WPPoint} position The point representing the cursor position when dragging.
195
+ * @param {boolean} rtl Whether the editor is in RTL mode.
186
196
  *
187
197
  * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.
188
198
  */
189
199
 
190
- function getListViewDropTarget(blocksData, position) {
200
+ function getListViewDropTarget(blocksData, position, rtl = false) {
191
201
  let candidateEdge;
192
202
  let candidateBlockData;
193
203
  let candidateDistance;
@@ -242,16 +252,33 @@ function getListViewDropTarget(blocksData, position) {
242
252
 
243
253
  const candidateBlockParents = getCandidateBlockParents(candidateBlockData, blocksData);
244
254
  const isDraggingBelow = candidateEdge === 'bottom'; // If the user is dragging towards the bottom of the block check whether
255
+ // they might be trying to nest the block as a child.
256
+ // If the block already has inner blocks, and is expanded, this should be treated
257
+ // as nesting since the next block in the tree will be the first child.
258
+ // However, if the block is collapsed, dragging beneath the block should
259
+ // still be allowed, as the next visible block in the tree will be a sibling.
260
+
261
+ if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 && candidateBlockData.isExpanded || isNestingGesture(position, candidateRect, candidateBlockParents.length, rtl))) {
262
+ // If the block is expanded, insert the block as the first child.
263
+ // Otherwise, for collapsed blocks, insert the block as the last child.
264
+ const newBlockIndex = candidateBlockData.isExpanded ? 0 : candidateBlockData.innerBlockCount || 0;
265
+ return {
266
+ rootClientId: candidateBlockData.clientId,
267
+ blockIndex: newBlockIndex,
268
+ dropPosition: 'inside'
269
+ };
270
+ } // If the user is dragging towards the bottom of the block check whether
245
271
  // they might be trying to move the block to be at a parent level.
246
272
 
247
- if (isDraggingBelow && candidateBlockData.rootClientId && isUpGesture(position, candidateRect, candidateBlockParents.length)) {
273
+
274
+ if (isDraggingBelow && candidateBlockData.rootClientId && isUpGesture(position, candidateRect, candidateBlockParents.length, rtl)) {
248
275
  const nextBlock = getNextNonDraggedBlock(blocksData, candidateBlockIndex);
249
276
  const currentLevel = candidateBlockData.nestingLevel;
250
277
  const nextLevel = nextBlock ? nextBlock.nestingLevel : 1;
251
278
 
252
279
  if (currentLevel && nextLevel) {
253
280
  // Determine the desired relative level of the block to be dropped.
254
- const desiredRelativeLevel = getDesiredRelativeParentLevel(position, candidateRect, candidateBlockParents.length);
281
+ const desiredRelativeLevel = getDesiredRelativeParentLevel(position, candidateRect, candidateBlockParents.length, rtl);
255
282
  const targetParentIndex = Math.max(Math.min(desiredRelativeLevel, currentLevel - nextLevel), 0);
256
283
 
257
284
  if (candidateBlockParents[targetParentIndex]) {
@@ -283,23 +310,6 @@ function getListViewDropTarget(blocksData, position) {
283
310
  };
284
311
  }
285
312
  }
286
- } // If the user is dragging towards the bottom of the block check whether
287
- // they might be trying to nest the block as a child.
288
- // If the block already has inner blocks, and is expanded, this should be treated
289
- // as nesting since the next block in the tree will be the first child.
290
- // However, if the block is collapsed, dragging beneath the block should
291
- // still be allowed, as the next visible block in the tree will be a sibling.
292
-
293
-
294
- if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 && candidateBlockData.isExpanded || isNestingGesture(position, candidateRect, candidateBlockParents.length))) {
295
- // If the block is expanded, insert the block as the first child.
296
- // Otherwise, for collapsed blocks, insert the block as the last child.
297
- const newBlockIndex = candidateBlockData.isExpanded ? 0 : candidateBlockData.innerBlockCount || 0;
298
- return {
299
- rootClientId: candidateBlockData.clientId,
300
- blockIndex: newBlockIndex,
301
- dropPosition: 'inside'
302
- };
303
313
  } // If dropping as a sibling, but block cannot be inserted in
304
314
  // this context, return early.
305
315
 
@@ -342,6 +352,7 @@ function useListViewDropZone({
342
352
  blockIndex: targetBlockIndex
343
353
  } = target || {};
344
354
  const onBlockDrop = (0, _useOnBlockDrop.default)(targetRootClientId, targetBlockIndex);
355
+ const rtl = (0, _i18n.isRTL)();
345
356
  const draggedBlockClientIds = getDraggedBlockClientIds();
346
357
  const throttled = (0, _compose.useThrottle)((0, _element.useCallback)((event, currentTarget) => {
347
358
  const position = {
@@ -352,7 +363,8 @@ function useListViewDropZone({
352
363
  const blockElements = Array.from(currentTarget.querySelectorAll('[data-block]'));
353
364
  const blocksData = blockElements.map(blockElement => {
354
365
  const clientId = blockElement.dataset.block;
355
- const isExpanded = blockElement.dataset.expanded === 'true'; // Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.
366
+ const isExpanded = blockElement.dataset.expanded === 'true';
367
+ const isDraggedBlock = blockElement.classList.contains('is-dragging'); // Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.
356
368
 
357
369
  const nestingLevel = parseInt(blockElement.getAttribute('aria-level'), 10);
358
370
  const rootClientId = getBlockRootClientId(clientId);
@@ -363,18 +375,18 @@ function useListViewDropZone({
363
375
  blockIndex: getBlockIndex(clientId),
364
376
  element: blockElement,
365
377
  nestingLevel: nestingLevel || undefined,
366
- isDraggedBlock: isBlockDrag ? draggedBlockClientIds.includes(clientId) : false,
378
+ isDraggedBlock: isBlockDrag ? isDraggedBlock : false,
367
379
  innerBlockCount: getBlockCount(clientId),
368
380
  canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, rootClientId) : true,
369
381
  canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true
370
382
  };
371
383
  });
372
- const newTarget = getListViewDropTarget(blocksData, position);
384
+ const newTarget = getListViewDropTarget(blocksData, position, rtl);
373
385
 
374
386
  if (newTarget) {
375
387
  setTarget(newTarget);
376
388
  }
377
- }, [draggedBlockClientIds]), 200);
389
+ }, [canInsertBlocks, draggedBlockClientIds, getBlockCount, getBlockIndex, getBlockRootClientId, rtl]), 200);
378
390
  const ref = (0, _compose.__experimentalUseDropZone)({
379
391
  dropZoneElement,
380
392
  onDrop: onBlockDrop,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-drop-zone.js"],"names":["NESTING_LEVEL_INDENTATION","isUpGesture","point","rect","nestingLevel","blockIndentPosition","left","x","getDesiredRelativeParentLevel","desiredParentLevel","Math","round","abs","getCandidateBlockParents","candidateBlockData","blocksData","candidateBlockParents","currentBlockData","push","find","blockData","clientId","rootClientId","getNextNonDraggedBlock","index","nextBlockData","isDraggedBlock","isNestingGesture","y","bottom","ALLOWED_DROP_EDGES","getListViewDropTarget","position","candidateEdge","candidateDistance","candidateRect","candidateBlockIndex","i","length","element","getBoundingClientRect","distance","edge","isCursorWithinBlock","undefined","indexOf","previousBlockData","isDraggingBelow","nextBlock","currentLevel","nextLevel","desiredRelativeLevel","targetParentIndex","max","min","newBlockIndex","blockIndex","dropPosition","canInsertDraggedBlocksAsChild","innerBlockCount","isExpanded","canInsertDraggedBlocksAsSibling","offset","useListViewDropZone","dropZoneElement","getBlockRootClientId","getBlockIndex","getBlockCount","getDraggedBlockClientIds","canInsertBlocks","blockEditorStore","target","setTarget","targetRootClientId","targetBlockIndex","onBlockDrop","draggedBlockClientIds","throttled","event","currentTarget","clientX","clientY","isBlockDrag","blockElements","Array","from","querySelectorAll","map","blockElement","dataset","block","expanded","parseInt","getAttribute","includes","newTarget","ref","onDrop","onDragLeave","cancel","onDragOver","onDragEnd"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAQA;;AAIA;;AACA;;AAlBA;AACA;AACA;;AAQA;AACA;AACA;;AAQA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACO,MAAMA,yBAAyB,GAAG,EAAlC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASC,WAAT,CAAsBC,KAAtB,EAA6BC,IAA7B,EAAmCC,YAAY,GAAG,CAAlD,EAAsD;AACrD;AACA;AACA,QAAMC,mBAAmB,GACxBF,IAAI,CAACG,IAAL,GAAYF,YAAY,GAAGJ,yBAD5B;AAEA,SAAOE,KAAK,CAACK,CAAN,GAAUF,mBAAjB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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,EAAyBvD,QAAzB,CADwB,GAEvC;AAnBG,OAAP;AAqBA,KAhCkB,CAAnB;AAkCA,UAAM0E,SAAS,GAAGhE,qBAAqB,CAAEhB,UAAF,EAAciB,QAAd,CAAvC;;AAEA,QAAK+D,SAAL,EAAiB;AAChBvB,MAAAA,SAAS,CAAEuB,SAAF,CAAT;AACA;AACD,GAhDF,EAiDC,CAAEnB,qBAAF,CAjDD,CADiB,EAoDjB,GApDiB,CAAlB;AAuDA,QAAMoB,GAAG,GAAG,wCAAa;AACxBhC,IAAAA,eADwB;AAExBiC,IAAAA,MAAM,EAAEtB,WAFgB;;AAGxBuB,IAAAA,WAAW,GAAG;AACbrB,MAAAA,SAAS,CAACsB,MAAV;AACA3B,MAAAA,SAAS,CAAE,IAAF,CAAT;AACA,KANuB;;AAOxB4B,IAAAA,UAAU,CAAEtB,KAAF,EAAU;AACnB;AACA;AACA;AACAD,MAAAA,SAAS,CAAEC,KAAF,EAASA,KAAK,CAACC,aAAf,CAAT;AACA,KAZuB;;AAaxBsB,IAAAA,SAAS,GAAG;AACXxB,MAAAA,SAAS,CAACsB,MAAV;AACA3B,MAAAA,SAAS,CAAE,IAAF,CAAT;AACA;;AAhBuB,GAAb,CAAZ;AAmBA,SAAO;AAAEwB,IAAAA,GAAF;AAAOzB,IAAAA;AAAP,GAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useCallback } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n} from '../../utils/math';\nimport useOnBlockDrop from '../use-on-block-drop';\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n\n/**\n * The type of a drag event.\n *\n * @typedef {'default'|'file'|'html'} WPDragEventType\n */\n\n/**\n * An object representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {Object} WPListViewDropZoneBlock\n * @property {string} clientId The client id for the block.\n * @property {string} rootClientId The root client id for the block.\n * @property {number} blockIndex The block's index.\n * @property {Element} element The DOM element representing the block.\n * @property {number} innerBlockCount The number of inner blocks the block has.\n * @property {boolean} isDraggedBlock Whether the block is currently being dragged.\n * @property {boolean} isExpanded Whether the block is expanded in the UI.\n * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block.\n * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.\n */\n\n/**\n * An array representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {WPListViewDropZoneBlock[]} WPListViewDropZoneBlocks\n */\n\n/**\n * An object containing details of a drop target.\n *\n * @typedef {Object} WPListViewDropZoneTarget\n * @property {string} blockIndex The insertion index.\n * @property {string} rootClientId The root client id for the block.\n * @property {string|undefined} clientId The client id for the block.\n * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to.\n * 'inside' refers to nesting as an inner block.\n */\n\n// When the indentation level, the corresponding left margin in `style.scss`\n// must be updated as well to ensure the drop zone is aligned with the indentation.\nexport const NESTING_LEVEL_INDENTATION = 28;\n\n/**\n * Determines whether the user is positioning the dragged block to be\n * moved up to a parent level.\n *\n * Determined based on nesting level indentation of the current block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @return {boolean} Whether the gesture is an upward gesture.\n */\nfunction isUpGesture( point, rect, nestingLevel = 1 ) {\n\t// If the block is nested, and the user is dragging to the bottom\n\t// left of the block, then it is an upward gesture.\n\tconst blockIndentPosition =\n\t\trect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\treturn point.x < blockIndentPosition;\n}\n\n/**\n * Returns how many nesting levels up the user is attempting to drag to.\n *\n * The relative parent level is calculated based on how far\n * the cursor is from the provided nesting level (e.g. of a candidate block\n * that the user is hovering over). The nesting level is considered \"desired\"\n * because it is not guaranteed that the user will be able to drag to the desired level.\n *\n * The returned integer can be used to access an ascending array\n * of parent blocks, where the first item is the block the user\n * is hovering over, and the last item is the root block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @return {number} The desired relative parent level.\n */\nfunction getDesiredRelativeParentLevel( point, rect, nestingLevel = 1 ) {\n\tconst blockIndentPosition =\n\t\trect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\tconst desiredParentLevel = Math.round(\n\t\t( point.x - blockIndentPosition ) / NESTING_LEVEL_INDENTATION\n\t);\n\treturn Math.abs( desiredParentLevel );\n}\n\n/**\n * Returns an array of the parent blocks of the block the user is dropping to.\n *\n * @param {WPListViewDropZoneBlock} candidateBlockData The block the user is dropping to.\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @return {WPListViewDropZoneBlocks} An array of block parents, including the block the user is dropping to.\n */\nfunction getCandidateBlockParents( candidateBlockData, blocksData ) {\n\tconst candidateBlockParents = [];\n\tlet currentBlockData = candidateBlockData;\n\n\twhile ( currentBlockData ) {\n\t\tcandidateBlockParents.push( { ...currentBlockData } );\n\t\tcurrentBlockData = blocksData.find(\n\t\t\t( blockData ) =>\n\t\t\t\tblockData.clientId === currentBlockData.rootClientId\n\t\t);\n\t}\n\n\treturn candidateBlockParents;\n}\n\n/**\n * Given a list of blocks data and a block index, return the next non-dragged\n * block. This is used to determine the block that the user is dropping to,\n * while ignoring the dragged block.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {number} index The index to begin searching from.\n * @return {WPListViewDropZoneBlock | undefined} The next non-dragged block.\n */\nfunction getNextNonDraggedBlock( blocksData, index ) {\n\tconst nextBlockData = blocksData[ index + 1 ];\n\tif ( nextBlockData && nextBlockData.isDraggedBlock ) {\n\t\treturn getNextNonDraggedBlock( blocksData, index + 1 );\n\t}\n\n\treturn nextBlockData;\n}\n\n/**\n * Determines whether the user positioning the dragged block to nest as an\n * inner block.\n *\n * Determined based on nesting level indentation of the current block, plus\n * the indentation of the next level of nesting. The vertical position of the\n * cursor must also be within the block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n */\nfunction isNestingGesture( point, rect, nestingLevel = 1 ) {\n\tconst blockIndentPosition =\n\t\trect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\treturn (\n\t\tpoint.x > blockIndentPosition + NESTING_LEVEL_INDENTATION &&\n\t\tpoint.y < rect.bottom\n\t);\n}\n\n// Block navigation is always a vertical list, so only allow dropping\n// to the above or below a block.\nconst ALLOWED_DROP_EDGES = [ 'top', 'bottom' ];\n\n/**\n * Given blocks data and the cursor position, compute the drop target.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {WPPoint} position The point representing the cursor position when dragging.\n *\n * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.\n */\nexport function getListViewDropTarget( blocksData, position ) {\n\tlet candidateEdge;\n\tlet candidateBlockData;\n\tlet candidateDistance;\n\tlet candidateRect;\n\tlet candidateBlockIndex;\n\n\tfor ( let i = 0; i < blocksData.length; i++ ) {\n\t\tconst blockData = blocksData[ i ];\n\t\tif ( blockData.isDraggedBlock ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst rect = blockData.element.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\tposition,\n\t\t\trect,\n\t\t\tALLOWED_DROP_EDGES\n\t\t);\n\n\t\tconst isCursorWithinBlock = isPointContainedByRect( position, rect );\n\t\tif (\n\t\t\tcandidateDistance === undefined ||\n\t\t\tdistance < candidateDistance ||\n\t\t\tisCursorWithinBlock\n\t\t) {\n\t\t\tcandidateDistance = distance;\n\n\t\t\tconst index = blocksData.indexOf( blockData );\n\t\t\tconst previousBlockData = blocksData[ index - 1 ];\n\n\t\t\t// If dragging near the top of a block and the preceding block\n\t\t\t// is at the same level, use the preceding block as the candidate\n\t\t\t// instead, as later it makes determining a nesting drop easier.\n\t\t\tif (\n\t\t\t\tedge === 'top' &&\n\t\t\t\tpreviousBlockData &&\n\t\t\t\tpreviousBlockData.rootClientId === blockData.rootClientId &&\n\t\t\t\t! previousBlockData.isDraggedBlock\n\t\t\t) {\n\t\t\t\tcandidateBlockData = previousBlockData;\n\t\t\t\tcandidateEdge = 'bottom';\n\t\t\t\tcandidateRect =\n\t\t\t\t\tpreviousBlockData.element.getBoundingClientRect();\n\t\t\t\tcandidateBlockIndex = index - 1;\n\t\t\t} else {\n\t\t\t\tcandidateBlockData = blockData;\n\t\t\t\tcandidateEdge = edge;\n\t\t\t\tcandidateRect = rect;\n\t\t\t\tcandidateBlockIndex = index;\n\t\t\t}\n\n\t\t\t// If the mouse position is within the block, break early\n\t\t\t// as the user would intend to drop either before or after\n\t\t\t// this block.\n\t\t\t//\n\t\t\t// This solves an issue where some rows in the list view\n\t\t\t// tree overlap slightly due to sub-pixel rendering.\n\t\t\tif ( isCursorWithinBlock ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( ! candidateBlockData ) {\n\t\treturn;\n\t}\n\n\tconst candidateBlockParents = getCandidateBlockParents(\n\t\tcandidateBlockData,\n\t\tblocksData\n\t);\n\n\tconst isDraggingBelow = candidateEdge === 'bottom';\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to move the block to be at a parent level.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.rootClientId &&\n\t\tisUpGesture( position, candidateRect, candidateBlockParents.length )\n\t) {\n\t\tconst nextBlock = getNextNonDraggedBlock(\n\t\t\tblocksData,\n\t\t\tcandidateBlockIndex\n\t\t);\n\t\tconst currentLevel = candidateBlockData.nestingLevel;\n\t\tconst nextLevel = nextBlock ? nextBlock.nestingLevel : 1;\n\n\t\tif ( currentLevel && nextLevel ) {\n\t\t\t// Determine the desired relative level of the block to be dropped.\n\t\t\tconst desiredRelativeLevel = getDesiredRelativeParentLevel(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length\n\t\t\t);\n\n\t\t\tconst targetParentIndex = Math.max(\n\t\t\t\tMath.min( desiredRelativeLevel, currentLevel - nextLevel ),\n\t\t\t\t0\n\t\t\t);\n\n\t\t\tif ( candidateBlockParents[ targetParentIndex ] ) {\n\t\t\t\t// Default to the block index of the candidate block.\n\t\t\t\tlet newBlockIndex = candidateBlockData.blockIndex;\n\n\t\t\t\t// If the next block is at the same level, use that as the default\n\t\t\t\t// block index. This ensures that the block is dropped in the correct\n\t\t\t\t// position when dragging to the bottom of a block.\n\t\t\t\tif (\n\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].nestingLevel ===\n\t\t\t\t\tnextBlock?.nestingLevel\n\t\t\t\t) {\n\t\t\t\t\tnewBlockIndex = nextBlock?.blockIndex;\n\t\t\t\t} else {\n\t\t\t\t\t// Otherwise, search from the current block index back\n\t\t\t\t\t// to find the last block index within the same target parent.\n\t\t\t\t\tfor ( let i = candidateBlockIndex; i >= 0; i-- ) {\n\t\t\t\t\t\tconst blockData = blocksData[ i ];\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tblockData.rootClientId ===\n\t\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ]\n\t\t\t\t\t\t\t\t.rootClientId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewBlockIndex = blockData.blockIndex + 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\trootClientId:\n\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].rootClientId,\n\t\t\t\t\tclientId: candidateBlockData.clientId,\n\t\t\t\t\tblockIndex: newBlockIndex,\n\t\t\t\t\tdropPosition: candidateEdge,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to nest the block as a child.\n\t// If the block already has inner blocks, and is expanded, this should be treated\n\t// as nesting since the next block in the tree will be the first child.\n\t// However, if the block is collapsed, dragging beneath the block should\n\t// still be allowed, as the next visible block in the tree will be a sibling.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.canInsertDraggedBlocksAsChild &&\n\t\t( ( candidateBlockData.innerBlockCount > 0 &&\n\t\t\tcandidateBlockData.isExpanded ) ||\n\t\t\tisNestingGesture(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length\n\t\t\t) )\n\t) {\n\t\t// If the block is expanded, insert the block as the first child.\n\t\t// Otherwise, for collapsed blocks, insert the block as the last child.\n\t\tconst newBlockIndex = candidateBlockData.isExpanded\n\t\t\t? 0\n\t\t\t: candidateBlockData.innerBlockCount || 0;\n\n\t\treturn {\n\t\t\trootClientId: candidateBlockData.clientId,\n\t\t\tblockIndex: newBlockIndex,\n\t\t\tdropPosition: 'inside',\n\t\t};\n\t}\n\n\t// If dropping as a sibling, but block cannot be inserted in\n\t// this context, return early.\n\tif ( ! candidateBlockData.canInsertDraggedBlocksAsSibling ) {\n\t\treturn;\n\t}\n\n\tconst offset = isDraggingBelow ? 1 : 0;\n\treturn {\n\t\trootClientId: candidateBlockData.rootClientId,\n\t\tclientId: candidateBlockData.clientId,\n\t\tblockIndex: candidateBlockData.blockIndex + offset,\n\t\tdropPosition: candidateEdge,\n\t};\n}\n\n/**\n * A react hook for implementing a drop zone in list view.\n *\n * @param {Object} props Named parameters.\n * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.\n *\n * @return {WPListViewDropZoneTarget} The drop target.\n */\nexport default function useListViewDropZone( { dropZoneElement } ) {\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockCount,\n\t\tgetDraggedBlockClientIds,\n\t\tcanInsertBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst [ target, setTarget ] = useState();\n\tconst { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } =\n\t\ttarget || {};\n\n\tconst onBlockDrop = useOnBlockDrop( targetRootClientId, targetBlockIndex );\n\n\tconst draggedBlockClientIds = getDraggedBlockClientIds();\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, currentTarget ) => {\n\t\t\t\tconst position = { x: event.clientX, y: event.clientY };\n\t\t\t\tconst isBlockDrag = !! draggedBlockClientIds?.length;\n\n\t\t\t\tconst blockElements = Array.from(\n\t\t\t\t\tcurrentTarget.querySelectorAll( '[data-block]' )\n\t\t\t\t);\n\n\t\t\t\tconst blocksData = blockElements.map( ( blockElement ) => {\n\t\t\t\t\tconst clientId = blockElement.dataset.block;\n\t\t\t\t\tconst isExpanded = blockElement.dataset.expanded === 'true';\n\n\t\t\t\t\t// Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.\n\t\t\t\t\tconst nestingLevel = parseInt(\n\t\t\t\t\t\tblockElement.getAttribute( 'aria-level' ),\n\t\t\t\t\t\t10\n\t\t\t\t\t);\n\t\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tisExpanded,\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\telement: blockElement,\n\t\t\t\t\t\tnestingLevel: nestingLevel || undefined,\n\t\t\t\t\t\tisDraggedBlock: isBlockDrag\n\t\t\t\t\t\t\t? draggedBlockClientIds.includes( clientId )\n\t\t\t\t\t\t\t: false,\n\t\t\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t\t\t\tcanInsertDraggedBlocksAsSibling: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks(\n\t\t\t\t\t\t\t\t\tdraggedBlockClientIds,\n\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t\tcanInsertDraggedBlocksAsChild: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks( draggedBlockClientIds, clientId )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst newTarget = getListViewDropTarget( blocksData, position );\n\n\t\t\t\tif ( newTarget ) {\n\t\t\t\t\tsetTarget( newTarget );\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ draggedBlockClientIds ]\n\t\t),\n\t\t200\n\t);\n\n\tconst ref = useDropZone( {\n\t\tdropZoneElement,\n\t\tonDrop: onBlockDrop,\n\t\tonDragLeave() {\n\t\t\tthrottled.cancel();\n\t\t\tsetTarget( null );\n\t\t},\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\tsetTarget( null );\n\t\t},\n\t} );\n\n\treturn { ref, target };\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-drop-zone.js"],"names":["NESTING_LEVEL_INDENTATION","isUpGesture","point","rect","nestingLevel","rtl","blockIndentPosition","right","left","x","getDesiredRelativeParentLevel","distanceBetweenPointAndBlockIndentPosition","desiredParentLevel","Math","round","abs","getCandidateBlockParents","candidateBlockData","blocksData","candidateBlockParents","currentBlockData","push","find","blockData","clientId","rootClientId","getNextNonDraggedBlock","index","nextBlockData","isDraggedBlock","isNestingGesture","isNestingHorizontalGesture","y","bottom","ALLOWED_DROP_EDGES","getListViewDropTarget","position","candidateEdge","candidateDistance","candidateRect","candidateBlockIndex","i","length","element","getBoundingClientRect","distance","edge","isCursorWithinBlock","undefined","indexOf","previousBlockData","isDraggingBelow","canInsertDraggedBlocksAsChild","innerBlockCount","isExpanded","newBlockIndex","blockIndex","dropPosition","nextBlock","currentLevel","nextLevel","desiredRelativeLevel","targetParentIndex","max","min","canInsertDraggedBlocksAsSibling","offset","useListViewDropZone","dropZoneElement","getBlockRootClientId","getBlockIndex","getBlockCount","getDraggedBlockClientIds","canInsertBlocks","blockEditorStore","target","setTarget","targetRootClientId","targetBlockIndex","onBlockDrop","draggedBlockClientIds","throttled","event","currentTarget","clientX","clientY","isBlockDrag","blockElements","Array","from","querySelectorAll","map","blockElement","dataset","block","expanded","classList","contains","parseInt","getAttribute","newTarget","ref","onDrop","onDragLeave","cancel","onDragOver","onDragEnd"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAIA;;AAKA;;AAIA;;AACA;;AAnBA;AACA;AACA;;AASA;AACA;AACA;;AAQA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACO,MAAMA,yBAAyB,GAAG,EAAlC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASC,WAAT,CAAsBC,KAAtB,EAA6BC,IAA7B,EAAmCC,YAAY,GAAG,CAAlD,EAAqDC,GAAG,GAAG,KAA3D,EAAmE;AAClE;AACA;AACA,QAAMC,mBAAmB,GAAGD,GAAG,GAC5BF,IAAI,CAACI,KAAL,GAAaH,YAAY,GAAGJ,yBADA,GAE5BG,IAAI,CAACK,IAAL,GAAYJ,YAAY,GAAGJ,yBAF9B;AAGA,SAAOK,GAAG,GAAGH,KAAK,CAACO,CAAN,GAAUH,mBAAb,GAAmCJ,KAAK,CAACO,CAAN,GAAUH,mBAAvD;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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f,CAAT;AACA,KAZuB;;AAaxBuB,IAAAA,SAAS,GAAG;AACXzB,MAAAA,SAAS,CAACuB,MAAV;AACA5B,MAAAA,SAAS,CAAE,IAAF,CAAT;AACA;;AAhBuB,GAAb,CAAZ;AAmBA,SAAO;AAAEyB,IAAAA,GAAF;AAAO1B,IAAAA;AAAP,GAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useCallback } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n} from '../../utils/math';\nimport useOnBlockDrop from '../use-on-block-drop';\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n\n/**\n * The type of a drag event.\n *\n * @typedef {'default'|'file'|'html'} WPDragEventType\n */\n\n/**\n * An object representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {Object} WPListViewDropZoneBlock\n * @property {string} clientId The client id for the block.\n * @property {string} rootClientId The root client id for the block.\n * @property {number} blockIndex The block's index.\n * @property {Element} element The DOM element representing the block.\n * @property {number} innerBlockCount The number of inner blocks the block has.\n * @property {boolean} isDraggedBlock Whether the block is currently being dragged.\n * @property {boolean} isExpanded Whether the block is expanded in the UI.\n * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block.\n * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.\n */\n\n/**\n * An array representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {WPListViewDropZoneBlock[]} WPListViewDropZoneBlocks\n */\n\n/**\n * An object containing details of a drop target.\n *\n * @typedef {Object} WPListViewDropZoneTarget\n * @property {string} blockIndex The insertion index.\n * @property {string} rootClientId The root client id for the block.\n * @property {string|undefined} clientId The client id for the block.\n * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to.\n * 'inside' refers to nesting as an inner block.\n */\n\n// When the indentation level, the corresponding left margin in `style.scss`\n// must be updated as well to ensure the drop zone is aligned with the indentation.\nexport const NESTING_LEVEL_INDENTATION = 28;\n\n/**\n * Determines whether the user is positioning the dragged block to be\n * moved up to a parent level.\n *\n * Determined based on nesting level indentation of the current block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {boolean} Whether the gesture is an upward gesture.\n */\nfunction isUpGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\t// If the block is nested, and the user is dragging to the bottom\n\t// left of the block (or bottom right in RTL languages), then it is an upward gesture.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\treturn rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition;\n}\n\n/**\n * Returns how many nesting levels up the user is attempting to drag to.\n *\n * The relative parent level is calculated based on how far\n * the cursor is from the provided nesting level (e.g. of a candidate block\n * that the user is hovering over). The nesting level is considered \"desired\"\n * because it is not guaranteed that the user will be able to drag to the desired level.\n *\n * The returned integer can be used to access an ascending array\n * of parent blocks, where the first item is the block the user\n * is hovering over, and the last item is the root block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {number} The desired relative parent level.\n */\nfunction getDesiredRelativeParentLevel(\n\tpoint,\n\trect,\n\tnestingLevel = 1,\n\trtl = false\n) {\n\t// In RTL languages, the block indent position is from the right edge of the block.\n\t// In LTR languages, the block indent position is from the left edge of the block.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst distanceBetweenPointAndBlockIndentPosition = rtl\n\t\t? blockIndentPosition - point.x\n\t\t: point.x - blockIndentPosition;\n\n\tconst desiredParentLevel = Math.round(\n\t\tdistanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION\n\t);\n\n\treturn Math.abs( desiredParentLevel );\n}\n\n/**\n * Returns an array of the parent blocks of the block the user is dropping to.\n *\n * @param {WPListViewDropZoneBlock} candidateBlockData The block the user is dropping to.\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @return {WPListViewDropZoneBlocks} An array of block parents, including the block the user is dropping to.\n */\nfunction getCandidateBlockParents( candidateBlockData, blocksData ) {\n\tconst candidateBlockParents = [];\n\tlet currentBlockData = candidateBlockData;\n\n\twhile ( currentBlockData ) {\n\t\tcandidateBlockParents.push( { ...currentBlockData } );\n\t\tcurrentBlockData = blocksData.find(\n\t\t\t( blockData ) =>\n\t\t\t\tblockData.clientId === currentBlockData.rootClientId\n\t\t);\n\t}\n\n\treturn candidateBlockParents;\n}\n\n/**\n * Given a list of blocks data and a block index, return the next non-dragged\n * block. This is used to determine the block that the user is dropping to,\n * while ignoring the dragged block.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {number} index The index to begin searching from.\n * @return {WPListViewDropZoneBlock | undefined} The next non-dragged block.\n */\nfunction getNextNonDraggedBlock( blocksData, index ) {\n\tconst nextBlockData = blocksData[ index + 1 ];\n\tif ( nextBlockData && nextBlockData.isDraggedBlock ) {\n\t\treturn getNextNonDraggedBlock( blocksData, index + 1 );\n\t}\n\n\treturn nextBlockData;\n}\n\n/**\n * Determines whether the user positioning the dragged block to nest as an\n * inner block.\n *\n * Determined based on nesting level indentation of the current block, plus\n * the indentation of the next level of nesting. The vertical position of the\n * cursor must also be within the block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n */\nfunction isNestingGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst isNestingHorizontalGesture = rtl\n\t\t? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION\n\t\t: point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;\n\n\treturn isNestingHorizontalGesture && point.y < rect.bottom;\n}\n\n// Block navigation is always a vertical list, so only allow dropping\n// to the above or below a block.\nconst ALLOWED_DROP_EDGES = [ 'top', 'bottom' ];\n\n/**\n * Given blocks data and the cursor position, compute the drop target.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {WPPoint} position The point representing the cursor position when dragging.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n *\n * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.\n */\nexport function getListViewDropTarget( blocksData, position, rtl = false ) {\n\tlet candidateEdge;\n\tlet candidateBlockData;\n\tlet candidateDistance;\n\tlet candidateRect;\n\tlet candidateBlockIndex;\n\n\tfor ( let i = 0; i < blocksData.length; i++ ) {\n\t\tconst blockData = blocksData[ i ];\n\t\tif ( blockData.isDraggedBlock ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst rect = blockData.element.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\tposition,\n\t\t\trect,\n\t\t\tALLOWED_DROP_EDGES\n\t\t);\n\n\t\tconst isCursorWithinBlock = isPointContainedByRect( position, rect );\n\t\tif (\n\t\t\tcandidateDistance === undefined ||\n\t\t\tdistance < candidateDistance ||\n\t\t\tisCursorWithinBlock\n\t\t) {\n\t\t\tcandidateDistance = distance;\n\n\t\t\tconst index = blocksData.indexOf( blockData );\n\t\t\tconst previousBlockData = blocksData[ index - 1 ];\n\n\t\t\t// If dragging near the top of a block and the preceding block\n\t\t\t// is at the same level, use the preceding block as the candidate\n\t\t\t// instead, as later it makes determining a nesting drop easier.\n\t\t\tif (\n\t\t\t\tedge === 'top' &&\n\t\t\t\tpreviousBlockData &&\n\t\t\t\tpreviousBlockData.rootClientId === blockData.rootClientId &&\n\t\t\t\t! previousBlockData.isDraggedBlock\n\t\t\t) {\n\t\t\t\tcandidateBlockData = previousBlockData;\n\t\t\t\tcandidateEdge = 'bottom';\n\t\t\t\tcandidateRect =\n\t\t\t\t\tpreviousBlockData.element.getBoundingClientRect();\n\t\t\t\tcandidateBlockIndex = index - 1;\n\t\t\t} else {\n\t\t\t\tcandidateBlockData = blockData;\n\t\t\t\tcandidateEdge = edge;\n\t\t\t\tcandidateRect = rect;\n\t\t\t\tcandidateBlockIndex = index;\n\t\t\t}\n\n\t\t\t// If the mouse position is within the block, break early\n\t\t\t// as the user would intend to drop either before or after\n\t\t\t// this block.\n\t\t\t//\n\t\t\t// This solves an issue where some rows in the list view\n\t\t\t// tree overlap slightly due to sub-pixel rendering.\n\t\t\tif ( isCursorWithinBlock ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( ! candidateBlockData ) {\n\t\treturn;\n\t}\n\n\tconst candidateBlockParents = getCandidateBlockParents(\n\t\tcandidateBlockData,\n\t\tblocksData\n\t);\n\n\tconst isDraggingBelow = candidateEdge === 'bottom';\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to nest the block as a child.\n\t// If the block already has inner blocks, and is expanded, this should be treated\n\t// as nesting since the next block in the tree will be the first child.\n\t// However, if the block is collapsed, dragging beneath the block should\n\t// still be allowed, as the next visible block in the tree will be a sibling.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.canInsertDraggedBlocksAsChild &&\n\t\t( ( candidateBlockData.innerBlockCount > 0 &&\n\t\t\tcandidateBlockData.isExpanded ) ||\n\t\t\tisNestingGesture(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t) )\n\t) {\n\t\t// If the block is expanded, insert the block as the first child.\n\t\t// Otherwise, for collapsed blocks, insert the block as the last child.\n\t\tconst newBlockIndex = candidateBlockData.isExpanded\n\t\t\t? 0\n\t\t\t: candidateBlockData.innerBlockCount || 0;\n\n\t\treturn {\n\t\t\trootClientId: candidateBlockData.clientId,\n\t\t\tblockIndex: newBlockIndex,\n\t\t\tdropPosition: 'inside',\n\t\t};\n\t}\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to move the block to be at a parent level.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.rootClientId &&\n\t\tisUpGesture(\n\t\t\tposition,\n\t\t\tcandidateRect,\n\t\t\tcandidateBlockParents.length,\n\t\t\trtl\n\t\t)\n\t) {\n\t\tconst nextBlock = getNextNonDraggedBlock(\n\t\t\tblocksData,\n\t\t\tcandidateBlockIndex\n\t\t);\n\t\tconst currentLevel = candidateBlockData.nestingLevel;\n\t\tconst nextLevel = nextBlock ? nextBlock.nestingLevel : 1;\n\n\t\tif ( currentLevel && nextLevel ) {\n\t\t\t// Determine the desired relative level of the block to be dropped.\n\t\t\tconst desiredRelativeLevel = getDesiredRelativeParentLevel(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t);\n\n\t\t\tconst targetParentIndex = Math.max(\n\t\t\t\tMath.min( desiredRelativeLevel, currentLevel - nextLevel ),\n\t\t\t\t0\n\t\t\t);\n\n\t\t\tif ( candidateBlockParents[ targetParentIndex ] ) {\n\t\t\t\t// Default to the block index of the candidate block.\n\t\t\t\tlet newBlockIndex = candidateBlockData.blockIndex;\n\n\t\t\t\t// If the next block is at the same level, use that as the default\n\t\t\t\t// block index. This ensures that the block is dropped in the correct\n\t\t\t\t// position when dragging to the bottom of a block.\n\t\t\t\tif (\n\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].nestingLevel ===\n\t\t\t\t\tnextBlock?.nestingLevel\n\t\t\t\t) {\n\t\t\t\t\tnewBlockIndex = nextBlock?.blockIndex;\n\t\t\t\t} else {\n\t\t\t\t\t// Otherwise, search from the current block index back\n\t\t\t\t\t// to find the last block index within the same target parent.\n\t\t\t\t\tfor ( let i = candidateBlockIndex; i >= 0; i-- ) {\n\t\t\t\t\t\tconst blockData = blocksData[ i ];\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tblockData.rootClientId ===\n\t\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ]\n\t\t\t\t\t\t\t\t.rootClientId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewBlockIndex = blockData.blockIndex + 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\trootClientId:\n\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].rootClientId,\n\t\t\t\t\tclientId: candidateBlockData.clientId,\n\t\t\t\t\tblockIndex: newBlockIndex,\n\t\t\t\t\tdropPosition: candidateEdge,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\n\t// If dropping as a sibling, but block cannot be inserted in\n\t// this context, return early.\n\tif ( ! candidateBlockData.canInsertDraggedBlocksAsSibling ) {\n\t\treturn;\n\t}\n\n\tconst offset = isDraggingBelow ? 1 : 0;\n\treturn {\n\t\trootClientId: candidateBlockData.rootClientId,\n\t\tclientId: candidateBlockData.clientId,\n\t\tblockIndex: candidateBlockData.blockIndex + offset,\n\t\tdropPosition: candidateEdge,\n\t};\n}\n\n/**\n * A react hook for implementing a drop zone in list view.\n *\n * @param {Object} props Named parameters.\n * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.\n *\n * @return {WPListViewDropZoneTarget} The drop target.\n */\nexport default function useListViewDropZone( { dropZoneElement } ) {\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockCount,\n\t\tgetDraggedBlockClientIds,\n\t\tcanInsertBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst [ target, setTarget ] = useState();\n\tconst { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } =\n\t\ttarget || {};\n\n\tconst onBlockDrop = useOnBlockDrop( targetRootClientId, targetBlockIndex );\n\n\tconst rtl = isRTL();\n\n\tconst draggedBlockClientIds = getDraggedBlockClientIds();\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, currentTarget ) => {\n\t\t\t\tconst position = { x: event.clientX, y: event.clientY };\n\t\t\t\tconst isBlockDrag = !! draggedBlockClientIds?.length;\n\n\t\t\t\tconst blockElements = Array.from(\n\t\t\t\t\tcurrentTarget.querySelectorAll( '[data-block]' )\n\t\t\t\t);\n\n\t\t\t\tconst blocksData = blockElements.map( ( blockElement ) => {\n\t\t\t\t\tconst clientId = blockElement.dataset.block;\n\t\t\t\t\tconst isExpanded = blockElement.dataset.expanded === 'true';\n\t\t\t\t\tconst isDraggedBlock =\n\t\t\t\t\t\tblockElement.classList.contains( 'is-dragging' );\n\n\t\t\t\t\t// Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.\n\t\t\t\t\tconst nestingLevel = parseInt(\n\t\t\t\t\t\tblockElement.getAttribute( 'aria-level' ),\n\t\t\t\t\t\t10\n\t\t\t\t\t);\n\t\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tisExpanded,\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\telement: blockElement,\n\t\t\t\t\t\tnestingLevel: nestingLevel || undefined,\n\t\t\t\t\t\tisDraggedBlock: isBlockDrag ? isDraggedBlock : false,\n\t\t\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t\t\t\tcanInsertDraggedBlocksAsSibling: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks(\n\t\t\t\t\t\t\t\t\tdraggedBlockClientIds,\n\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t\tcanInsertDraggedBlocksAsChild: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks( draggedBlockClientIds, clientId )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst newTarget = getListViewDropTarget(\n\t\t\t\t\tblocksData,\n\t\t\t\t\tposition,\n\t\t\t\t\trtl\n\t\t\t\t);\n\n\t\t\t\tif ( newTarget ) {\n\t\t\t\t\tsetTarget( newTarget );\n\t\t\t\t}\n\t\t\t},\n\t\t\t[\n\t\t\t\tcanInsertBlocks,\n\t\t\t\tdraggedBlockClientIds,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\trtl,\n\t\t\t]\n\t\t),\n\t\t200\n\t);\n\n\tconst ref = useDropZone( {\n\t\tdropZoneElement,\n\t\tonDrop: onBlockDrop,\n\t\tonDragLeave() {\n\t\t\tthrottled.cancel();\n\t\t\tsetTarget( null );\n\t\t},\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\tsetTarget( null );\n\t\t},\n\t} );\n\n\treturn { ref, target };\n}\n"]}
@@ -49,8 +49,10 @@ const InsertFromURLPopover = ({
49
49
  src,
50
50
  onChange,
51
51
  onSubmit,
52
- onClose
52
+ onClose,
53
+ popoverAnchor
53
54
  }) => (0, _element.createElement)(_urlPopover.default, {
55
+ anchor: popoverAnchor,
54
56
  onClose: onClose
55
57
  }, (0, _element.createElement)("form", {
56
58
  className: "block-editor-media-placeholder__url-input-form",
@@ -69,6 +71,34 @@ const InsertFromURLPopover = ({
69
71
  type: "submit"
70
72
  })));
71
73
 
74
+ const URLSelectionUI = ({
75
+ isURLInputVisible,
76
+ src,
77
+ onChangeSrc,
78
+ onSubmitSrc,
79
+ openURLInput,
80
+ closeURLInput
81
+ }) => {
82
+ // Use internal state instead of a ref to make sure that the component
83
+ // re-renders when the popover's anchor updates.
84
+ const [popoverAnchor, setPopoverAnchor] = (0, _element.useState)(null);
85
+ return (0, _element.createElement)("div", {
86
+ className: "block-editor-media-placeholder__url-input-container",
87
+ ref: setPopoverAnchor
88
+ }, (0, _element.createElement)(_components.Button, {
89
+ className: "block-editor-media-placeholder__button",
90
+ onClick: openURLInput,
91
+ isPressed: isURLInputVisible,
92
+ variant: "tertiary"
93
+ }, (0, _i18n.__)('Insert from URL')), isURLInputVisible && (0, _element.createElement)(InsertFromURLPopover, {
94
+ src: src,
95
+ onChange: onChangeSrc,
96
+ onSubmit: onSubmitSrc,
97
+ onClose: closeURLInput,
98
+ popoverAnchor: popoverAnchor
99
+ }));
100
+ };
101
+
72
102
  function MediaPlaceholder({
73
103
  value = {},
74
104
  allowedTypes,
@@ -342,19 +372,14 @@ function MediaPlaceholder({
342
372
  };
343
373
 
344
374
  const renderUrlSelectionUI = () => {
345
- return onSelectURL && (0, _element.createElement)("div", {
346
- className: "block-editor-media-placeholder__url-input-container"
347
- }, (0, _element.createElement)(_components.Button, {
348
- className: "block-editor-media-placeholder__button",
349
- onClick: openURLInput,
350
- isPressed: isURLInputVisible,
351
- variant: "tertiary"
352
- }, (0, _i18n.__)('Insert from URL')), isURLInputVisible && (0, _element.createElement)(InsertFromURLPopover, {
375
+ return onSelectURL && (0, _element.createElement)(URLSelectionUI, {
376
+ isURLInputVisible: isURLInputVisible,
353
377
  src: src,
354
- onChange: onChangeSrc,
355
- onSubmit: onSubmitSrc,
356
- onClose: closeURLInput
357
- }));
378
+ onChangeSrc: onChangeSrc,
379
+ onSubmitSrc: onSubmitSrc,
380
+ openURLInput: openURLInput,
381
+ closeURLInput: closeURLInput
382
+ });
358
383
  };
359
384
 
360
385
  const renderFeaturedImageToggle = () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/media-placeholder/index.js"],"names":["noop","InsertFromURLPopover","src","onChange","onSubmit","onClose","keyboardReturn","MediaPlaceholder","value","allowedTypes","className","icon","labels","mediaPreview","notices","isAppender","accept","addToGallery","multiple","handleUpload","disableDropZone","disableMediaButtons","onError","onSelect","onCancel","onSelectURL","onToggleFeaturedImage","onDoubleClick","onFilesPreUpload","onHTMLDrop","deprecatedOnHTMLDrop","children","mediaLibraryButton","placeholder","style","since","version","mediaUpload","select","getSettings","blockEditorStore","setSrc","isURLInputVisible","setIsURLInputVisible","onlyAllowsImages","length","every","allowedType","startsWith","onChangeSrc","event","target","openURLInput","closeURLInput","onSubmitSrc","preventDefault","onFilesUpload","files","setMedia","lastMediaPassed","newMedia","filteredMedia","filter","item","id","some","Number","urlSlug","url","includes","concat","map","media","cutOffIndex","lastIndexOf","slice","filesList","onFileChange","handleBlocksDrop","blocks","Array","isArray","recursivelyFindMediaFromBlocks","_blocks","flatMap","block","name","attributes","innerBlocks","mediaBlocks","uploadedMediaList","Promise","all","resolve","reject","window","fetch","then","response","blob","additionalData","title","alt_text","alt","caption","catch","err","HTML","onUpload","defaultRenderPlaceholder","content","instructions","undefined","typesAllowed","firstAllowedType","isOneType","isAudio","isImage","isVideo","placeholderClassName","renderPlaceholder","renderDropZone","renderCancelLink","renderUrlSelectionUI","renderFeaturedImageToggle","renderMediaUploadChecked","defaultButton","open","libraryButton","uploadMediaLibraryButton","openFileDialog"],"mappings":";;;;;;;;;;AAgBA;;AAbA;;AAKA;;AAOA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAGA;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,OAAO,EAAC,SADT;AAEC,QAAA,SAAS,EAAG,yBACX,wCADW,EAEX,+CAFW,CAFb;AAMC,QAAA,QAAQ,EAAGb,QANZ;AAOC,QAAA,MAAM,EAAG5F,MAPV;AAQC,QAAA,QAAQ,EAAGE;AARZ,SAUG,cAAI,QAAJ,CAVH,CAFD,EAcG+G,wBAdH,EAeGN,oBAAoB,EAfvB,EAgBGC,yBAAyB,EAhB5B,EAiBGF,gBAAgB,EAjBnB,CADD;AAqBA,aAAOF,iBAAiB,CAAEV,OAAF,CAAxB;AACA;;AAED,WAAOU,iBAAiB,CAAES,wBAAF,CAAxB;AACA,GA3FD;;AA6FA,MAAK5G,mBAAL,EAA2B;AAC1B,WAAO,4BAAC,cAAD,QAAoBoG,cAAc,EAAlC,CAAP;AACA;;AAED,SACC,4BAAC,cAAD;AACC,IAAA,QAAQ,EAAGD,iBAAiB,CAAEG,oBAAoB,EAAtB;AAD7B,KAGGE,wBAAwB,EAH3B,CADD;AAOA;AAED;AACA;AACA;;;eACe,6BAAa,yBAAb,EAA0CtH,gBAA1C,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tFormFileUpload,\n\tPlaceholder,\n\tDropZone,\n\twithFilters,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { keyboardReturn } from '@wordpress/icons';\nimport { pasteHandler } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport MediaUpload from '../media-upload';\nimport MediaUploadCheck from '../media-upload/check';\nimport URLPopover from '../url-popover';\nimport { store as blockEditorStore } from '../../store';\n\nconst noop = () => {};\n\nconst InsertFromURLPopover = ( { src, onChange, onSubmit, onClose } ) => (\n\t<URLPopover onClose={ onClose }>\n\t\t<form\n\t\t\tclassName=\"block-editor-media-placeholder__url-input-form\"\n\t\t\tonSubmit={ onSubmit }\n\t\t>\n\t\t\t<input\n\t\t\t\tclassName=\"block-editor-media-placeholder__url-input-field\"\n\t\t\t\ttype=\"text\"\n\t\t\t\taria-label={ __( 'URL' ) }\n\t\t\t\tplaceholder={ __( 'Paste or type URL' ) }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tvalue={ src }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tclassName=\"block-editor-media-placeholder__url-input-submit-button\"\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\ttype=\"submit\"\n\t\t\t/>\n\t\t</form>\n\t</URLPopover>\n);\n\nexport function MediaPlaceholder( {\n\tvalue = {},\n\tallowedTypes,\n\tclassName,\n\ticon,\n\tlabels = {},\n\tmediaPreview,\n\tnotices,\n\tisAppender,\n\taccept,\n\taddToGallery,\n\tmultiple = false,\n\thandleUpload = true,\n\tdisableDropZone,\n\tdisableMediaButtons,\n\tonError,\n\tonSelect,\n\tonCancel,\n\tonSelectURL,\n\tonToggleFeaturedImage,\n\tonDoubleClick,\n\tonFilesPreUpload = noop,\n\tonHTMLDrop: deprecatedOnHTMLDrop,\n\tchildren,\n\tmediaLibraryButton,\n\tplaceholder,\n\tstyle,\n} ) {\n\tif ( deprecatedOnHTMLDrop ) {\n\t\tdeprecated( 'wp.blockEditor.MediaPlaceholder onHTMLDrop prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t} );\n\t}\n\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().mediaUpload;\n\t}, [] );\n\tconst [ src, setSrc ] = useState( '' );\n\tconst [ isURLInputVisible, setIsURLInputVisible ] = useState( false );\n\n\tuseEffect( () => {\n\t\tsetSrc( value?.src ?? '' );\n\t}, [ value?.src ] );\n\n\tconst onlyAllowsImages = () => {\n\t\tif ( ! allowedTypes || allowedTypes.length === 0 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn allowedTypes.every(\n\t\t\t( allowedType ) =>\n\t\t\t\tallowedType === 'image' || allowedType.startsWith( 'image/' )\n\t\t);\n\t};\n\n\tconst onChangeSrc = ( event ) => {\n\t\tsetSrc( event.target.value );\n\t};\n\n\tconst openURLInput = () => {\n\t\tsetIsURLInputVisible( true );\n\t};\n\tconst closeURLInput = () => {\n\t\tsetIsURLInputVisible( false );\n\t};\n\n\tconst onSubmitSrc = ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( src && onSelectURL ) {\n\t\t\tonSelectURL( src );\n\t\t\tcloseURLInput();\n\t\t}\n\t};\n\n\tconst onFilesUpload = ( files ) => {\n\t\tif ( ! handleUpload ) {\n\t\t\treturn onSelect( files );\n\t\t}\n\t\tonFilesPreUpload( files );\n\t\tlet setMedia;\n\t\tif ( multiple ) {\n\t\t\tif ( addToGallery ) {\n\t\t\t\t// Since the setMedia function runs multiple times per upload group\n\t\t\t\t// and is passed newMedia containing every item in its group each time, we must\n\t\t\t\t// filter out whatever this upload group had previously returned to the\n\t\t\t\t// gallery before adding and returning the image array with replacement newMedia\n\t\t\t\t// values.\n\n\t\t\t\t// Define an array to store urls from newMedia between subsequent function calls.\n\t\t\t\tlet lastMediaPassed = [];\n\t\t\t\tsetMedia = ( newMedia ) => {\n\t\t\t\t\t// Remove any images this upload group is responsible for (lastMediaPassed).\n\t\t\t\t\t// Their replacements are contained in newMedia.\n\t\t\t\t\tconst filteredMedia = ( value ?? [] ).filter( ( item ) => {\n\t\t\t\t\t\t// If Item has id, only remove it if lastMediaPassed has an item with that id.\n\t\t\t\t\t\tif ( item.id ) {\n\t\t\t\t\t\t\treturn ! lastMediaPassed.some(\n\t\t\t\t\t\t\t\t// Be sure to convert to number for comparison.\n\t\t\t\t\t\t\t\t( { id } ) => Number( id ) === Number( item.id )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Compare transient images via .includes since gallery may append extra info onto the url.\n\t\t\t\t\t\treturn ! lastMediaPassed.some( ( { urlSlug } ) =>\n\t\t\t\t\t\t\titem.url.includes( urlSlug )\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t\t// Return the filtered media array along with newMedia.\n\t\t\t\t\tonSelect( filteredMedia.concat( newMedia ) );\n\t\t\t\t\t// Reset lastMediaPassed and set it with ids and urls from newMedia.\n\t\t\t\t\tlastMediaPassed = newMedia.map( ( media ) => {\n\t\t\t\t\t\t// Add everything up to '.fileType' to compare via .includes.\n\t\t\t\t\t\tconst cutOffIndex = media.url.lastIndexOf( '.' );\n\t\t\t\t\t\tconst urlSlug = media.url.slice( 0, cutOffIndex );\n\t\t\t\t\t\treturn { id: media.id, urlSlug };\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tsetMedia = onSelect;\n\t\t\t}\n\t\t} else {\n\t\t\tsetMedia = ( [ media ] ) => onSelect( media );\n\t\t}\n\t\tmediaUpload( {\n\t\t\tallowedTypes,\n\t\t\tfilesList: files,\n\t\t\tonFileChange: setMedia,\n\t\t\tonError,\n\t\t} );\n\t};\n\n\tasync function handleBlocksDrop( blocks ) {\n\t\tif ( ! blocks || ! Array.isArray( blocks ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfunction recursivelyFindMediaFromBlocks( _blocks ) {\n\t\t\treturn _blocks.flatMap( ( block ) =>\n\t\t\t\t( block.name === 'core/image' ||\n\t\t\t\t\tblock.name === 'core/audio' ||\n\t\t\t\t\tblock.name === 'core/video' ) &&\n\t\t\t\tblock.attributes.url\n\t\t\t\t\t? [ block ]\n\t\t\t\t\t: recursivelyFindMediaFromBlocks( block.innerBlocks )\n\t\t\t);\n\t\t}\n\n\t\tconst mediaBlocks = recursivelyFindMediaFromBlocks( blocks );\n\n\t\tif ( ! mediaBlocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst uploadedMediaList = await Promise.all(\n\t\t\tmediaBlocks.map( ( block ) =>\n\t\t\t\tblock.attributes.id\n\t\t\t\t\t? block.attributes\n\t\t\t\t\t: new Promise( ( resolve, reject ) => {\n\t\t\t\t\t\t\twindow\n\t\t\t\t\t\t\t\t.fetch( block.attributes.url )\n\t\t\t\t\t\t\t\t.then( ( response ) => response.blob() )\n\t\t\t\t\t\t\t\t.then( ( blob ) =>\n\t\t\t\t\t\t\t\t\tmediaUpload( {\n\t\t\t\t\t\t\t\t\t\tfilesList: [ blob ],\n\t\t\t\t\t\t\t\t\t\tadditionalData: {\n\t\t\t\t\t\t\t\t\t\t\ttitle: block.attributes.title,\n\t\t\t\t\t\t\t\t\t\t\talt_text: block.attributes.alt,\n\t\t\t\t\t\t\t\t\t\t\tcaption: block.attributes.caption,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonFileChange: ( [ media ] ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( media.id ) {\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( media );\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tallowedTypes,\n\t\t\t\t\t\t\t\t\t\tonError: reject,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.catch( () => resolve( block.attributes.url ) );\n\t\t\t\t\t } )\n\t\t\t)\n\t\t).catch( ( err ) => onError( err ) );\n\n\t\tif ( multiple ) {\n\t\t\tonSelect( uploadedMediaList );\n\t\t} else {\n\t\t\tonSelect( uploadedMediaList[ 0 ] );\n\t\t}\n\t}\n\n\tasync function onHTMLDrop( HTML ) {\n\t\tconst blocks = pasteHandler( { HTML } );\n\t\treturn await handleBlocksDrop( blocks );\n\t}\n\n\tconst onUpload = ( event ) => {\n\t\tonFilesUpload( event.target.files );\n\t};\n\n\tconst defaultRenderPlaceholder = ( content ) => {\n\t\tlet { instructions, title } = labels;\n\n\t\tif ( ! mediaUpload && ! onSelectURL ) {\n\t\t\tinstructions = __(\n\t\t\t\t'To edit this block, you need permission to upload media.'\n\t\t\t);\n\t\t}\n\n\t\tif ( instructions === undefined || title === undefined ) {\n\t\t\tconst typesAllowed = allowedTypes ?? [];\n\n\t\t\tconst [ firstAllowedType ] = typesAllowed;\n\t\t\tconst isOneType = 1 === typesAllowed.length;\n\t\t\tconst isAudio = isOneType && 'audio' === firstAllowedType;\n\t\t\tconst isImage = isOneType && 'image' === firstAllowedType;\n\t\t\tconst isVideo = isOneType && 'video' === firstAllowedType;\n\n\t\t\tif ( instructions === undefined && mediaUpload ) {\n\t\t\t\tinstructions = __(\n\t\t\t\t\t'Upload a media file or pick one from your media library.'\n\t\t\t\t);\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Upload an audio file, pick one from your media library, or add one with a URL.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Upload an image file, pick one from your media library, or add one with a URL.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Upload a video file, pick one from your media library, or add one with a URL.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( title === undefined ) {\n\t\t\t\ttitle = __( 'Media' );\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\ttitle = __( 'Audio' );\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\ttitle = __( 'Image' );\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\ttitle = __( 'Video' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst placeholderClassName = classnames(\n\t\t\t'block-editor-media-placeholder',\n\t\t\tclassName,\n\t\t\t{\n\t\t\t\t'is-appender': isAppender,\n\t\t\t}\n\t\t);\n\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ title }\n\t\t\t\tinstructions={ instructions }\n\t\t\t\tclassName={ placeholderClassName }\n\t\t\t\tnotices={ notices }\n\t\t\t\tonDoubleClick={ onDoubleClick }\n\t\t\t\tpreview={ mediaPreview }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t\t{ children }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\tconst renderPlaceholder = placeholder ?? defaultRenderPlaceholder;\n\n\tconst renderDropZone = () => {\n\t\tif ( disableDropZone ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<DropZone onFilesDrop={ onFilesUpload } onHTMLDrop={ onHTMLDrop } />\n\t\t);\n\t};\n\n\tconst renderCancelLink = () => {\n\t\treturn (\n\t\t\tonCancel && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"block-editor-media-placeholder__cancel-button\"\n\t\t\t\t\ttitle={ __( 'Cancel' ) }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderUrlSelectionUI = () => {\n\t\treturn (\n\t\t\tonSelectURL && (\n\t\t\t\t<div className=\"block-editor-media-placeholder__url-input-container\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\t\t\tonClick={ openURLInput }\n\t\t\t\t\t\tisPressed={ isURLInputVisible }\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Insert from URL' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t{ isURLInputVisible && (\n\t\t\t\t\t\t<InsertFromURLPopover\n\t\t\t\t\t\t\tsrc={ src }\n\t\t\t\t\t\t\tonChange={ onChangeSrc }\n\t\t\t\t\t\t\tonSubmit={ onSubmitSrc }\n\t\t\t\t\t\t\tonClose={ closeURLInput }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderFeaturedImageToggle = () => {\n\t\treturn (\n\t\t\tonToggleFeaturedImage && (\n\t\t\t\t<div className=\"block-editor-media-placeholder__url-input-container\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\t\t\tonClick={ onToggleFeaturedImage }\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Use featured image' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderMediaUploadChecked = () => {\n\t\tconst defaultButton = ( { open } ) => {\n\t\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\topen();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Media Library' ) }\n\t\t\t\t</Button>\n\t\t\t);\n\t\t};\n\t\tconst libraryButton = mediaLibraryButton ?? defaultButton;\n\t\tconst uploadMediaLibraryButton = (\n\t\t\t<MediaUpload\n\t\t\t\taddToGallery={ addToGallery }\n\t\t\t\tgallery={ multiple && onlyAllowsImages() }\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tmode={ 'browse' }\n\t\t\t\tvalue={\n\t\t\t\t\tArray.isArray( value )\n\t\t\t\t\t\t? value.map( ( { id } ) => id )\n\t\t\t\t\t\t: value.id\n\t\t\t\t}\n\t\t\t\trender={ libraryButton }\n\t\t\t/>\n\t\t);\n\n\t\tif ( mediaUpload && isAppender ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\t\trender={ ( { openFileDialog } ) => {\n\t\t\t\t\t\t\tconst content = (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tonClick={ openFileDialog }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn renderPlaceholder( content );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\tif ( mediaUpload ) {\n\t\t\tconst content = (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t</FormFileUpload>\n\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t</>\n\t\t\t);\n\t\t\treturn renderPlaceholder( content );\n\t\t}\n\n\t\treturn renderPlaceholder( uploadMediaLibraryButton );\n\t};\n\n\tif ( disableMediaButtons ) {\n\t\treturn <MediaUploadCheck>{ renderDropZone() }</MediaUploadCheck>;\n\t}\n\n\treturn (\n\t\t<MediaUploadCheck\n\t\t\tfallback={ renderPlaceholder( renderUrlSelectionUI() ) }\n\t\t>\n\t\t\t{ renderMediaUploadChecked() }\n\t\t</MediaUploadCheck>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-placeholder/README.md\n */\nexport default withFilters( 'editor.MediaPlaceholder' )( MediaPlaceholder );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/media-placeholder/index.js"],"names":["noop","InsertFromURLPopover","src","onChange","onSubmit","onClose","popoverAnchor","keyboardReturn","URLSelectionUI","isURLInputVisible","onChangeSrc","onSubmitSrc","openURLInput","closeURLInput","setPopoverAnchor","MediaPlaceholder","value","allowedTypes","className","icon","labels","mediaPreview","notices","isAppender","accept","addToGallery","multiple","handleUpload","disableDropZone","disableMediaButtons","onError","onSelect","onCancel","onSelectURL","onToggleFeaturedImage","onDoubleClick","onFilesPreUpload","onHTMLDrop","deprecatedOnHTMLDrop","children","mediaLibraryButton","placeholder","style","since","version","mediaUpload","select","getSettings","blockEditorStore","setSrc","setIsURLInputVisible","onlyAllowsImages","length","every","allowedType","startsWith","event","target","preventDefault","onFilesUpload","files","setMedia","lastMediaPassed","newMedia","filteredMedia","filter","item","id","some","Number","urlSlug","url","includes","concat","map","media","cutOffIndex","lastIndexOf","slice","filesList","onFileChange","handleBlocksDrop","blocks","Array","isArray","recursivelyFindMediaFromBlocks","_blocks","flatMap","block","name","attributes","innerBlocks","mediaBlocks","uploadedMediaList","Promise","all","resolve","reject","window","fetch","then","response","blob","additionalData","title","alt_text","alt","caption","catch","err","HTML","onUpload","defaultRenderPlaceholder","content","instructions","undefined","typesAllowed","firstAllowedType","isOneType","isAudio","isImage","isVideo","placeholderClassName","renderPlaceholder","renderDropZone","renderCancelLink","renderUrlSelectionUI","renderFeaturedImageToggle","renderMediaUploadChecked","defaultButton","open","libraryButton","uploadMediaLibraryButton","openFileDialog"],"mappings":";;;;;;;;;;AAgBA;;AAbA;;AAKA;;AAOA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;AAMA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,oBAAoB,GAAG,CAAE;AAC9BC,EAAAA,GAD8B;AAE9BC,EAAAA,QAF8B;AAG9BC,EAAAA,QAH8B;AAI9BC,EAAAA,OAJ8B;AAK9BC,EAAAA;AAL8B,CAAF,KAO5B,4BAAC,mBAAD;AAAY,EAAA,MAAM,EAAGA,aAArB;AAAqC,EAAA,OAAO,EAAGD;AAA/C,GACC;AACC,EAAA,SAAS,EAAC,gDADX;AAEC,EAAA,QAAQ,EAAGD;AAFZ,GAIC;AACC,EAAA,SAAS,EAAC,iDADX;AAEC,EAAA,IAAI,EAAC,MAFN;AAGC,gBAAa,cAAI,KAAJ,CAHd;AAIC,EAAA,WAAW,EAAG,cAAI,mBAAJ,CAJf;AAKC,EAAA,QAAQ,EAAGD,QALZ;AAMC,EAAA,KAAK,EAAGD;AANT,EAJD,EAYC,4BAAC,kBAAD;AACC,EAAA,SAAS,EAAC,yDADX;AAEC,EAAA,IAAI,EAAGK,qBAFR;AAGC,EAAA,KAAK,EAAG,cAAI,OAAJ,CAHT;AAIC,EAAA,IAAI,EAAC;AAJN,EAZD,CADD,CAPD;;AA8BA,MAAMC,cAAc,GAAG,CAAE;AACxBC,EAAAA,iBADwB;AAExBP,EAAAA,GAFwB;AAGxBQ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GN,oBAAoB,EAfvB,EAgBGC,yBAAyB,EAhB5B,EAiBGF,gBAAgB,EAjBnB,CADD;AAqBA,aAAOF,iBAAiB,CAAEV,OAAF,CAAxB;AACA;;AAED,WAAOU,iBAAiB,CAAES,wBAAF,CAAxB;AACA,GA3FD;;AA6FA,MAAKvG,mBAAL,EAA2B;AAC1B,WAAO,4BAAC,cAAD,QAAoB+F,cAAc,EAAlC,CAAP;AACA;;AAED,SACC,4BAAC,cAAD;AACC,IAAA,QAAQ,EAAGD,iBAAiB,CAAEG,oBAAoB,EAAtB;AAD7B,KAGGE,wBAAwB,EAH3B,CADD;AAOA;AAED;AACA;AACA;;;eACe,6BAAa,yBAAb,EAA0CjH,gBAA1C,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tFormFileUpload,\n\tPlaceholder,\n\tDropZone,\n\twithFilters,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { keyboardReturn } from '@wordpress/icons';\nimport { pasteHandler } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport MediaUpload from '../media-upload';\nimport MediaUploadCheck from '../media-upload/check';\nimport URLPopover from '../url-popover';\nimport { store as blockEditorStore } from '../../store';\n\nconst noop = () => {};\n\nconst InsertFromURLPopover = ( {\n\tsrc,\n\tonChange,\n\tonSubmit,\n\tonClose,\n\tpopoverAnchor,\n} ) => (\n\t<URLPopover anchor={ popoverAnchor } onClose={ onClose }>\n\t\t<form\n\t\t\tclassName=\"block-editor-media-placeholder__url-input-form\"\n\t\t\tonSubmit={ onSubmit }\n\t\t>\n\t\t\t<input\n\t\t\t\tclassName=\"block-editor-media-placeholder__url-input-field\"\n\t\t\t\ttype=\"text\"\n\t\t\t\taria-label={ __( 'URL' ) }\n\t\t\t\tplaceholder={ __( 'Paste or type URL' ) }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tvalue={ src }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tclassName=\"block-editor-media-placeholder__url-input-submit-button\"\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\ttype=\"submit\"\n\t\t\t/>\n\t\t</form>\n\t</URLPopover>\n);\n\nconst URLSelectionUI = ( {\n\tisURLInputVisible,\n\tsrc,\n\tonChangeSrc,\n\tonSubmitSrc,\n\topenURLInput,\n\tcloseURLInput,\n} ) => {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"block-editor-media-placeholder__url-input-container\"\n\t\t\tref={ setPopoverAnchor }\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\tonClick={ openURLInput }\n\t\t\t\tisPressed={ isURLInputVisible }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ __( 'Insert from URL' ) }\n\t\t\t</Button>\n\t\t\t{ isURLInputVisible && (\n\t\t\t\t<InsertFromURLPopover\n\t\t\t\t\tsrc={ src }\n\t\t\t\t\tonChange={ onChangeSrc }\n\t\t\t\t\tonSubmit={ onSubmitSrc }\n\t\t\t\t\tonClose={ closeURLInput }\n\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nexport function MediaPlaceholder( {\n\tvalue = {},\n\tallowedTypes,\n\tclassName,\n\ticon,\n\tlabels = {},\n\tmediaPreview,\n\tnotices,\n\tisAppender,\n\taccept,\n\taddToGallery,\n\tmultiple = false,\n\thandleUpload = true,\n\tdisableDropZone,\n\tdisableMediaButtons,\n\tonError,\n\tonSelect,\n\tonCancel,\n\tonSelectURL,\n\tonToggleFeaturedImage,\n\tonDoubleClick,\n\tonFilesPreUpload = noop,\n\tonHTMLDrop: deprecatedOnHTMLDrop,\n\tchildren,\n\tmediaLibraryButton,\n\tplaceholder,\n\tstyle,\n} ) {\n\tif ( deprecatedOnHTMLDrop ) {\n\t\tdeprecated( 'wp.blockEditor.MediaPlaceholder onHTMLDrop prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t} );\n\t}\n\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().mediaUpload;\n\t}, [] );\n\tconst [ src, setSrc ] = useState( '' );\n\tconst [ isURLInputVisible, setIsURLInputVisible ] = useState( false );\n\n\tuseEffect( () => {\n\t\tsetSrc( value?.src ?? '' );\n\t}, [ value?.src ] );\n\n\tconst onlyAllowsImages = () => {\n\t\tif ( ! allowedTypes || allowedTypes.length === 0 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn allowedTypes.every(\n\t\t\t( allowedType ) =>\n\t\t\t\tallowedType === 'image' || allowedType.startsWith( 'image/' )\n\t\t);\n\t};\n\n\tconst onChangeSrc = ( event ) => {\n\t\tsetSrc( event.target.value );\n\t};\n\n\tconst openURLInput = () => {\n\t\tsetIsURLInputVisible( true );\n\t};\n\tconst closeURLInput = () => {\n\t\tsetIsURLInputVisible( false );\n\t};\n\n\tconst onSubmitSrc = ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( src && onSelectURL ) {\n\t\t\tonSelectURL( src );\n\t\t\tcloseURLInput();\n\t\t}\n\t};\n\n\tconst onFilesUpload = ( files ) => {\n\t\tif ( ! handleUpload ) {\n\t\t\treturn onSelect( files );\n\t\t}\n\t\tonFilesPreUpload( files );\n\t\tlet setMedia;\n\t\tif ( multiple ) {\n\t\t\tif ( addToGallery ) {\n\t\t\t\t// Since the setMedia function runs multiple times per upload group\n\t\t\t\t// and is passed newMedia containing every item in its group each time, we must\n\t\t\t\t// filter out whatever this upload group had previously returned to the\n\t\t\t\t// gallery before adding and returning the image array with replacement newMedia\n\t\t\t\t// values.\n\n\t\t\t\t// Define an array to store urls from newMedia between subsequent function calls.\n\t\t\t\tlet lastMediaPassed = [];\n\t\t\t\tsetMedia = ( newMedia ) => {\n\t\t\t\t\t// Remove any images this upload group is responsible for (lastMediaPassed).\n\t\t\t\t\t// Their replacements are contained in newMedia.\n\t\t\t\t\tconst filteredMedia = ( value ?? [] ).filter( ( item ) => {\n\t\t\t\t\t\t// If Item has id, only remove it if lastMediaPassed has an item with that id.\n\t\t\t\t\t\tif ( item.id ) {\n\t\t\t\t\t\t\treturn ! lastMediaPassed.some(\n\t\t\t\t\t\t\t\t// Be sure to convert to number for comparison.\n\t\t\t\t\t\t\t\t( { id } ) => Number( id ) === Number( item.id )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Compare transient images via .includes since gallery may append extra info onto the url.\n\t\t\t\t\t\treturn ! lastMediaPassed.some( ( { urlSlug } ) =>\n\t\t\t\t\t\t\titem.url.includes( urlSlug )\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t\t// Return the filtered media array along with newMedia.\n\t\t\t\t\tonSelect( filteredMedia.concat( newMedia ) );\n\t\t\t\t\t// Reset lastMediaPassed and set it with ids and urls from newMedia.\n\t\t\t\t\tlastMediaPassed = newMedia.map( ( media ) => {\n\t\t\t\t\t\t// Add everything up to '.fileType' to compare via .includes.\n\t\t\t\t\t\tconst cutOffIndex = media.url.lastIndexOf( '.' );\n\t\t\t\t\t\tconst urlSlug = media.url.slice( 0, cutOffIndex );\n\t\t\t\t\t\treturn { id: media.id, urlSlug };\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tsetMedia = onSelect;\n\t\t\t}\n\t\t} else {\n\t\t\tsetMedia = ( [ media ] ) => onSelect( media );\n\t\t}\n\t\tmediaUpload( {\n\t\t\tallowedTypes,\n\t\t\tfilesList: files,\n\t\t\tonFileChange: setMedia,\n\t\t\tonError,\n\t\t} );\n\t};\n\n\tasync function handleBlocksDrop( blocks ) {\n\t\tif ( ! blocks || ! Array.isArray( blocks ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfunction recursivelyFindMediaFromBlocks( _blocks ) {\n\t\t\treturn _blocks.flatMap( ( block ) =>\n\t\t\t\t( block.name === 'core/image' ||\n\t\t\t\t\tblock.name === 'core/audio' ||\n\t\t\t\t\tblock.name === 'core/video' ) &&\n\t\t\t\tblock.attributes.url\n\t\t\t\t\t? [ block ]\n\t\t\t\t\t: recursivelyFindMediaFromBlocks( block.innerBlocks )\n\t\t\t);\n\t\t}\n\n\t\tconst mediaBlocks = recursivelyFindMediaFromBlocks( blocks );\n\n\t\tif ( ! mediaBlocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst uploadedMediaList = await Promise.all(\n\t\t\tmediaBlocks.map( ( block ) =>\n\t\t\t\tblock.attributes.id\n\t\t\t\t\t? block.attributes\n\t\t\t\t\t: new Promise( ( resolve, reject ) => {\n\t\t\t\t\t\t\twindow\n\t\t\t\t\t\t\t\t.fetch( block.attributes.url )\n\t\t\t\t\t\t\t\t.then( ( response ) => response.blob() )\n\t\t\t\t\t\t\t\t.then( ( blob ) =>\n\t\t\t\t\t\t\t\t\tmediaUpload( {\n\t\t\t\t\t\t\t\t\t\tfilesList: [ blob ],\n\t\t\t\t\t\t\t\t\t\tadditionalData: {\n\t\t\t\t\t\t\t\t\t\t\ttitle: block.attributes.title,\n\t\t\t\t\t\t\t\t\t\t\talt_text: block.attributes.alt,\n\t\t\t\t\t\t\t\t\t\t\tcaption: block.attributes.caption,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonFileChange: ( [ media ] ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( media.id ) {\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( media );\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tallowedTypes,\n\t\t\t\t\t\t\t\t\t\tonError: reject,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.catch( () => resolve( block.attributes.url ) );\n\t\t\t\t\t } )\n\t\t\t)\n\t\t).catch( ( err ) => onError( err ) );\n\n\t\tif ( multiple ) {\n\t\t\tonSelect( uploadedMediaList );\n\t\t} else {\n\t\t\tonSelect( uploadedMediaList[ 0 ] );\n\t\t}\n\t}\n\n\tasync function onHTMLDrop( HTML ) {\n\t\tconst blocks = pasteHandler( { HTML } );\n\t\treturn await handleBlocksDrop( blocks );\n\t}\n\n\tconst onUpload = ( event ) => {\n\t\tonFilesUpload( event.target.files );\n\t};\n\n\tconst defaultRenderPlaceholder = ( content ) => {\n\t\tlet { instructions, title } = labels;\n\n\t\tif ( ! mediaUpload && ! onSelectURL ) {\n\t\t\tinstructions = __(\n\t\t\t\t'To edit this block, you need permission to upload media.'\n\t\t\t);\n\t\t}\n\n\t\tif ( instructions === undefined || title === undefined ) {\n\t\t\tconst typesAllowed = allowedTypes ?? [];\n\n\t\t\tconst [ firstAllowedType ] = typesAllowed;\n\t\t\tconst isOneType = 1 === typesAllowed.length;\n\t\t\tconst isAudio = isOneType && 'audio' === firstAllowedType;\n\t\t\tconst isImage = isOneType && 'image' === firstAllowedType;\n\t\t\tconst isVideo = isOneType && 'video' === firstAllowedType;\n\n\t\t\tif ( instructions === undefined && mediaUpload ) {\n\t\t\t\tinstructions = __(\n\t\t\t\t\t'Upload a media file or pick one from your media library.'\n\t\t\t\t);\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Upload an audio file, pick one from your media library, or add one with a URL.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Upload an image file, pick one from your media library, or add one with a URL.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Upload a video file, pick one from your media library, or add one with a URL.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( title === undefined ) {\n\t\t\t\ttitle = __( 'Media' );\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\ttitle = __( 'Audio' );\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\ttitle = __( 'Image' );\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\ttitle = __( 'Video' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst placeholderClassName = classnames(\n\t\t\t'block-editor-media-placeholder',\n\t\t\tclassName,\n\t\t\t{\n\t\t\t\t'is-appender': isAppender,\n\t\t\t}\n\t\t);\n\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ title }\n\t\t\t\tinstructions={ instructions }\n\t\t\t\tclassName={ placeholderClassName }\n\t\t\t\tnotices={ notices }\n\t\t\t\tonDoubleClick={ onDoubleClick }\n\t\t\t\tpreview={ mediaPreview }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t\t{ children }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\tconst renderPlaceholder = placeholder ?? defaultRenderPlaceholder;\n\n\tconst renderDropZone = () => {\n\t\tif ( disableDropZone ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<DropZone onFilesDrop={ onFilesUpload } onHTMLDrop={ onHTMLDrop } />\n\t\t);\n\t};\n\n\tconst renderCancelLink = () => {\n\t\treturn (\n\t\t\tonCancel && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"block-editor-media-placeholder__cancel-button\"\n\t\t\t\t\ttitle={ __( 'Cancel' ) }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderUrlSelectionUI = () => {\n\t\treturn (\n\t\t\tonSelectURL && (\n\t\t\t\t<URLSelectionUI\n\t\t\t\t\tisURLInputVisible={ isURLInputVisible }\n\t\t\t\t\tsrc={ src }\n\t\t\t\t\tonChangeSrc={ onChangeSrc }\n\t\t\t\t\tonSubmitSrc={ onSubmitSrc }\n\t\t\t\t\topenURLInput={ openURLInput }\n\t\t\t\t\tcloseURLInput={ closeURLInput }\n\t\t\t\t/>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderFeaturedImageToggle = () => {\n\t\treturn (\n\t\t\tonToggleFeaturedImage && (\n\t\t\t\t<div className=\"block-editor-media-placeholder__url-input-container\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\t\t\tonClick={ onToggleFeaturedImage }\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Use featured image' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderMediaUploadChecked = () => {\n\t\tconst defaultButton = ( { open } ) => {\n\t\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\topen();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Media Library' ) }\n\t\t\t\t</Button>\n\t\t\t);\n\t\t};\n\t\tconst libraryButton = mediaLibraryButton ?? defaultButton;\n\t\tconst uploadMediaLibraryButton = (\n\t\t\t<MediaUpload\n\t\t\t\taddToGallery={ addToGallery }\n\t\t\t\tgallery={ multiple && onlyAllowsImages() }\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tmode={ 'browse' }\n\t\t\t\tvalue={\n\t\t\t\t\tArray.isArray( value )\n\t\t\t\t\t\t? value.map( ( { id } ) => id )\n\t\t\t\t\t\t: value.id\n\t\t\t\t}\n\t\t\t\trender={ libraryButton }\n\t\t\t/>\n\t\t);\n\n\t\tif ( mediaUpload && isAppender ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\t\trender={ ( { openFileDialog } ) => {\n\t\t\t\t\t\t\tconst content = (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tonClick={ openFileDialog }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn renderPlaceholder( content );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\tif ( mediaUpload ) {\n\t\t\tconst content = (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t</FormFileUpload>\n\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t</>\n\t\t\t);\n\t\t\treturn renderPlaceholder( content );\n\t\t}\n\n\t\treturn renderPlaceholder( uploadMediaLibraryButton );\n\t};\n\n\tif ( disableMediaButtons ) {\n\t\treturn <MediaUploadCheck>{ renderDropZone() }</MediaUploadCheck>;\n\t}\n\n\treturn (\n\t\t<MediaUploadCheck\n\t\t\tfallback={ renderPlaceholder( renderUrlSelectionUI() ) }\n\t\t>\n\t\t\t{ renderMediaUploadChecked() }\n\t\t</MediaUploadCheck>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-placeholder/README.md\n */\nexport default withFilters( 'editor.MediaPlaceholder' )( MediaPlaceholder );\n"]}
@@ -71,9 +71,7 @@ const MediaReplaceFlow = ({
71
71
  multiple = false,
72
72
  addToGallery,
73
73
  handleUpload = true,
74
- popoverProps = {
75
- variant: 'toolbar'
76
- }
74
+ popoverProps
77
75
  }) => {
78
76
  const mediaUpload = (0, _data.useSelect)(select => {
79
77
  return select(_store.store).getSettings().mediaUpload;