@wordpress/block-editor 11.2.0 → 11.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (660) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +28 -4
  3. package/build/components/alignment-control/ui.js +1 -1
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/autocomplete/index.js +2 -7
  6. package/build/components/autocomplete/index.js.map +1 -1
  7. package/build/components/block-alignment-matrix-control/index.js +2 -2
  8. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  9. package/build/components/block-card/index.js +2 -4
  10. package/build/components/block-card/index.js.map +1 -1
  11. package/build/components/block-edit/index.js +8 -0
  12. package/build/components/block-edit/index.js.map +1 -1
  13. package/build/components/block-inspector/index.js +15 -14
  14. package/build/components/block-inspector/index.js.map +1 -1
  15. package/build/components/block-list/use-in-between-inserter.js +5 -0
  16. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  17. package/build/components/block-lock/modal.js +0 -1
  18. package/build/components/block-lock/modal.js.map +1 -1
  19. package/build/components/block-mover/mover-description.js +2 -2
  20. package/build/components/block-mover/mover-description.js.map +1 -1
  21. package/build/components/block-navigation/dropdown.js +3 -1
  22. package/build/components/block-navigation/dropdown.js.map +1 -1
  23. package/build/components/block-pattern-setup/index.js +1 -1
  24. package/build/components/block-pattern-setup/index.js.map +1 -1
  25. package/build/components/block-pattern-setup/use-patterns-setup.js +2 -2
  26. package/build/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
  27. package/build/components/block-patterns-list/index.js +31 -3
  28. package/build/components/block-patterns-list/index.js.map +1 -1
  29. package/build/components/block-preview/auto.js +9 -11
  30. package/build/components/block-preview/auto.js.map +1 -1
  31. package/build/components/block-preview/index.js +32 -8
  32. package/build/components/block-preview/index.js.map +1 -1
  33. package/build/components/block-selection-clearer/index.js +1 -1
  34. package/build/components/block-selection-clearer/index.js.map +1 -1
  35. package/build/components/block-settings/container.native.js +7 -33
  36. package/build/components/block-settings/container.native.js.map +1 -1
  37. package/build/components/block-settings-menu/block-settings-dropdown.js +12 -6
  38. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  39. package/build/components/block-settings-menu-controls/index.js +2 -8
  40. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  41. package/build/components/block-switcher/utils.js +1 -1
  42. package/build/components/block-switcher/utils.js.map +1 -1
  43. package/build/components/block-tools/selected-block-popover.js +55 -47
  44. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  45. package/build/components/block-vertical-alignment-control/icons.js +15 -1
  46. package/build/components/block-vertical-alignment-control/icons.js.map +1 -1
  47. package/build/components/block-vertical-alignment-control/ui.js +9 -4
  48. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  49. package/build/components/color-style-selector/index.js +3 -1
  50. package/build/components/color-style-selector/index.js.map +1 -1
  51. package/build/components/date-format-picker/index.js +3 -4
  52. package/build/components/date-format-picker/index.js.map +1 -1
  53. package/build/components/font-family/index.js +1 -7
  54. package/build/components/font-family/index.js.map +1 -1
  55. package/build/components/font-sizes/fluid-utils.js +1 -1
  56. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  57. package/build/components/font-sizes/utils.js +1 -1
  58. package/build/components/font-sizes/utils.js.map +1 -1
  59. package/build/components/global-styles/context.js +22 -0
  60. package/build/components/global-styles/context.js.map +1 -0
  61. package/build/components/global-styles/hooks.js +142 -0
  62. package/build/components/global-styles/hooks.js.map +1 -0
  63. package/build/components/global-styles/index.js +42 -0
  64. package/build/components/global-styles/index.js.map +1 -0
  65. package/build/components/global-styles/typography-utils.js +92 -0
  66. package/build/components/global-styles/typography-utils.js.map +1 -0
  67. package/build/components/global-styles/use-global-styles-output.js +974 -0
  68. package/build/components/global-styles/use-global-styles-output.js.map +1 -0
  69. package/build/components/global-styles/utils.js +340 -0
  70. package/build/components/global-styles/utils.js.map +1 -0
  71. package/build/components/height-control/index.js +13 -1
  72. package/build/components/height-control/index.js.map +1 -1
  73. package/build/components/image-editor/constants.js +1 -1
  74. package/build/components/image-editor/constants.js.map +1 -1
  75. package/build/components/image-editor/context.js +1 -2
  76. package/build/components/image-editor/context.js.map +1 -1
  77. package/build/components/image-editor/cropper.js +3 -1
  78. package/build/components/image-editor/cropper.js.map +1 -1
  79. package/build/components/image-editor/index.js +13 -9
  80. package/build/components/image-editor/index.js.map +1 -1
  81. package/build/components/image-editor/use-transform-image.js +11 -35
  82. package/build/components/image-editor/use-transform-image.js.map +1 -1
  83. package/build/components/image-size-control/index.js +1 -7
  84. package/build/components/image-size-control/index.js.map +1 -1
  85. package/build/components/index.js +8 -24
  86. package/build/components/index.js.map +1 -1
  87. package/build/components/inner-blocks/index.js +22 -32
  88. package/build/components/inner-blocks/index.js.map +1 -1
  89. package/build/components/inner-blocks/index.native.js +8 -23
  90. package/build/components/inner-blocks/index.native.js.map +1 -1
  91. package/build/components/inner-blocks/use-block-context.js +53 -0
  92. package/build/components/inner-blocks/use-block-context.js.map +1 -0
  93. package/build/components/inserter/block-patterns-explorer/explorer.js +0 -1
  94. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  95. package/build/components/inserter/block-patterns-tab.js +7 -1
  96. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  97. package/build/components/inserter/block-types-tab.js +2 -2
  98. package/build/components/inserter/block-types-tab.js.map +1 -1
  99. package/build/components/inserter/hooks/use-patterns-state.js +1 -7
  100. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  101. package/build/components/inserter/index.js +5 -4
  102. package/build/components/inserter/index.js.map +1 -1
  103. package/build/components/inserter/media-tab/hooks.js +142 -56
  104. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  105. package/build/components/inserter/media-tab/media-list.js +74 -21
  106. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  107. package/build/components/inserter/media-tab/media-panel.js +11 -13
  108. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  109. package/build/components/inserter/media-tab/media-tab.js +6 -3
  110. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  111. package/build/components/inserter/media-tab/utils.js +26 -15
  112. package/build/components/inserter/media-tab/utils.js.map +1 -1
  113. package/build/components/inserter/menu.js +1 -0
  114. package/build/components/inserter/menu.js.map +1 -1
  115. package/build/components/inserter/preview-panel.js +5 -3
  116. package/build/components/inserter/preview-panel.js.map +1 -1
  117. package/build/components/inserter/search-results.js +2 -7
  118. package/build/components/inserter/search-results.js.map +1 -1
  119. package/build/components/inserter-list-item/index.js +1 -9
  120. package/build/components/inserter-list-item/index.js.map +1 -1
  121. package/build/components/inspector-controls/fill.js +15 -2
  122. package/build/components/inspector-controls/fill.js.map +1 -1
  123. package/build/components/inspector-controls/fill.native.js +14 -1
  124. package/build/components/inspector-controls/fill.native.js.map +1 -1
  125. package/build/components/inspector-controls/groups.js +4 -0
  126. package/build/components/inspector-controls/groups.js.map +1 -1
  127. package/build/components/inspector-controls/index.js +2 -2
  128. package/build/components/inspector-controls/index.js.map +1 -1
  129. package/build/components/inspector-controls/slot.js +14 -1
  130. package/build/components/inspector-controls/slot.js.map +1 -1
  131. package/build/components/inspector-controls/slot.native.js +14 -1
  132. package/build/components/inspector-controls/slot.native.js.map +1 -1
  133. package/build/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
  134. package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
  135. package/build/components/inspector-controls-tabs/index.js +2 -2
  136. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  137. package/build/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  138. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  139. package/build/components/inspector-controls-tabs/styles-tab.js +6 -4
  140. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  141. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +17 -12
  142. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  143. package/build/components/justify-content-control/ui.js +8 -1
  144. package/build/components/justify-content-control/ui.js.map +1 -1
  145. package/build/components/link-control/index.js +45 -17
  146. package/build/components/link-control/index.js.map +1 -1
  147. package/build/components/list-view/block.js +1 -1
  148. package/build/components/list-view/block.js.map +1 -1
  149. package/build/components/list-view/use-list-view-drop-zone.js +1 -1
  150. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  151. package/build/components/media-upload/index.native.js +4 -1
  152. package/build/components/media-upload/index.native.js.map +1 -1
  153. package/build/components/off-canvas-editor/appender.js +50 -3
  154. package/build/components/off-canvas-editor/appender.js.map +1 -1
  155. package/build/components/off-canvas-editor/block-select-button.js +10 -4
  156. package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
  157. package/build/components/off-canvas-editor/block.js +6 -27
  158. package/build/components/off-canvas-editor/block.js.map +1 -1
  159. package/build/components/off-canvas-editor/branch.js +25 -10
  160. package/build/components/off-canvas-editor/branch.js.map +1 -1
  161. package/build/components/off-canvas-editor/index.js +11 -16
  162. package/build/components/off-canvas-editor/index.js.map +1 -1
  163. package/build/components/off-canvas-editor/link-ui.js +2 -2
  164. package/build/components/off-canvas-editor/link-ui.js.map +1 -1
  165. package/build/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
  166. package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -1
  167. package/build/components/provider/index.js +21 -9
  168. package/build/components/provider/index.js.map +1 -1
  169. package/build/components/provider/index.native.js +5 -6
  170. package/build/components/provider/index.native.js.map +1 -1
  171. package/build/components/rich-text/use-before-input-rules.js +11 -3
  172. package/build/components/rich-text/use-before-input-rules.js.map +1 -1
  173. package/build/components/rich-text/utils.js +1 -1
  174. package/build/components/rich-text/utils.js.map +1 -1
  175. package/build/components/spacing-sizes-control/utils.js +2 -8
  176. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  177. package/build/components/tool-selector/index.js +3 -1
  178. package/build/components/tool-selector/index.js.map +1 -1
  179. package/build/components/url-popover/image-url-input-ui.js +7 -8
  180. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  181. package/build/components/use-block-display-information/index.js +1 -1
  182. package/build/components/use-block-display-information/index.js.map +1 -1
  183. package/build/experiments.js +45 -0
  184. package/build/experiments.js.map +1 -0
  185. package/build/experiments.native.js +40 -0
  186. package/build/experiments.native.js.map +1 -0
  187. package/build/hooks/anchor.js +2 -1
  188. package/build/hooks/anchor.js.map +1 -1
  189. package/build/hooks/border.js +1 -1
  190. package/build/hooks/border.js.map +1 -1
  191. package/build/hooks/child-layout.js +5 -1
  192. package/build/hooks/child-layout.js.map +1 -1
  193. package/build/hooks/color-panel.js +1 -1
  194. package/build/hooks/color-panel.js.map +1 -1
  195. package/build/hooks/color.js +3 -3
  196. package/build/hooks/color.js.map +1 -1
  197. package/build/hooks/custom-class-name.js +2 -1
  198. package/build/hooks/custom-class-name.js.map +1 -1
  199. package/build/hooks/dimensions.js +7 -5
  200. package/build/hooks/dimensions.js.map +1 -1
  201. package/build/hooks/margin.js +1 -0
  202. package/build/hooks/margin.js.map +1 -1
  203. package/build/hooks/padding.js +1 -0
  204. package/build/hooks/padding.js.map +1 -1
  205. package/build/hooks/position.js +34 -15
  206. package/build/hooks/position.js.map +1 -1
  207. package/build/hooks/typography.js +1 -1
  208. package/build/hooks/typography.js.map +1 -1
  209. package/build/hooks/use-color-props.js +3 -3
  210. package/build/hooks/use-color-props.js.map +1 -1
  211. package/build/hooks/utils.js +69 -3
  212. package/build/hooks/utils.js.map +1 -1
  213. package/build/index.js +10 -1
  214. package/build/index.js.map +1 -1
  215. package/build/layouts/constrained.js +3 -0
  216. package/build/layouts/constrained.js.map +1 -1
  217. package/build/layouts/flex.js +59 -9
  218. package/build/layouts/flex.js.map +1 -1
  219. package/build/layouts/flow.js +0 -18
  220. package/build/layouts/flow.js.map +1 -1
  221. package/build/store/actions.js +3 -30
  222. package/build/store/actions.js.map +1 -1
  223. package/build/store/defaults.js +5 -2
  224. package/build/store/defaults.js.map +1 -1
  225. package/build/store/index.js +11 -2
  226. package/build/store/index.js.map +1 -1
  227. package/build/store/private-actions.js +78 -0
  228. package/build/store/private-actions.js.map +1 -0
  229. package/build/store/private-selectors.js +18 -0
  230. package/build/store/private-selectors.js.map +1 -0
  231. package/build/store/reducer.js +1 -1
  232. package/build/store/reducer.js.map +1 -1
  233. package/build/store/selectors.js +60 -34
  234. package/build/store/selectors.js.map +1 -1
  235. package/build/utils/block-variation-transforms.js +1 -1
  236. package/build/utils/block-variation-transforms.js.map +1 -1
  237. package/build/utils/parse-css-unit-to-px.js +1 -1
  238. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  239. package/build/utils/transform-styles/index.js +1 -7
  240. package/build/utils/transform-styles/index.js.map +1 -1
  241. package/build-module/components/alignment-control/ui.js +1 -1
  242. package/build-module/components/alignment-control/ui.js.map +1 -1
  243. package/build-module/components/autocomplete/index.js +2 -6
  244. package/build-module/components/autocomplete/index.js.map +1 -1
  245. package/build-module/components/block-alignment-matrix-control/index.js +2 -2
  246. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  247. package/build-module/components/block-card/index.js +2 -4
  248. package/build-module/components/block-card/index.js.map +1 -1
  249. package/build-module/components/block-edit/index.js +7 -0
  250. package/build-module/components/block-edit/index.js.map +1 -1
  251. package/build-module/components/block-inspector/index.js +15 -14
  252. package/build-module/components/block-inspector/index.js.map +1 -1
  253. package/build-module/components/block-list/use-in-between-inserter.js +5 -0
  254. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  255. package/build-module/components/block-lock/modal.js +0 -1
  256. package/build-module/components/block-lock/modal.js.map +1 -1
  257. package/build-module/components/block-mover/mover-description.js +2 -2
  258. package/build-module/components/block-mover/mover-description.js.map +1 -1
  259. package/build-module/components/block-navigation/dropdown.js +3 -1
  260. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  261. package/build-module/components/block-pattern-setup/index.js +1 -1
  262. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  263. package/build-module/components/block-pattern-setup/use-patterns-setup.js +2 -2
  264. package/build-module/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
  265. package/build-module/components/block-patterns-list/index.js +32 -3
  266. package/build-module/components/block-patterns-list/index.js.map +1 -1
  267. package/build-module/components/block-preview/auto.js +9 -11
  268. package/build-module/components/block-preview/auto.js.map +1 -1
  269. package/build-module/components/block-preview/index.js +31 -8
  270. package/build-module/components/block-preview/index.js.map +1 -1
  271. package/build-module/components/block-selection-clearer/index.js +1 -1
  272. package/build-module/components/block-selection-clearer/index.js.map +1 -1
  273. package/build-module/components/block-settings/container.native.js +6 -30
  274. package/build-module/components/block-settings/container.native.js.map +1 -1
  275. package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -6
  276. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  277. package/build-module/components/block-settings-menu-controls/index.js +2 -7
  278. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  279. package/build-module/components/block-switcher/utils.js +1 -1
  280. package/build-module/components/block-switcher/utils.js.map +1 -1
  281. package/build-module/components/block-tools/selected-block-popover.js +55 -48
  282. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  283. package/build-module/components/block-vertical-alignment-control/icons.js +12 -0
  284. package/build-module/components/block-vertical-alignment-control/icons.js.map +1 -1
  285. package/build-module/components/block-vertical-alignment-control/ui.js +10 -5
  286. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  287. package/build-module/components/color-style-selector/index.js +3 -1
  288. package/build-module/components/color-style-selector/index.js.map +1 -1
  289. package/build-module/components/date-format-picker/index.js +4 -5
  290. package/build-module/components/date-format-picker/index.js.map +1 -1
  291. package/build-module/components/font-family/index.js +1 -6
  292. package/build-module/components/font-family/index.js.map +1 -1
  293. package/build-module/components/font-sizes/fluid-utils.js +1 -1
  294. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  295. package/build-module/components/font-sizes/utils.js +1 -1
  296. package/build-module/components/font-sizes/utils.js.map +1 -1
  297. package/build-module/components/global-styles/context.js +12 -0
  298. package/build-module/components/global-styles/context.js.map +1 -0
  299. package/build-module/components/global-styles/hooks.js +121 -0
  300. package/build-module/components/global-styles/hooks.js.map +1 -0
  301. package/build-module/components/global-styles/index.js +4 -0
  302. package/build-module/components/global-styles/index.js.map +1 -0
  303. package/build-module/components/global-styles/typography-utils.js +84 -0
  304. package/build-module/components/global-styles/typography-utils.js.map +1 -0
  305. package/build-module/components/global-styles/use-global-styles-output.js +930 -0
  306. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -0
  307. package/build-module/components/global-styles/utils.js +321 -0
  308. package/build-module/components/global-styles/utils.js.map +1 -0
  309. package/build-module/components/height-control/index.js +14 -1
  310. package/build-module/components/height-control/index.js.map +1 -1
  311. package/build-module/components/image-editor/constants.js +1 -1
  312. package/build-module/components/image-editor/constants.js.map +1 -1
  313. package/build-module/components/image-editor/context.js +1 -2
  314. package/build-module/components/image-editor/context.js.map +1 -1
  315. package/build-module/components/image-editor/cropper.js +3 -1
  316. package/build-module/components/image-editor/cropper.js.map +1 -1
  317. package/build-module/components/image-editor/index.js +13 -3
  318. package/build-module/components/image-editor/index.js.map +1 -1
  319. package/build-module/components/image-editor/use-transform-image.js +12 -37
  320. package/build-module/components/image-editor/use-transform-image.js.map +1 -1
  321. package/build-module/components/image-size-control/index.js +1 -6
  322. package/build-module/components/image-size-control/index.js.map +1 -1
  323. package/build-module/components/index.js +2 -3
  324. package/build-module/components/index.js.map +1 -1
  325. package/build-module/components/inner-blocks/index.js +21 -32
  326. package/build-module/components/inner-blocks/index.js.map +1 -1
  327. package/build-module/components/inner-blocks/index.native.js +9 -22
  328. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  329. package/build-module/components/inner-blocks/use-block-context.js +43 -0
  330. package/build-module/components/inner-blocks/use-block-context.js.map +1 -0
  331. package/build-module/components/inserter/block-patterns-explorer/explorer.js +0 -1
  332. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  333. package/build-module/components/inserter/block-patterns-tab.js +7 -1
  334. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  335. package/build-module/components/inserter/block-types-tab.js +3 -3
  336. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  337. package/build-module/components/inserter/hooks/use-patterns-state.js +1 -6
  338. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  339. package/build-module/components/inserter/index.js +5 -4
  340. package/build-module/components/inserter/index.js.map +1 -1
  341. package/build-module/components/inserter/media-tab/hooks.js +145 -56
  342. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  343. package/build-module/components/inserter/media-tab/media-list.js +74 -24
  344. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  345. package/build-module/components/inserter/media-tab/media-panel.js +14 -14
  346. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  347. package/build-module/components/inserter/media-tab/media-tab.js +7 -4
  348. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  349. package/build-module/components/inserter/media-tab/utils.js +27 -15
  350. package/build-module/components/inserter/media-tab/utils.js.map +1 -1
  351. package/build-module/components/inserter/menu.js +1 -0
  352. package/build-module/components/inserter/menu.js.map +1 -1
  353. package/build-module/components/inserter/preview-panel.js +5 -3
  354. package/build-module/components/inserter/preview-panel.js.map +1 -1
  355. package/build-module/components/inserter/search-results.js +2 -6
  356. package/build-module/components/inserter/search-results.js.map +1 -1
  357. package/build-module/components/inserter-list-item/index.js +1 -9
  358. package/build-module/components/inserter-list-item/index.js.map +1 -1
  359. package/build-module/components/inspector-controls/fill.js +14 -2
  360. package/build-module/components/inspector-controls/fill.js.map +1 -1
  361. package/build-module/components/inspector-controls/fill.native.js +13 -1
  362. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  363. package/build-module/components/inspector-controls/groups.js +4 -0
  364. package/build-module/components/inspector-controls/groups.js.map +1 -1
  365. package/build-module/components/inspector-controls/index.js +2 -2
  366. package/build-module/components/inspector-controls/index.js.map +1 -1
  367. package/build-module/components/inspector-controls/slot.js +13 -1
  368. package/build-module/components/inspector-controls/slot.js.map +1 -1
  369. package/build-module/components/inspector-controls/slot.native.js +13 -1
  370. package/build-module/components/inspector-controls/slot.native.js.map +1 -1
  371. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
  372. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
  373. package/build-module/components/inspector-controls-tabs/index.js +2 -2
  374. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  375. package/build-module/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  376. package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  377. package/build-module/components/inspector-controls-tabs/styles-tab.js +6 -4
  378. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  379. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +17 -12
  380. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  381. package/build-module/components/justify-content-control/ui.js +9 -2
  382. package/build-module/components/justify-content-control/ui.js.map +1 -1
  383. package/build-module/components/link-control/index.js +45 -16
  384. package/build-module/components/link-control/index.js.map +1 -1
  385. package/build-module/components/list-view/block.js +1 -1
  386. package/build-module/components/list-view/block.js.map +1 -1
  387. package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
  388. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  389. package/build-module/components/media-upload/index.native.js +4 -1
  390. package/build-module/components/media-upload/index.native.js.map +1 -1
  391. package/build-module/components/off-canvas-editor/appender.js +47 -4
  392. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  393. package/build-module/components/off-canvas-editor/block-select-button.js +9 -4
  394. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
  395. package/build-module/components/off-canvas-editor/block.js +6 -25
  396. package/build-module/components/off-canvas-editor/block.js.map +1 -1
  397. package/build-module/components/off-canvas-editor/branch.js +23 -11
  398. package/build-module/components/off-canvas-editor/branch.js.map +1 -1
  399. package/build-module/components/off-canvas-editor/index.js +11 -15
  400. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  401. package/build-module/components/off-canvas-editor/link-ui.js +2 -2
  402. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
  403. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
  404. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -1
  405. package/build-module/components/provider/index.js +16 -9
  406. package/build-module/components/provider/index.js.map +1 -1
  407. package/build-module/components/provider/index.native.js +4 -4
  408. package/build-module/components/provider/index.native.js.map +1 -1
  409. package/build-module/components/rich-text/use-before-input-rules.js +10 -2
  410. package/build-module/components/rich-text/use-before-input-rules.js.map +1 -1
  411. package/build-module/components/rich-text/utils.js +1 -1
  412. package/build-module/components/rich-text/utils.js.map +1 -1
  413. package/build-module/components/spacing-sizes-control/utils.js +2 -7
  414. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  415. package/build-module/components/tool-selector/index.js +3 -1
  416. package/build-module/components/tool-selector/index.js.map +1 -1
  417. package/build-module/components/url-popover/image-url-input-ui.js +8 -8
  418. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  419. package/build-module/components/use-block-display-information/index.js +1 -1
  420. package/build-module/components/use-block-display-information/index.js.map +1 -1
  421. package/build-module/experiments.js +25 -0
  422. package/build-module/experiments.js.map +1 -0
  423. package/build-module/experiments.native.js +23 -0
  424. package/build-module/experiments.native.js.map +1 -0
  425. package/build-module/hooks/anchor.js +2 -1
  426. package/build-module/hooks/anchor.js.map +1 -1
  427. package/build-module/hooks/border.js +1 -1
  428. package/build-module/hooks/border.js.map +1 -1
  429. package/build-module/hooks/child-layout.js +5 -1
  430. package/build-module/hooks/child-layout.js.map +1 -1
  431. package/build-module/hooks/color-panel.js +1 -1
  432. package/build-module/hooks/color-panel.js.map +1 -1
  433. package/build-module/hooks/color.js +3 -3
  434. package/build-module/hooks/color.js.map +1 -1
  435. package/build-module/hooks/custom-class-name.js +2 -1
  436. package/build-module/hooks/custom-class-name.js.map +1 -1
  437. package/build-module/hooks/dimensions.js +6 -5
  438. package/build-module/hooks/dimensions.js.map +1 -1
  439. package/build-module/hooks/margin.js +1 -0
  440. package/build-module/hooks/margin.js.map +1 -1
  441. package/build-module/hooks/padding.js +1 -0
  442. package/build-module/hooks/padding.js.map +1 -1
  443. package/build-module/hooks/position.js +31 -14
  444. package/build-module/hooks/position.js.map +1 -1
  445. package/build-module/hooks/typography.js +1 -1
  446. package/build-module/hooks/typography.js.map +1 -1
  447. package/build-module/hooks/use-color-props.js +3 -3
  448. package/build-module/hooks/use-color-props.js.map +1 -1
  449. package/build-module/hooks/utils.js +70 -4
  450. package/build-module/hooks/utils.js.map +1 -1
  451. package/build-module/index.js +1 -0
  452. package/build-module/index.js.map +1 -1
  453. package/build-module/layouts/constrained.js +3 -0
  454. package/build-module/layouts/constrained.js.map +1 -1
  455. package/build-module/layouts/flex.js +60 -10
  456. package/build-module/layouts/flex.js.map +1 -1
  457. package/build-module/layouts/flow.js +0 -18
  458. package/build-module/layouts/flow.js.map +1 -1
  459. package/build-module/store/actions.js +2 -26
  460. package/build-module/store/actions.js.map +1 -1
  461. package/build-module/store/defaults.js +5 -2
  462. package/build-module/store/defaults.js.map +1 -1
  463. package/build-module/store/index.js +8 -2
  464. package/build-module/store/index.js.map +1 -1
  465. package/build-module/store/private-actions.js +66 -0
  466. package/build-module/store/private-actions.js.map +1 -0
  467. package/build-module/store/private-selectors.js +11 -0
  468. package/build-module/store/private-selectors.js.map +1 -0
  469. package/build-module/store/reducer.js +1 -1
  470. package/build-module/store/reducer.js.map +1 -1
  471. package/build-module/store/selectors.js +48 -25
  472. package/build-module/store/selectors.js.map +1 -1
  473. package/build-module/utils/block-variation-transforms.js +1 -1
  474. package/build-module/utils/block-variation-transforms.js.map +1 -1
  475. package/build-module/utils/parse-css-unit-to-px.js +1 -1
  476. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  477. package/build-module/utils/transform-styles/index.js +1 -6
  478. package/build-module/utils/transform-styles/index.js.map +1 -1
  479. package/build-style/content-rtl.css +283 -3
  480. package/build-style/content.css +283 -3
  481. package/build-style/style-rtl.css +105 -221
  482. package/build-style/style.css +105 -221
  483. package/package.json +30 -29
  484. package/src/components/alignment-control/test/__snapshots__/index.js.snap +3 -3
  485. package/src/components/alignment-control/test/index.js +5 -15
  486. package/src/components/alignment-control/ui.js +1 -1
  487. package/src/components/autocomplete/index.js +3 -6
  488. package/src/components/block-alignment-control/test/index.js +3 -11
  489. package/src/components/block-alignment-matrix-control/index.js +1 -2
  490. package/src/components/block-card/index.js +1 -4
  491. package/src/components/block-content-overlay/content.scss +4 -4
  492. package/src/components/block-edit/index.js +15 -1
  493. package/src/components/block-icon/content.scss +31 -0
  494. package/src/components/block-inspector/index.js +13 -17
  495. package/src/components/block-list/use-in-between-inserter.js +5 -0
  496. package/src/components/block-lock/modal.js +0 -1
  497. package/src/components/block-mover/mover-description.js +2 -2
  498. package/src/components/block-mover/stories/index.js +3 -3
  499. package/src/components/block-navigation/dropdown.js +1 -1
  500. package/src/components/block-pattern-setup/index.js +1 -4
  501. package/src/components/block-pattern-setup/use-patterns-setup.js +2 -5
  502. package/src/components/block-patterns-list/index.js +29 -3
  503. package/src/components/block-preview/README.md +9 -9
  504. package/src/components/block-preview/auto.js +9 -11
  505. package/src/components/block-preview/content.scss +23 -0
  506. package/src/components/block-preview/index.js +40 -10
  507. package/src/components/block-preview/style.scss +0 -23
  508. package/src/components/block-selection-clearer/index.js +1 -1
  509. package/src/components/block-selection-clearer/test/index.js +6 -6
  510. package/src/components/block-settings/container.native.js +7 -26
  511. package/src/components/block-settings-menu/block-settings-dropdown.js +13 -5
  512. package/src/components/block-settings-menu-controls/index.js +2 -10
  513. package/src/components/block-switcher/test/index.js +43 -44
  514. package/src/components/block-switcher/utils.js +1 -1
  515. package/src/components/block-tools/selected-block-popover.js +77 -80
  516. package/src/components/block-tools/style.scss +0 -1
  517. package/src/components/block-variation-picker/{style.scss → content.scss} +0 -0
  518. package/src/components/block-vertical-alignment-control/icons.js +12 -0
  519. package/src/components/block-vertical-alignment-control/test/index.js +3 -11
  520. package/src/components/block-vertical-alignment-control/ui.js +16 -6
  521. package/src/components/color-style-selector/index.js +1 -1
  522. package/src/components/colors/test/with-colors.js +2 -8
  523. package/src/components/date-format-picker/index.js +23 -24
  524. package/src/components/date-format-picker/style.scss +0 -6
  525. package/src/components/default-block-appender/content.scss +18 -0
  526. package/src/components/default-block-appender/test/index.js +2 -8
  527. package/src/components/font-family/index.js +1 -6
  528. package/src/components/font-sizes/fluid-utils.js +1 -1
  529. package/src/components/font-sizes/utils.js +1 -1
  530. package/src/components/global-styles/README.md +77 -0
  531. package/src/components/global-styles/context.js +15 -0
  532. package/src/components/global-styles/hooks.js +145 -0
  533. package/src/components/global-styles/index.js +7 -0
  534. package/src/components/global-styles/test/typography-utils.js +393 -0
  535. package/src/components/global-styles/test/use-global-styles-output.js +814 -0
  536. package/src/components/global-styles/test/utils.js +206 -0
  537. package/src/components/global-styles/typography-utils.js +87 -0
  538. package/src/components/global-styles/use-global-styles-output.js +1088 -0
  539. package/src/components/global-styles/utils.js +373 -0
  540. package/src/components/height-control/README.md +55 -0
  541. package/src/components/height-control/index.js +13 -1
  542. package/src/components/image-editor/constants.js +1 -1
  543. package/src/components/image-editor/context.js +5 -9
  544. package/src/components/image-editor/cropper.js +3 -1
  545. package/src/components/image-editor/index.js +13 -4
  546. package/src/components/image-editor/use-transform-image.js +14 -55
  547. package/src/components/image-size-control/index.js +1 -6
  548. package/src/components/index.js +2 -6
  549. package/src/components/inner-blocks/index.js +29 -33
  550. package/src/components/inner-blocks/index.native.js +27 -47
  551. package/src/components/inner-blocks/use-block-context.js +47 -0
  552. package/src/components/inserter/block-patterns-explorer/explorer.js +0 -1
  553. package/src/components/inserter/block-patterns-tab.js +7 -0
  554. package/src/components/inserter/block-types-tab.js +3 -4
  555. package/src/components/inserter/hooks/use-patterns-state.js +1 -6
  556. package/src/components/inserter/index.js +3 -4
  557. package/src/components/inserter/media-tab/hooks.js +167 -65
  558. package/src/components/inserter/media-tab/media-list.js +94 -26
  559. package/src/components/inserter/media-tab/media-panel.js +9 -20
  560. package/src/components/inserter/media-tab/media-tab.js +12 -4
  561. package/src/components/inserter/media-tab/utils.js +20 -10
  562. package/src/components/inserter/menu.js +1 -0
  563. package/src/components/inserter/preview-panel.js +4 -2
  564. package/src/components/inserter/search-results.js +2 -6
  565. package/src/components/inserter/stories/index.js +9 -9
  566. package/src/components/inserter/style.scss +58 -11
  567. package/src/components/inserter-list-item/index.js +0 -7
  568. package/src/components/inspector-controls/README.md +3 -7
  569. package/src/components/inspector-controls/fill.js +15 -1
  570. package/src/components/inspector-controls/fill.native.js +14 -1
  571. package/src/components/inspector-controls/groups.js +3 -0
  572. package/src/components/inspector-controls/index.js +2 -6
  573. package/src/components/inspector-controls/slot.js +14 -1
  574. package/src/components/inspector-controls/slot.native.js +14 -1
  575. package/src/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
  576. package/src/components/inspector-controls-tabs/index.js +2 -4
  577. package/src/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  578. package/src/components/inspector-controls-tabs/styles-tab.js +5 -7
  579. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +21 -10
  580. package/src/components/justify-content-control/ui.js +9 -0
  581. package/src/components/link-control/index.js +59 -23
  582. package/src/components/link-control/style.scss +7 -24
  583. package/src/components/link-control/test/index.js +134 -5
  584. package/src/components/list-view/block.js +1 -1
  585. package/src/components/list-view/use-list-view-drop-zone.js +1 -1
  586. package/src/components/media-replace-flow/test/index.js +4 -12
  587. package/src/components/media-upload/index.native.js +2 -2
  588. package/src/components/off-canvas-editor/README.md +2 -2
  589. package/src/components/off-canvas-editor/appender.js +93 -37
  590. package/src/components/off-canvas-editor/block-select-button.js +12 -1
  591. package/src/components/off-canvas-editor/block.js +3 -42
  592. package/src/components/off-canvas-editor/branch.js +32 -5
  593. package/src/components/off-canvas-editor/index.js +10 -25
  594. package/src/components/off-canvas-editor/link-ui.js +2 -2
  595. package/src/components/off-canvas-editor/style.scss +5 -1
  596. package/src/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
  597. package/src/components/provider/index.js +33 -14
  598. package/src/components/provider/index.native.js +4 -3
  599. package/src/components/provider/test/experimental-provider.js +94 -0
  600. package/src/components/provider/test/use-block-sync.js +10 -0
  601. package/src/components/responsive-block-control/test/index.js +1 -5
  602. package/src/components/rich-text/use-before-input-rules.js +10 -2
  603. package/src/components/rich-text/utils.js +1 -1
  604. package/src/components/spacing-sizes-control/utils.js +2 -7
  605. package/src/components/tool-selector/index.js +1 -1
  606. package/src/components/url-input/test/button.js +24 -24
  607. package/src/components/url-popover/image-url-input-ui.js +7 -8
  608. package/src/components/url-popover/style.scss +0 -10
  609. package/src/components/use-block-display-information/index.js +1 -1
  610. package/src/components/warning/{style.scss → content.scss} +0 -0
  611. package/src/components/warning/test/index.js +1 -5
  612. package/src/content.scss +7 -0
  613. package/src/experiments.js +27 -0
  614. package/src/experiments.native.js +25 -0
  615. package/src/hooks/anchor.js +2 -1
  616. package/src/hooks/border.js +1 -1
  617. package/src/hooks/child-layout.js +6 -1
  618. package/src/hooks/color-panel.js +1 -1
  619. package/src/hooks/color.js +3 -3
  620. package/src/hooks/custom-class-name.js +2 -1
  621. package/src/hooks/dimensions.js +6 -6
  622. package/src/hooks/layout.scss +4 -0
  623. package/src/hooks/margin.js +1 -0
  624. package/src/hooks/padding.js +1 -0
  625. package/src/hooks/position.js +52 -36
  626. package/src/hooks/test/align.native.js +1 -1
  627. package/src/hooks/test/utils.js +104 -0
  628. package/src/hooks/typography.js +1 -1
  629. package/src/hooks/use-color-props.js +3 -3
  630. package/src/hooks/utils.js +68 -2
  631. package/src/index.js +1 -0
  632. package/src/layouts/constrained.js +3 -0
  633. package/src/layouts/flex.js +66 -14
  634. package/src/layouts/flow.js +0 -9
  635. package/src/store/actions.js +2 -26
  636. package/src/store/defaults.js +7 -2
  637. package/src/store/index.js +8 -2
  638. package/src/store/private-actions.js +65 -0
  639. package/src/store/private-selectors.js +10 -0
  640. package/src/store/reducer.js +1 -1
  641. package/src/store/selectors.js +103 -52
  642. package/src/store/test/actions.js +0 -18
  643. package/src/store/test/private-actions.js +22 -0
  644. package/src/store/test/private-selectors.js +24 -0
  645. package/src/store/test/selectors.js +52 -30
  646. package/src/style.scss +3 -5
  647. package/src/utils/block-variation-transforms.js +1 -1
  648. package/src/utils/parse-css-unit-to-px.js +3 -1
  649. package/src/utils/test/parse-css-unit-to-px.js +16 -24
  650. package/src/utils/transform-styles/index.js +1 -6
  651. package/build/components/inner-blocks/get-block-context.js +0 -45
  652. package/build/components/inner-blocks/get-block-context.js.map +0 -1
  653. package/build/components/off-canvas-editor/block-edit-button.js +0 -50
  654. package/build/components/off-canvas-editor/block-edit-button.js.map +0 -1
  655. package/build-module/components/inner-blocks/get-block-context.js +0 -37
  656. package/build-module/components/inner-blocks/get-block-context.js.map +0 -1
  657. package/build-module/components/off-canvas-editor/block-edit-button.js +0 -35
  658. package/build-module/components/off-canvas-editor/block-edit-button.js.map +0 -1
  659. package/src/components/inner-blocks/get-block-context.js +0 -39
  660. package/src/components/off-canvas-editor/block-edit-button.js +0 -27
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"names":["noop","LinkControl","searchInputPlaceholder","value","settings","DEFAULT_LINK_SETTINGS","onChange","onRemove","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","isMounting","wrapperNode","textInputRef","isEndingEditWithFocus","internalUrlInputValue","setInternalUrlInputValue","url","internalTextInputValue","setInternalTextInputValue","title","isEditingLink","setIsEditingLink","createPage","isCreatingPage","errorMessage","current","whichFocusTargetIndex","nextFocusTarget","focus","focusable","find","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","ENTER","currentInputIsEmpty","preventDefault","trim","length","shownUnlinkControl","showSettingsDrawer","showTextControl","keyboardReturn","ViewerFill"],"mappings":";;;;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,WAAT,OAmBI;AAAA;;AAAA,MAnBkB;AACrBC,IAAAA,sBADqB;AAErBC,IAAAA,KAFqB;AAGrBC,IAAAA,QAAQ,GAAGC,gCAHU;AAIrBC,IAAAA,QAAQ,GAAGN,IAJU;AAKrBO,IAAAA,QALqB;AAMrBC,IAAAA,aAAa,GAAG,KANK;AAOrBC,IAAAA,eAAe,GAAG,IAPG;AAQrBC,IAAAA,sBARqB;AASrBC,IAAAA,kBATqB;AAUrBC,IAAAA,gBAVqB;AAWrBC,IAAAA,oBAXqB;AAYrBC,IAAAA,UAAU,EAAEC,cAAc,GAAG,EAZR;AAarBC,IAAAA,gBAAgB,GAAG,EAbE;AAcrBC,IAAAA,eAAe,GAAG,KAdG;AAerBC,IAAAA,0BAfqB;AAgBrBC,IAAAA,eAAe,GAAG,KAhBG;AAiBrBC,IAAAA,cAAc,GAAG,KAjBI;AAkBrBC,I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AAGA,KAAH,uBAAGA,KAAK,CAAE0B,GADd,CACoB;AADpB;AAEC,IAAA,KAAK,EAAG1B,KAFT;AAGC,IAAA,WAAW,EAAG,MAAM+B,gBAAgB,CAAE,IAAF,CAHrC;AAIC,IAAA,eAAe,EAAGf,eAJnB;AAKC,IAAA,gBAAgB,EAAGyC,kBALpB;AAMC,IAAA,QAAQ,EAAGrD;AANZ,IAzEF,EAmFGsD,kBAAkB,IACnB;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG1D,KADT;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,QAAQ,EAAGE;AAHZ,IADD,CApFF,EA4FGe,mBAAmB,IAAIA,mBAAmB,EA5F7C,CADD;AAgGA;;AAEDpB,WAAW,CAAC+D,UAAZ,GAAyBA,sBAAzB;eAEe/D,W","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Spinner, Notice, TextControl } from '@wordpress/components';\nimport { keyboardReturn } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport useCreatePage from './use-create-page';\nimport useInternalInputValue from './use-internal-input-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\nconst noop = () => {};\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst isMounting = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst isEndingEditWithFocus = useRef( false );\n\n\tconst [ internalUrlInputValue, setInternalUrlInputValue ] =\n\t\tuseInternalInputValue( value?.url || '' );\n\n\tconst [ internalTextInputValue, setInternalTextInputValue ] =\n\t\tuseInternalInputValue( value?.title || '' );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tforceIsEditingLink !== undefined &&\n\t\t\tforceIsEditingLink !== isEditingLink\n\t\t) {\n\t\t\tsetIsEditingLink( forceIsEditingLink );\n\t\t}\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\t\t// Unless we are mounting, we always want to focus either:\n\t\t// - the URL input\n\t\t// - the first focusable element in the Link UI.\n\t\t// But in editing mode if there is a text input present then\n\t\t// the URL input is at index 1. If not then it is at index 0.\n\t\tconst whichFocusTargetIndex = textInputRef?.current ? 1 : 0;\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[\n\t\t\t\twhichFocusTargetIndex\n\t\t\t] || wrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocus.current = false;\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tconst stopEditing = () => {\n\t\tisEndingEditWithFocus.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\tonChange( {\n\t\t\t...updatedValue,\n\t\t\ttitle: internalTextInputValue || updatedValue?.title,\n\t\t} );\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif (\n\t\t\tcurrentUrlInputValue !== value?.url ||\n\t\t\tinternalTextInputValue !== value?.title\n\t\t) {\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\turl: currentUrlInputValue,\n\t\t\t\ttitle: internalTextInputValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst currentUrlInputValue = propInputValue || internalUrlInputValue;\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showSettingsDrawer = !! settings?.length;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = value?.url?.trim()?.length > 0 && hasTextControl;\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ ( isEditingLink || ! value ) && ! isCreatingPage && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel=\"Text\"\n\t\t\t\t\t\t\t\tvalue={ internalTextInputValue }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalUrlInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tuseLabel={ showTextControl }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"block-editor-link-control__search-actions\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tonClick={ handleSubmit }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Submit' ) }\n\t\t\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\t\t\t\tdisabled={ currentInputIsEmpty } // Disallow submitting empty values.\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</LinkControlSearchInput>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ onRemove }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettingsDrawer && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\n\nexport default LinkControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"names":["noop","LinkControl","searchInputPlaceholder","value","settings","DEFAULT_LINK_SETTINGS","onChange","onRemove","onCancel","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","isMounting","wrapperNode","textInputRef","isEndingEditWithFocus","internalUrlInputValue","setInternalUrlInputValue","url","internalTextInputValue","setInternalTextInputValue","title","isEditingLink","setIsEditingLink","createPage","isCreatingPage","errorMessage","current","whichFocusTargetIndex","nextFocusTarget","focus","focusable","find","hasLinkValue","trim","length","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","ENTER","currentInputIsEmpty","preventDefault","resetInternalValues","handleCancel","stopPropagation","shownUnlinkControl","showSettingsDrawer","showTextControl","isEditing","ViewerFill"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,WAAT,OAoBI;AAAA;;AAAA,MApBkB;AACrBC,IAAAA,sBADqB;AAErBC,IAAAA,KAFqB;AAGrBC,IAAAA,QAAQ,GAAGC,gCAHU;AAIrBC,IAAAA,QAAQ,GAAGN,IAJU;AAKrBO,IAAAA,QALqB;AAMrBC,IAAAA,QANqB;AAOrBC,IAAAA,aAAa,GAAG,KAPK;AAQrBC,IAAAA,eAAe,GAAG,IARG;AASrBC,IAAAA,sBATqB;AAUrBC,IAAAA,kBAVqB;AAWrBC,IAAAA,gBAXqB;AAYrBC,IAAAA,oBAZqB;AAarBC,IAAAA,UAAU,EAAEC,cAAc,GAAG,EAbR;AAcrBC,IAAAA,gBAAgB,GAAG,EAdE;AAerBC,IAAAA,eAAe,GAAG,KAfG;AAgBrBC,IAAAA,0BAhBqB;AAiBrBC,IAAAA,eAAe,GAAG,KAjBG;AAkBrBC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A2B,IAAA,OAAO,EAAGG;AAArC,KACG,cAAI,QAAJ,CADH,CATD,CAZF,CA1ED,EAsGGzC,mBAAmB,IAAIA,mBAAmB,EAtG7C,CADD;AA0GA;;AAEDrB,WAAW,CAACoE,UAAZ,GAAyBA,sBAAzB;eAEepE,W","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Spinner, Notice, TextControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport useCreatePage from './use-create-page';\nimport useInternalInputValue from './use-internal-input-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\nconst noop = () => {};\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst isMounting = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst isEndingEditWithFocus = useRef( false );\n\n\tconst [ internalUrlInputValue, setInternalUrlInputValue ] =\n\t\tuseInternalInputValue( value?.url || '' );\n\n\tconst [ internalTextInputValue, setInternalTextInputValue ] =\n\t\tuseInternalInputValue( value?.title || '' );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tforceIsEditingLink !== undefined &&\n\t\t\tforceIsEditingLink !== isEditingLink\n\t\t) {\n\t\t\tsetIsEditingLink( forceIsEditingLink );\n\t\t}\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\t\t// Unless we are mounting, we always want to focus either:\n\t\t// - the URL input\n\t\t// - the first focusable element in the Link UI.\n\t\t// But in editing mode if there is a text input present then\n\t\t// the URL input is at index 1. If not then it is at index 0.\n\t\tconst whichFocusTargetIndex = textInputRef?.current ? 1 : 0;\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[\n\t\t\t\twhichFocusTargetIndex\n\t\t\t] || wrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocus.current = false;\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tconst stopEditing = () => {\n\t\tisEndingEditWithFocus.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\tonChange( {\n\t\t\t...updatedValue,\n\t\t\ttitle: internalTextInputValue || updatedValue?.title,\n\t\t} );\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif (\n\t\t\tcurrentUrlInputValue !== value?.url ||\n\t\t\tinternalTextInputValue !== value?.title\n\t\t) {\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\turl: currentUrlInputValue,\n\t\t\t\ttitle: internalTextInputValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalUrlInputValue( value?.url );\n\t\tsetInternalTextInputValue( value?.title );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst currentUrlInputValue = propInputValue || internalUrlInputValue;\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showSettingsDrawer = !! settings?.length;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel=\"Text\"\n\t\t\t\t\t\t\t\tvalue={ internalTextInputValue }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalUrlInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tuseLabel={ showTextControl }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ onRemove }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<div className=\"block-editor-link-control__drawer\">\n\t\t\t\t{ showSettingsDrawer && (\n\t\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\n\t\t\t\t{ isEditing && (\n\t\t\t\t\t<div className=\"block-editor-link-control__search-actions\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tonClick={ handleSubmit }\n\t\t\t\t\t\t\tclassName=\"xblock-editor-link-control__search-submit\"\n\t\t\t\t\t\t\tdisabled={ currentInputIsEmpty } // Disallow submitting empty values.\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ handleCancel }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t{ renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\n\nexport default LinkControl;\n"]}
@@ -179,7 +179,7 @@ function ListViewBlock(_ref) {
179
179
  'is-synced-branch': isSyncedBranch,
180
180
  'is-dragging': isDragged,
181
181
  'has-single-cell': !showBlockActions,
182
- 'is-synced': blockInformation.isSynced
182
+ 'is-synced': blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.isSynced
183
183
  }); // Only include all selected blocks if the currently clicked on block
184
184
  // is one of the selected blocks. This ensures that if a user attempts
185
185
  // to alter a block that isn't part of the selection, they're still able
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"names":["ListViewBlock","block","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","preventAnnouncement","isSyncedBranch","cellRef","isHovered","setIsHovered","clientId","isLocked","isContentLocked","canEdit","forceSelectionContentLock","select","blockEditorStore","hasSelectedInnerBlock","canExpand","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","blockInformation","blockName","getBlockName","showBlockActions","instanceId","descriptionId","blockPositionDescription","blockAriaLabel","title","settingsAriaLabel","isTreeGridMounted","expand","collapse","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","current","focus","onMouseEnter","onMouseLeave","selectEditorBlock","event","preventDefault","updateSelection","newClientId","undefined","toggleExpanded","stopPropagation","colSpan","classes","isSynced","dropdownClientIds","includes","ref","tabIndex","onFocus","moreVertical","className"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAKA;;AACA;;AAIA;;AACA;;AAQA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvCA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;AAcA,SAASA,aAAT,OAgBI;AAAA,MAhBoB;AACvBC,IAAAA,KADuB;AAEvBC,IAAAA,SAFuB;AAGvBC,IAAAA,UAHuB;AAIvBC,IAAAA,gBAJuB;AAKvBC,IAAAA,WALuB;AAMvBC,IAAAA,QANuB;AAOvBC,IAAAA,KAPuB;AAQvBC,IAAAA,QARuB;AASvBC,IAAAA,iBATuB;AAUvBC,IAAAA,eAVuB;AAWvBC,IAAAA,IAXuB;AAYvBC,IAAAA,UAZuB;AAavBC,IAAAA,iBAbuB;AAcvBC,IAAAA,mBAduB;AAevBC,IAAAA;AAfuB,GAgBpB;AACH,QAAMC,OAAO,GAAG,qBAAQ,IAAR,CAAhB;AACA,QAAM,CAAEC,SAAF,EAAaC,YAAb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JZ;AAKC,MAAA,OAAO,EAAGC;AALX,MADC;AAAA,GADH,CAfD,CADD,CAnDF,EAkFGjC,gBAAgB,IACjB,4BAAC,sCAAD;AACC,IAAA,SAAS,EAAGa,8BADb;AAEC,qBAAgB,CAAC,CAAE7C,UAAH,IAAiBoB;AAFlC,KAIG;AAAA,QAAE;AAAE2C,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,4BAAC,8BAAD;AACC,MAAA,SAAS,EAAGJ,iBADb;AAEC,MAAA,IAAI,EAAGK,mBAFR;AAGC,MAAA,KAAK,EAAG5B,iBAHT;AAIC,MAAA,WAAW,EAAG;AACbyB,QAAAA,GADa;AAEbI,QAAAA,SAAS,EAAE,oCAFE;AAGbH,QAAAA,QAHa;AAIbC,QAAAA;AAJa,OAJf;AAUC,MAAA,sBAAsB,MAVvB;AAWC,MAAA,yBAAyB,EAAGZ;AAX7B,MADC;AAAA,GAJH,CAnFF,CADD;AA2GA;;eAEc,mBAAMxD,aAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';\nimport { useListViewContext } from './context';\nimport { getBlockPositionDescription } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { useBlockLock } from '../block-lock';\n\nfunction ListViewBlock( {\n\tblock,\n\tisDragged,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n\tselectedClientIds,\n\tpreventAnnouncement,\n\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst { clientId } = block;\n\n\tconst { isLocked, isContentLocked, canEdit } = useBlockLock( clientId );\n\tconst forceSelectionContentLock = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isSelected ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif ( ! isContentLocked ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( blockEditorStore ).hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\ttrue\n\t\t\t);\n\t\t},\n\t\t[ isContentLocked, clientId, isSelected ]\n\t);\n\n\tconst canExpand = isContentLocked ? false : canEdit;\n\tconst isFirstSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected && selectedClientIds[ 0 ] === clientId );\n\tconst isLastSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected &&\n\t\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId );\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockName = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockName( clientId ),\n\t\t[ clientId ]\n\t);\n\n\t// When a block hides its toolbar it also hides the block settings menu,\n\t// since that menu is part of the toolbar in the editor canvas.\n\t// List View respects this by also hiding the block settings menu.\n\tconst showBlockActions = hasBlockSupport(\n\t\tblockName,\n\t\t'__experimentalToolbar',\n\t\ttrue\n\t);\n\tconst instanceId = useInstanceId( ListViewBlock );\n\tconst descriptionId = `list-view-block-select-button__${ instanceId }`;\n\tconst blockPositionDescription = getBlockPositionDescription(\n\t\tposition,\n\t\tsiblingBlockCount,\n\t\tlevel\n\t);\n\n\tlet blockAriaLabel = __( 'Link' );\n\tif ( blockInformation ) {\n\t\tblockAriaLabel = isLocked\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the locked block.\n\t\t\t\t\t__( '%s link (locked)' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the block.\n\t\t\t\t\t__( '%s link' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t );\n\t}\n\n\tconst settingsAriaLabel = blockInformation\n\t\t? sprintf(\n\t\t\t\t// translators: %s: The title of the block.\n\t\t\t\t__( 'Options for %s block' ),\n\t\t\t\tblockInformation.title\n\t\t )\n\t\t: __( 'Options' );\n\n\tconst { isTreeGridMounted, expand, collapse } = useListViewContext();\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isFirstSelectedBlock }\n\t);\n\n\t// If ListView has experimental features related to the Persistent List View,\n\t// only focus the selected list item on mount; otherwise the list would always\n\t// try to steal the focus from the editor canvas.\n\tuseEffect( () => {\n\t\tif ( ! isTreeGridMounted && isSelected ) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [] );\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\ttoggleBlockHighlight( clientId, true );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\ttoggleBlockHighlight( clientId, false );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tselectBlock( event, clientId );\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst updateSelection = useCallback(\n\t\t( newClientId ) => {\n\t\t\tselectBlock( undefined, newClientId );\n\t\t},\n\t\t[ selectBlock ]\n\t);\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent shift+click from opening link in a new window when toggling.\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 2;\n\t} else if ( ! showBlockActions ) {\n\t\tcolSpan = 3;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected || forceSelectionContentLock,\n\t\t'is-first-selected': isFirstSelectedBlock,\n\t\t'is-last-selected': isLastSelectedBlock,\n\t\t'is-branch-selected': isBranchSelected,\n\t\t'is-synced-branch': isSyncedBranch,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\n\t\t'is-synced': blockInformation.isSynced,\n\t} );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tisExpanded={ canExpand ? isExpanded : undefined }\n\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t\taria-label={ blockAriaLabel }\n\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\taria-expanded={ canExpand ? isExpanded : undefined }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tpreventAnnouncement={ preventAnnouncement }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__description\"\n\t\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsDropdown\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ settingsAriaLabel }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\tclassName: 'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t__experimentalSelectBlock={ updateSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"names":["ListViewBlock","block","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","preventAnnouncement","isSyncedBranch","cellRef","isHovered","setIsHovered","clientId","isLocked","isContentLocked","canEdit","forceSelectionContentLock","select","blockEditorStore","hasSelectedInnerBlock","canExpand","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","blockInformation","blockName","getBlockName","showBlockActions","instanceId","descriptionId","blockPositionDescription","blockAriaLabel","title","settingsAriaLabel","isTreeGridMounted","expand","collapse","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","current","focus","onMouseEnter","onMouseLeave","selectEditorBlock","event","preventDefault","updateSelection","newClientId","undefined","toggleExpanded","stopPropagation","colSpan","classes","isSynced","dropdownClientIds","includes","ref","tabIndex","onFocus","moreVertical","className"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAKA;;AACA;;AAIA;;AACA;;AAQA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvCA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;AAcA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AjB,KAAF;AAAA,WACD,4BAAC,0BAAD;AACC,MAAA,WAAW,EAAC,UADb;AAEC,MAAA,SAAS,EAAG,CAAEjD,QAAF,CAFb;AAGC,MAAA,GAAG,EAAG+C,GAHP;AAIC,MAAA,QAAQ,EAAGC,QAJZ;AAKC,MAAA,OAAO,EAAGC;AALX,MADC;AAAA,GADH,CAJD,EAeC,4BAAC,sCAAD,QACG;AAAA,QAAE;AAAEF,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,4BAAC,4BAAD;AACC,MAAA,WAAW,EAAC,UADb;AAEC,MAAA,SAAS,EAAG,CAAEjD,QAAF,CAFb;AAGC,MAAA,GAAG,EAAG+C,GAHP;AAIC,MAAA,QAAQ,EAAGC,QAJZ;AAKC,MAAA,OAAO,EAAGC;AALX,MADC;AAAA,GADH,CAfD,CADD,CAnDF,EAkFGjC,gBAAgB,IACjB,4BAAC,sCAAD;AACC,IAAA,SAAS,EAAGa,8BADb;AAEC,qBAAgB,CAAC,CAAE7C,UAAH,IAAiBoB;AAFlC,KAIG;AAAA,QAAE;AAAE2C,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,4BAAC,8BAAD;AACC,MAAA,SAAS,EAAGJ,iBADb;AAEC,MAAA,IAAI,EAAGK,mBAFR;AAGC,MAAA,KAAK,EAAG5B,iBAHT;AAIC,MAAA,WAAW,EAAG;AACbyB,QAAAA,GADa;AAEbI,QAAAA,SAAS,EAAE,oCAFE;AAGbH,QAAAA,QAHa;AAIbC,QAAAA;AAJa,OAJf;AAUC,MAAA,sBAAsB,MAVvB;AAWC,MAAA,yBAAyB,EAAGZ;AAX7B,MADC;AAAA,GAJH,CAnFF,CADD;AA2GA;;eAEc,mBAAMxD,aAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';\nimport { useListViewContext } from './context';\nimport { getBlockPositionDescription } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { useBlockLock } from '../block-lock';\n\nfunction ListViewBlock( {\n\tblock,\n\tisDragged,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n\tselectedClientIds,\n\tpreventAnnouncement,\n\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst { clientId } = block;\n\n\tconst { isLocked, isContentLocked, canEdit } = useBlockLock( clientId );\n\tconst forceSelectionContentLock = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isSelected ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif ( ! isContentLocked ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( blockEditorStore ).hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\ttrue\n\t\t\t);\n\t\t},\n\t\t[ isContentLocked, clientId, isSelected ]\n\t);\n\n\tconst canExpand = isContentLocked ? false : canEdit;\n\tconst isFirstSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected && selectedClientIds[ 0 ] === clientId );\n\tconst isLastSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected &&\n\t\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId );\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockName = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockName( clientId ),\n\t\t[ clientId ]\n\t);\n\n\t// When a block hides its toolbar it also hides the block settings menu,\n\t// since that menu is part of the toolbar in the editor canvas.\n\t// List View respects this by also hiding the block settings menu.\n\tconst showBlockActions = hasBlockSupport(\n\t\tblockName,\n\t\t'__experimentalToolbar',\n\t\ttrue\n\t);\n\tconst instanceId = useInstanceId( ListViewBlock );\n\tconst descriptionId = `list-view-block-select-button__${ instanceId }`;\n\tconst blockPositionDescription = getBlockPositionDescription(\n\t\tposition,\n\t\tsiblingBlockCount,\n\t\tlevel\n\t);\n\n\tlet blockAriaLabel = __( 'Link' );\n\tif ( blockInformation ) {\n\t\tblockAriaLabel = isLocked\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the locked block.\n\t\t\t\t\t__( '%s link (locked)' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the block.\n\t\t\t\t\t__( '%s link' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t );\n\t}\n\n\tconst settingsAriaLabel = blockInformation\n\t\t? sprintf(\n\t\t\t\t// translators: %s: The title of the block.\n\t\t\t\t__( 'Options for %s block' ),\n\t\t\t\tblockInformation.title\n\t\t )\n\t\t: __( 'Options' );\n\n\tconst { isTreeGridMounted, expand, collapse } = useListViewContext();\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isFirstSelectedBlock }\n\t);\n\n\t// If ListView has experimental features related to the Persistent List View,\n\t// only focus the selected list item on mount; otherwise the list would always\n\t// try to steal the focus from the editor canvas.\n\tuseEffect( () => {\n\t\tif ( ! isTreeGridMounted && isSelected ) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [] );\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\ttoggleBlockHighlight( clientId, true );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\ttoggleBlockHighlight( clientId, false );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tselectBlock( event, clientId );\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst updateSelection = useCallback(\n\t\t( newClientId ) => {\n\t\t\tselectBlock( undefined, newClientId );\n\t\t},\n\t\t[ selectBlock ]\n\t);\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent shift+click from opening link in a new window when toggling.\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 2;\n\t} else if ( ! showBlockActions ) {\n\t\tcolSpan = 3;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected || forceSelectionContentLock,\n\t\t'is-first-selected': isFirstSelectedBlock,\n\t\t'is-last-selected': isLastSelectedBlock,\n\t\t'is-branch-selected': isBranchSelected,\n\t\t'is-synced-branch': isSyncedBranch,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\n\t\t'is-synced': blockInformation?.isSynced,\n\t} );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tisExpanded={ canExpand ? isExpanded : undefined }\n\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t\taria-label={ blockAriaLabel }\n\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\taria-expanded={ canExpand ? isExpanded : undefined }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tpreventAnnouncement={ preventAnnouncement }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__description\"\n\t\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsDropdown\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ settingsAriaLabel }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\tclassName: 'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t__experimentalSelectBlock={ updateSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"]}
@@ -84,7 +84,7 @@ const ALLOWED_DROP_EDGES = ['top', 'bottom'];
84
84
  * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.
85
85
  * @param {WPPoint} position The point representing the cursor position when dragging.
86
86
  *
87
- * @return {WPListViewDropZoneTarget} An object containing data about the drop target.
87
+ * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.
88
88
  */
89
89
 
90
90
  function getListViewDropTarget(blocksData, position) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-drop-zone.js"],"names":["isNestingGesture","point","rect","blockCenterX","left","width","x","ALLOWED_DROP_EDGES","getListViewDropTarget","blocksData","position","candidateEdge","candidateBlockData","candidateDistance","candidateRect","blockData","isDraggedBlock","element","getBoundingClientRect","distance","edge","isCursorWithinBlock","undefined","index","indexOf","previousBlockData","rootClientId","isDraggingBelow","canInsertDraggedBlocksAsChild","innerBlockCount","clientId","blockIndex","dropPosition","canInsertDraggedBlocksAsSibling","offset","useListViewDropZone","getBlockRootClientId","getBlockIndex","getBlockCount","getDraggedBlockClientIds","canInsertBlocks","blockEditorStore","target","setTarget","targetRootClientId","targetBlockIndex","onBlockDrop","draggedBlockClientIds","throttled","event","currentTarget","clientX","y","clientY","isBlockDrag","length","blockElements","Array","from","querySelectorAll","map","blockElement","dataset","block","includes","newTarget","ref","onDrop","onDragOver","onDragEnd","cancel"],"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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAT,CAA2BC,KAA3B,EAAkCC,IAAlC,EAAyC;AACxC,QAAMC,YAAY,GAAGD,IAAI,CAACE,IAAL,GAAYF,IAAI,CAACG,KAAL,GAAa,CAA9C;AACA,SAAOJ,KAAK,CAACK,CAAN,GAAUH,YAAjB;AACA,C,CAED;AACA;;;AACA,MAAMI,kBAAkB,GAAG,CAAE,KAAF,EAAS,QAAT,CAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,qBAAT,CAAgCC,UAAhC,EAA4CC,Q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wCC,CAAElB,qBAAF,CAxCD,CADiB,EA2CjB,GA3CiB,CAAlB;AA8CA,QAAMmB,GAAG,GAAG,wCAAa;AACxBC,IAAAA,MAAM,EAAErB,WADgB;;AAExBsB,IAAAA,UAAU,CAAEnB,KAAF,EAAU;AACnB;AACA;AACA;AACAD,MAAAA,SAAS,CAAEC,KAAF,EAASA,KAAK,CAACC,aAAf,CAAT;AACA,KAPuB;;AAQxBmB,IAAAA,SAAS,GAAG;AACXrB,MAAAA,SAAS,CAACsB,MAAV;AACA3B,MAAAA,SAAS,CAAE,IAAF,CAAT;AACA;;AAXuB,GAAb,CAAZ;AAcA,SAAO;AAAEuB,IAAAA,GAAF;AAAOxB,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 array representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {Object} WPListViewDropZoneBlocks\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} 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 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/**\n * Determines whether the user positioning the dragged block to nest as an\n * inner block.\n *\n * Presently this is determined by whether the cursor is on the right hand side\n * of the block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n */\nfunction isNestingGesture( point, rect ) {\n\tconst blockCenterX = rect.left + rect.width / 2;\n\treturn point.x > blockCenterX;\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} An object containing data about the drop target.\n */\nfunction getListViewDropTarget( blocksData, position ) {\n\tlet candidateEdge;\n\tlet candidateBlockData;\n\tlet candidateDistance;\n\tlet candidateRect;\n\n\tfor ( const blockData of blocksData ) {\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} else {\n\t\t\t\tcandidateBlockData = blockData;\n\t\t\t\tcandidateEdge = edge;\n\t\t\t\tcandidateRect = rect;\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 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, this should always be treated\n\t// as nesting since the next block in the tree will be the first child.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.canInsertDraggedBlocksAsChild &&\n\t\t( candidateBlockData.innerBlockCount > 0 ||\n\t\t\tisNestingGesture( position, candidateRect ) )\n\t) {\n\t\treturn {\n\t\t\trootClientId: candidateBlockData.clientId,\n\t\t\tblockIndex: 0,\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 * @return {WPListViewDropZoneTarget} The drop target.\n */\nexport default function useListViewDropZone() {\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 rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclientId,\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\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\tonDrop: onBlockDrop,\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":["isNestingGesture","point","rect","blockCenterX","left","width","x","ALLOWED_DROP_EDGES","getListViewDropTarget","blocksData","position","candidateEdge","candidateBlockData","candidateDistance","candidateRect","blockData","isDraggedBlock","element","getBoundingClientRect","distance","edge","isCursorWithinBlock","undefined","index","indexOf","previousBlockData","rootClientId","isDraggingBelow","canInsertDraggedBlocksAsChild","innerBlockCount","clientId","blockIndex","dropPosition","canInsertDraggedBlocksAsSibling","offset","useListViewDropZone","getBlockRootClientId","getBlockIndex","getBlockCount","getDraggedBlockClientIds","canInsertBlocks","blockEditorStore","target","setTarget","targetRootClientId","targetBlockIndex","onBlockDrop","draggedBlockClientIds","throttled","event","currentTarget","clientX","y","clientY","isBlockDrag","length","blockElements","Array","from","querySelectorAll","map","blockElement","dataset","block","includes","newTarget","ref","onDrop","onDragOver","onDragEnd","c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,QAAAA,YAFM;AAGNK,QAAAA,UAAU,EAAEM,aAAa,CAAEP,QAAF,CAHnB;AAINb,QAAAA,OAAO,EAAE4C,YAJH;AAKN7C,QAAAA,cAAc,EAAEsC,WAAW,GACxBP,qBAAqB,CAACiB,QAAtB,CAAgClC,QAAhC,CADwB,GAExB,KAPG;AAQND,QAAAA,eAAe,EAAES,aAAa,CAAER,QAAF,CARxB;AASNG,QAAAA,+BAA+B,EAAEqB,WAAW,GACzCd,eAAe,CACfO,qBADe,EAEfrB,YAFe,CAD0B,GAKzC,IAdG;AAeNE,QAAAA,6BAA6B,EAAE0B,WAAW,GACvCd,eAAe,CAAEO,qBAAF,EAAyBjB,QAAzB,CADwB,GAEvC;AAjBG,OAAP;AAmBA,KAvBkB,CAAnB;AAyBA,UAAMmC,SAAS,GAAGzD,qBAAqB,CAAEC,UAAF,EAAcC,QAAd,CAAvC;;AAEA,QAAKuD,SAAL,EAAiB;AAChBtB,MAAAA,SAAS,CAAEsB,SAAF,CAAT;AACA;AACD,GAvCF,EAwCC,CAAElB,qBAAF,CAxCD,CADiB,EA2CjB,GA3CiB,CAAlB;AA8CA,QAAMmB,GAAG,GAAG,wCAAa;AACxBC,IAAAA,MAAM,EAAErB,WADgB;;AAExBsB,IAAAA,UAAU,CAAEnB,KAAF,EAAU;AACnB;AACA;AACA;AACAD,MAAAA,SAAS,CAAEC,KAAF,EAASA,KAAK,CAACC,aAAf,CAAT;AACA,KAPuB;;AAQxBmB,IAAAA,SAAS,GAAG;AACXrB,MAAAA,SAAS,CAACsB,MAAV;AACA3B,MAAAA,SAAS,CAAE,IAAF,CAAT;AACA;;AAXuB,GAAb,CAAZ;AAcA,SAAO;AAAEuB,IAAAA,GAAF;AAAOxB,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 array representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {Object} WPListViewDropZoneBlocks\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} 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 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/**\n * Determines whether the user positioning the dragged block to nest as an\n * inner block.\n *\n * Presently this is determined by whether the cursor is on the right hand side\n * of the block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n */\nfunction isNestingGesture( point, rect ) {\n\tconst blockCenterX = rect.left + rect.width / 2;\n\treturn point.x > blockCenterX;\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 */\nfunction getListViewDropTarget( blocksData, position ) {\n\tlet candidateEdge;\n\tlet candidateBlockData;\n\tlet candidateDistance;\n\tlet candidateRect;\n\n\tfor ( const blockData of blocksData ) {\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} else {\n\t\t\t\tcandidateBlockData = blockData;\n\t\t\t\tcandidateEdge = edge;\n\t\t\t\tcandidateRect = rect;\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 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, this should always be treated\n\t// as nesting since the next block in the tree will be the first child.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.canInsertDraggedBlocksAsChild &&\n\t\t( candidateBlockData.innerBlockCount > 0 ||\n\t\t\tisNestingGesture( position, candidateRect ) )\n\t) {\n\t\treturn {\n\t\t\trootClientId: candidateBlockData.clientId,\n\t\t\tblockIndex: 0,\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 * @return {WPListViewDropZoneTarget} The drop target.\n */\nexport default function useListViewDropZone() {\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 rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclientId,\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\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\tonDrop: onBlockDrop,\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"]}
@@ -290,8 +290,11 @@ class MediaUpload extends _element.Component {
290
290
  exports.MediaUpload = MediaUpload;
291
291
 
292
292
  var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
293
+ const {
294
+ capabilities
295
+ } = select(_blockEditor.store).getSettings();
293
296
  return {
294
- isAudioBlockMediaUploadEnabled: select(_blockEditor.store).getSettings('capabilities').isAudioBlockMediaUploadEnabled === true
297
+ isAudioBlockMediaUploadEnabled: (capabilities === null || capabilities === void 0 ? void 0 : capabilities.isAudioBlockMediaUploadEnabled) === true
295
298
  };
296
299
  })])(MediaUpload);
297
300
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/media-upload/index.native.js"],"names":["MEDIA_TYPE_IMAGE","MEDIA_TYPE_VIDEO","MEDIA_TYPE_AUDIO","MEDIA_TYPE_ANY","OPTION_TAKE_VIDEO","OPTION_TAKE_PHOTO","OPTION_TAKE_PHOTO_OR_VIDEO","OPTION_INSERT_FROM_URL","OPTION_WORDPRESS_MEDIA_LIBRARY","URL_MEDIA_SOURCE","PICKER_OPENING_DELAY","MediaUpload","Component","pickerTimeout","constructor","props","onPickerPresent","bind","onPickerSelect","getAllSources","state","otherMediaOptions","componentDidMount","allowedTypes","autoOpen","otherMediaOptionsWithIcons","map","option","requiresModal","types","id","value","setState","componentWillUnmount","clearTimeout","onSelectURL","cameraImageSource","mediaSources","deviceCamera","label","icon","capturePhoto","cameraVideoSource","captureVideo","deviceLibrarySource","deviceLibrary","image","siteLibrarySource","siteMediaLibrary","wordpress","mediaLibrary","urlSource","globe","internalSources","concat","getMediaOptionsItems","__experimentalOnlyMediaLibrary","isAudioBlockMediaUploadEnabled","filter","source","every","allowedType","includes","some","getChooseFromDeviceIcon","mobile","isIOS","Platform","OS","picker","setTimeout","presentPicker","onSelect","multiple","undefined","text","style","onPress","mediaSource","shift","type","media","render","isReplacingMedia","isOneType","length","isImage","isVideo","isAudio","isAnyType","isImageOrVideo","pickerTitle","getMediaOptions","instance","open","select","blockEditorStore","getSettings"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAEA;;AAMA;;AACA;;AACA;;AAKA;;AAQA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAKA;AACA;AACA;AAqBO,MAAMA,gBAAgB,GAAG,OAAzB;;AACA,MAAMC,gBAAgB,GAAG,OAAzB;;AACA,MAAMC,gBAAgB,GAAG,OAAzB;;AACA,MAAMC,cAAc,GAAG,KAAvB;;AAEA,MAAMC,iBAAiB,GAAG,cAAI,cAAJ,CAA1B;;AACA,MAAMC,iBAAiB,GAAG,cAAI,cAAJ,CAA1B;;AACA,MAAMC,0BAA0B,GAAG,cAAI,uBAAJ,CAAnC;;AACA,MAAMC,sBAAsB,GAAG,cAAI,iBAAJ,CAA/B;;AACA,MAAMC,8BAA8B,GAAG,cAAI,yBAAJ,CAAvC;;AAEP,MAAMC,gBAAgB,GAAG,KAAzB;AAEA,MAAMC,oBAAoB,GAAG,GAA7B;;AAEO,MAAMC,WAAN,SAA0BC,kBAA1B,CAAoC;AAC1CC,EAAAA,aAAa;;AAEbC,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAOA,KAAP;AACA,SAAKC,eAAL,GAAuB,KAAKA,eAAL,CAAqBC,IAArB,CAA2B,IAA3B,CAAvB;AACA,SAAKC,cAAL,GAAsB,KAAKA,cAAL,CAAoBD,IAApB,CAA0B,IAA1B,CAAtB;AACA,SAAKE,aAAL,GAAqB,KAAKA,aAAL,CAAmBF,IAAnB,CAAyB,IAAzB,CAArB;AACA,SAAKG,KAAL,GAAa;AACZC,MAAAA,iBAAiB,EAAE;AADP,KAAb;AAGA;;AAEDC,EAAAA,iBAAiB,GAAG;AACnB,UAAM;AAAEC,MAAAA,YAAY,GAAG,EAAjB;AAAqBC,MAAAA;AAArB,QAAkC,KAAKT,KAA7C;AACA,iDAAsBQ,YAAtB,EAAsCF,i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AiB;AACvBE,MAAAA,WAAW,GAAG,cAAI,aAAJ,CAAd;;AACA,UAAKR,gBAAL,EAAwB;AACvBQ,QAAAA,WAAW,GAAG,cAAI,cAAJ,CAAd;AACA,OAFD,MAEO;AACNA,QAAAA,WAAW,GAAG,cAAI,aAAJ,CAAd;AACA;AACD;;AAED,UAAMC,eAAe,GAAG,MACvB,4BAAC,kBAAD;AACC,MAAA,KAAK,EAAGD,WADT;AAEC,MAAA,gBAAgB,MAFjB;AAGC,MAAA,GAAG,EAAKE,QAAF,IAAkB,KAAKxB,MAAL,GAAcwB,QAHvC;AAIC,MAAA,OAAO,EAAG,KAAKtC,oBAAL,EAJX;AAKC,MAAA,QAAQ,EAAG,KAAKrC,cALjB;AAMC,MAAA,MAAM,EAAC;AANR,MADD;;AAWA,WAAO,KAAKH,KAAL,CAAWmE,MAAX,CAAmB;AACzBY,MAAAA,IAAI,EAAE,KAAK9E,eADc;AAEzB4E,MAAAA;AAFyB,KAAnB,CAAP;AAIA;;AA3QyC;;;;eA8Q5B,sBAAS,CACvB,sBAAcG,MAAF,IAAc;AACzB,SAAO;AACNtC,IAAAA,8BAA8B,EAC7BsC,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,WAA3B,CAAwC,cAAxC,EACExC,8BADF,KACqC;AAHhC,GAAP;AAKA,CAND,CADuB,CAAT,EAQV9C,WARU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform } from 'react-native';\n\nimport prompt from 'react-native-prompt-android';\n\n/**\n * WordPress dependencies\n */\nimport { Component, React } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Picker } from '@wordpress/components';\nimport {\n\tgetOtherMediaOptions,\n\trequestMediaPicker,\n\tmediaSources,\n} from '@wordpress/react-native-bridge';\nimport {\n\tcapturePhoto,\n\tcaptureVideo,\n\timage,\n\twordpress,\n\tmobile,\n\tglobe,\n} from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\nexport const MEDIA_TYPE_IMAGE = 'image';\nexport const MEDIA_TYPE_VIDEO = 'video';\nexport const MEDIA_TYPE_AUDIO = 'audio';\nexport const MEDIA_TYPE_ANY = 'any';\n\nexport const OPTION_TAKE_VIDEO = __( 'Take a Video' );\nexport const OPTION_TAKE_PHOTO = __( 'Take a Photo' );\nexport const OPTION_TAKE_PHOTO_OR_VIDEO = __( 'Take a Photo or Video' );\nexport const OPTION_INSERT_FROM_URL = __( 'Insert from URL' );\nexport const OPTION_WORDPRESS_MEDIA_LIBRARY = __( 'WordPress Media Library' );\n\nconst URL_MEDIA_SOURCE = 'URL';\n\nconst PICKER_OPENING_DELAY = 200;\n\nexport class MediaUpload extends Component {\n\tpickerTimeout;\n\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.onPickerPresent = this.onPickerPresent.bind( this );\n\t\tthis.onPickerSelect = this.onPickerSelect.bind( this );\n\t\tthis.getAllSources = this.getAllSources.bind( this );\n\t\tthis.state = {\n\t\t\totherMediaOptions: [],\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { allowedTypes = [], autoOpen } = this.props;\n\t\tgetOtherMediaOptions( allowedTypes, ( otherMediaOptions ) => {\n\t\t\tconst otherMediaOptionsWithIcons = otherMediaOptions.map(\n\t\t\t\t( option ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...option,\n\t\t\t\t\t\trequiresModal: true,\n\t\t\t\t\t\ttypes: allowedTypes,\n\t\t\t\t\t\tid: option.value,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tthis.setState( { otherMediaOptions: otherMediaOptionsWithIcons } );\n\t\t} );\n\n\t\tif ( autoOpen ) {\n\t\t\tthis.onPickerPresent();\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.pickerTimeout );\n\t}\n\n\tgetAllSources() {\n\t\tconst { onSelectURL } = this.props;\n\n\t\tconst cameraImageSource = {\n\t\t\tid: mediaSources.deviceCamera, // ID is the value sent to native.\n\t\t\tvalue: mediaSources.deviceCamera + '-IMAGE', // This is needed to diferenciate image-camera from video-camera sources.\n\t\t\tlabel: __( 'Take a Photo' ),\n\t\t\trequiresModal: true,\n\t\t\ttypes: [ MEDIA_TYPE_IMAGE ],\n\t\t\ticon: capturePhoto,\n\t\t};\n\n\t\tconst cameraVideoSource = {\n\t\t\tid: mediaSources.deviceCamera,\n\t\t\tvalue: mediaSources.deviceCamera,\n\t\t\tlabel: __( 'Take a Video' ),\n\t\t\trequiresModal: true,\n\t\t\ttypes: [ MEDIA_TYPE_VIDEO ],\n\t\t\ticon: captureVideo,\n\t\t};\n\n\t\tconst deviceLibrarySource = {\n\t\t\tid: mediaSources.deviceLibrary,\n\t\t\tvalue: mediaSources.deviceLibrary,\n\t\t\tlabel: __( 'Choose from device' ),\n\t\t\trequiresModal: true,\n\t\t\ttypes: [ MEDIA_TYPE_IMAGE, MEDIA_TYPE_VIDEO ],\n\t\t\ticon: image,\n\t\t};\n\n\t\tconst siteLibrarySource = {\n\t\t\tid: mediaSources.siteMediaLibrary,\n\t\t\tvalue: mediaSources.siteMediaLibrary,\n\t\t\tlabel: __( 'WordPress Media Library' ),\n\t\t\trequiresModal: true,\n\t\t\ttypes: [\n\t\t\t\tMEDIA_TYPE_IMAGE,\n\t\t\t\tMEDIA_TYPE_VIDEO,\n\t\t\t\tMEDIA_TYPE_AUDIO,\n\t\t\t\tMEDIA_TYPE_ANY,\n\t\t\t],\n\t\t\ticon: wordpress,\n\t\t\tmediaLibrary: true,\n\t\t};\n\n\t\tconst urlSource = {\n\t\t\tid: URL_MEDIA_SOURCE,\n\t\t\tvalue: URL_MEDIA_SOURCE,\n\t\t\tlabel: __( 'Insert from URL' ),\n\t\t\ttypes: [ MEDIA_TYPE_AUDIO, MEDIA_TYPE_IMAGE, MEDIA_TYPE_VIDEO ],\n\t\t\ticon: globe,\n\t\t};\n\n\t\t// Only include `urlSource` option if `onSelectURL` prop is present, in order to match the web behavior.\n\t\tconst internalSources = [\n\t\t\tdeviceLibrarySource,\n\t\t\tcameraImageSource,\n\t\t\tcameraVideoSource,\n\t\t\tsiteLibrarySource,\n\t\t\t...( onSelectURL ? [ urlSource ] : [] ),\n\t\t];\n\n\t\treturn internalSources.concat( this.state.otherMediaOptions );\n\t}\n\n\tgetMediaOptionsItems() {\n\t\tconst {\n\t\t\tallowedTypes = [],\n\t\t\t__experimentalOnlyMediaLibrary,\n\t\t\tisAudioBlockMediaUploadEnabled,\n\t\t} = this.props;\n\n\t\treturn this.getAllSources()\n\t\t\t.filter( ( source ) => {\n\t\t\t\tif ( __experimentalOnlyMediaLibrary ) {\n\t\t\t\t\treturn source.mediaLibrary;\n\t\t\t\t} else if (\n\t\t\t\t\tallowedTypes.every(\n\t\t\t\t\t\t( allowedType ) =>\n\t\t\t\t\t\t\tallowedType === MEDIA_TYPE_AUDIO &&\n\t\t\t\t\t\t\tsource.types.includes( allowedType )\n\t\t\t\t\t) &&\n\t\t\t\t\tsource.id !== URL_MEDIA_SOURCE\n\t\t\t\t) {\n\t\t\t\t\treturn isAudioBlockMediaUploadEnabled === true;\n\t\t\t\t}\n\n\t\t\t\treturn allowedTypes.some( ( allowedType ) =>\n\t\t\t\t\tsource.types.includes( allowedType )\n\t\t\t\t);\n\t\t\t} )\n\t\t\t.map( ( source ) => {\n\t\t\t\treturn {\n\t\t\t\t\t...source,\n\t\t\t\t\ticon: source.icon || this.getChooseFromDeviceIcon(),\n\t\t\t\t};\n\t\t\t} );\n\t}\n\n\tgetChooseFromDeviceIcon() {\n\t\treturn mobile;\n\t}\n\n\tonPickerPresent() {\n\t\tconst { autoOpen } = this.props;\n\t\tconst isIOS = Platform.OS === 'ios';\n\n\t\tif ( this.picker ) {\n\t\t\t// the delay below is required because on iOS this action sheet gets dismissed by the close event of the Inserter\n\t\t\t// so this delay allows the Inserter to be closed fully before presenting action sheet.\n\t\t\tif ( autoOpen && isIOS ) {\n\t\t\t\tthis.pickerTimeout = setTimeout(\n\t\t\t\t\t() => this.picker.presentPicker(),\n\t\t\t\t\tPICKER_OPENING_DELAY\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.picker.presentPicker();\n\t\t\t}\n\t\t}\n\t}\n\n\tonPickerSelect( value ) {\n\t\tconst {\n\t\t\tallowedTypes = [],\n\t\t\tonSelect,\n\t\t\tonSelectURL,\n\t\t\tmultiple = false,\n\t\t} = this.props;\n\n\t\tif ( value === URL_MEDIA_SOURCE ) {\n\t\t\tprompt(\n\t\t\t\t__( 'Type a URL' ), // title\n\t\t\t\tundefined, // message\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: __( 'Cancel' ),\n\t\t\t\t\t\tstyle: 'cancel',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: __( 'Apply' ),\n\t\t\t\t\t\tonPress: onSelectURL,\n\t\t\t\t\t},\n\t\t\t\t], // Buttons.\n\t\t\t\t'plain-text', // type\n\t\t\t\tundefined, // defaultValue\n\t\t\t\t'url' // keyboardType\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst mediaSource = this.getAllSources()\n\t\t\t.filter( ( source ) => source.value === value )\n\t\t\t.shift();\n\t\tconst types = allowedTypes.filter( ( type ) =>\n\t\t\tmediaSource.types.includes( type )\n\t\t);\n\n\t\trequestMediaPicker( mediaSource.id, types, multiple, ( media ) => {\n\t\t\tif ( ( multiple && media ) || ( media && media.id ) ) {\n\t\t\t\tonSelect( media );\n\t\t\t}\n\t\t} );\n\t}\n\n\trender() {\n\t\tconst { allowedTypes = [], isReplacingMedia, multiple } = this.props;\n\t\tconst isOneType = allowedTypes.length === 1;\n\t\tconst isImage = isOneType && allowedTypes.includes( MEDIA_TYPE_IMAGE );\n\t\tconst isVideo = isOneType && allowedTypes.includes( MEDIA_TYPE_VIDEO );\n\t\tconst isAudio = isOneType && allowedTypes.includes( MEDIA_TYPE_AUDIO );\n\t\tconst isAnyType = isOneType && allowedTypes.includes( MEDIA_TYPE_ANY );\n\n\t\tconst isImageOrVideo =\n\t\t\tallowedTypes.length === 2 &&\n\t\t\tallowedTypes.includes( MEDIA_TYPE_IMAGE ) &&\n\t\t\tallowedTypes.includes( MEDIA_TYPE_VIDEO );\n\n\t\tlet pickerTitle;\n\t\tif ( isImage ) {\n\t\t\tif ( isReplacingMedia ) {\n\t\t\t\tpickerTitle = __( 'Replace image' );\n\t\t\t} else {\n\t\t\t\tpickerTitle = multiple\n\t\t\t\t\t? __( 'Choose images' )\n\t\t\t\t\t: __( 'Choose image' );\n\t\t\t}\n\t\t} else if ( isVideo ) {\n\t\t\tif ( isReplacingMedia ) {\n\t\t\t\tpickerTitle = __( 'Replace video' );\n\t\t\t} else {\n\t\t\t\tpickerTitle = __( 'Choose video' );\n\t\t\t}\n\t\t} else if ( isImageOrVideo ) {\n\t\t\tif ( isReplacingMedia ) {\n\t\t\t\tpickerTitle = __( 'Replace image or video' );\n\t\t\t} else {\n\t\t\t\tpickerTitle = __( 'Choose image or video' );\n\t\t\t}\n\t\t} else if ( isAudio ) {\n\t\t\tif ( isReplacingMedia ) {\n\t\t\t\tpickerTitle = __( 'Replace audio' );\n\t\t\t} else {\n\t\t\t\tpickerTitle = __( 'Choose audio' );\n\t\t\t}\n\t\t} else if ( isAnyType ) {\n\t\t\tpickerTitle = __( 'Choose file' );\n\t\t\tif ( isReplacingMedia ) {\n\t\t\t\tpickerTitle = __( 'Replace file' );\n\t\t\t} else {\n\t\t\t\tpickerTitle = __( 'Choose file' );\n\t\t\t}\n\t\t}\n\n\t\tconst getMediaOptions = () => (\n\t\t\t<Picker\n\t\t\t\ttitle={ pickerTitle }\n\t\t\t\thideCancelButton\n\t\t\t\tref={ ( instance ) => ( this.picker = instance ) }\n\t\t\t\toptions={ this.getMediaOptionsItems() }\n\t\t\t\tonChange={ this.onPickerSelect }\n\t\t\t\ttestID=\"media-options-picker\"\n\t\t\t/>\n\t\t);\n\n\t\treturn this.props.render( {\n\t\t\topen: this.onPickerPresent,\n\t\t\tgetMediaOptions,\n\t\t} );\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tisAudioBlockMediaUploadEnabled:\n\t\t\t\tselect( blockEditorStore ).getSettings( 'capabilities' )\n\t\t\t\t\t.isAudioBlockMediaUploadEnabled === true,\n\t\t};\n\t} ),\n] )( MediaUpload );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/media-upload/index.native.js"],"names":["MEDIA_TYPE_IMAGE","MEDIA_TYPE_VIDEO","MEDIA_TYPE_AUDIO","MEDIA_TYPE_ANY","OPTION_TAKE_VIDEO","OPTION_TAKE_PHOTO","OPTION_TAKE_PHOTO_OR_VIDEO","OPTION_INSERT_FROM_URL","OPTION_WORDPRESS_MEDIA_LIBRARY","URL_MEDIA_SOURCE","PICKER_OPENING_DELAY","MediaUpload","Component","pickerTimeout","constructor","props","onPickerPresent","bind","onPickerSelect","getAllSources","state","otherMediaOptions","componentDidMount","allowedTypes","autoOpen","otherMediaOptionsWithIcons","map","option","requiresModal","types","id","value","setState","componentWillUnmount","clearTimeout","onSelectURL","cameraImageSource","mediaSources","deviceCamera","label","icon","capturePhoto","cameraVideoSource","captureVideo","deviceLibrarySource","deviceLibrary","image","siteLibrarySource","siteMediaLibrary","wordpress","mediaLibrary","urlSource","globe","internalSources","concat","getMediaOptionsItems","__experimentalOnlyMediaLibrary","isAudioBlockMediaUploadEnabled","filter","source","every","allowedType","includes","some","getChooseFromDeviceIcon","mobile","isIOS","Platform","OS","picker","setTimeout","presentPicker","onSelect","multiple","undefined","text","style","onPress","mediaSource","shift","type","media","render","isReplacingMedia","isOneType","length","isImage","isVideo","isAudio","isAnyType","isImageOrVideo","pickerTitle","getMediaOptions","instance","open","select","capabilities","blockEditorStore","getSettings"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAEA;;AAMA;;AACA;;AACA;;AAKA;;AAQA;;AACA;;AACA;;AA5BA;AACA;AACA;;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AACD;;AAED,UAAMC,eAAe,GAAG,MACvB,4BAAC,kBAAD;AACC,MAAA,KAAK,EAAGD,WADT;AAEC,MAAA,gBAAgB,MAFjB;AAGC,MAAA,GAAG,EAAKE,QAAF,IAAkB,KAAKxB,MAAL,GAAcwB,QAHvC;AAIC,MAAA,OAAO,EAAG,KAAKtC,oBAAL,EAJX;AAKC,MAAA,QAAQ,EAAG,KAAKrC,cALjB;AAMC,MAAA,MAAM,EAAC;AANR,MADD;;AAWA,WAAO,KAAKH,KAAL,CAAWmE,MAAX,CAAmB;AACzBY,MAAAA,IAAI,EAAE,KAAK9E,eADc;AAEzB4E,MAAAA;AAFyB,KAAnB,CAAP;AAIA;;AA3QyC;;;;eA8Q5B,sBAAS,CACvB,sBAAcG,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA;AAAF,MAAmBD,MAAM,CAAEE,kBAAF,CAAN,CAA2BC,WAA3B,EAAzB;AACA,SAAO;AACNzC,IAAAA,8BAA8B,EAC7B,CAAAuC,YAAY,SAAZ,IAAAA,YAAY,WAAZ,YAAAA,YAAY,CAAEvC,8BAAd,MAAiD;AAF5C,GAAP;AAIA,CAND,CADuB,CAAT,EAQV9C,WARU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform } from 'react-native';\n\nimport prompt from 'react-native-prompt-android';\n\n/**\n * WordPress dependencies\n */\nimport { Component, React } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Picker } from '@wordpress/components';\nimport {\n\tgetOtherMediaOptions,\n\trequestMediaPicker,\n\tmediaSources,\n} from '@wordpress/react-native-bridge';\nimport {\n\tcapturePhoto,\n\tcaptureVideo,\n\timage,\n\twordpress,\n\tmobile,\n\tglobe,\n} from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\nexport const MEDIA_TYPE_IMAGE = 'image';\nexport const MEDIA_TYPE_VIDEO = 'video';\nexport const MEDIA_TYPE_AUDIO = 'audio';\nexport const MEDIA_TYPE_ANY = 'any';\n\nexport const OPTION_TAKE_VIDEO = __( 'Take a Video' );\nexport const OPTION_TAKE_PHOTO = __( 'Take a Photo' );\nexport const OPTION_TAKE_PHOTO_OR_VIDEO = __( 'Take a Photo or Video' );\nexport const OPTION_INSERT_FROM_URL = __( 'Insert from URL' );\nexport const OPTION_WORDPRESS_MEDIA_LIBRARY = __( 'WordPress Media Library' );\n\nconst URL_MEDIA_SOURCE = 'URL';\n\nconst PICKER_OPENING_DELAY = 200;\n\nexport class MediaUpload extends Component {\n\tpickerTimeout;\n\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.onPickerPresent = this.onPickerPresent.bind( this );\n\t\tthis.onPickerSelect = this.onPickerSelect.bind( this );\n\t\tthis.getAllSources = this.getAllSources.bind( this );\n\t\tthis.state = {\n\t\t\totherMediaOptions: [],\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { allowedTypes = [], autoOpen } = this.props;\n\t\tgetOtherMediaOptions( allowedTypes, ( otherMediaOptions ) => {\n\t\t\tconst otherMediaOptionsWithIcons = otherMediaOptions.map(\n\t\t\t\t( option ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...option,\n\t\t\t\t\t\trequiresModal: true,\n\t\t\t\t\t\ttypes: allowedTypes,\n\t\t\t\t\t\tid: option.value,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tthis.setState( { otherMediaOptions: otherMediaOptionsWithIcons } );\n\t\t} );\n\n\t\tif ( autoOpen ) {\n\t\t\tthis.onPickerPresent();\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.pickerTimeout );\n\t}\n\n\tgetAllSources() {\n\t\tconst { onSelectURL } = this.props;\n\n\t\tconst cameraImageSource = {\n\t\t\tid: mediaSources.deviceCamera, // ID is the value sent to native.\n\t\t\tvalue: mediaSources.deviceCamera + '-IMAGE', // This is needed to diferenciate image-camera from video-camera sources.\n\t\t\tlabel: __( 'Take a Photo' ),\n\t\t\trequiresModal: true,\n\t\t\ttypes: [ MEDIA_TYPE_IMAGE ],\n\t\t\ticon: capturePhoto,\n\t\t};\n\n\t\tconst cameraVideoSource = {\n\t\t\tid: mediaSources.deviceCamera,\n\t\t\tvalue: mediaSources.deviceCamera,\n\t\t\tlabel: __( 'Take a Video' ),\n\t\t\trequiresModal: true,\n\t\t\ttypes: [ MEDIA_TYPE_VIDEO ],\n\t\t\ticon: captureVideo,\n\t\t};\n\n\t\tconst deviceLibrarySource = {\n\t\t\tid: mediaSources.deviceLibrary,\n\t\t\tvalue: mediaSources.deviceLibrary,\n\t\t\tlabel: __( 'Choose from device' ),\n\t\t\trequiresModal: true,\n\t\t\ttypes: [ MEDIA_TYPE_IMAGE, MEDIA_TYPE_VIDEO ],\n\t\t\ticon: image,\n\t\t};\n\n\t\tconst siteLibrarySource = {\n\t\t\tid: mediaSources.siteMediaLibrary,\n\t\t\tvalue: mediaSources.siteMediaLibrary,\n\t\t\tlabel: __( 'WordPress Media Library' ),\n\t\t\trequiresModal: true,\n\t\t\ttypes: [\n\t\t\t\tMEDIA_TYPE_IMAGE,\n\t\t\t\tMEDIA_TYPE_VIDEO,\n\t\t\t\tMEDIA_TYPE_AUDIO,\n\t\t\t\tMEDIA_TYPE_ANY,\n\t\t\t],\n\t\t\ticon: wordpress,\n\t\t\tmediaLibrary: true,\n\t\t};\n\n\t\tconst urlSource = {\n\t\t\tid: URL_MEDIA_SOURCE,\n\t\t\tvalue: URL_MEDIA_SOURCE,\n\t\t\tlabel: __( 'Insert from URL' ),\n\t\t\ttypes: [ MEDIA_TYPE_AUDIO, MEDIA_TYPE_IMAGE, MEDIA_TYPE_VIDEO ],\n\t\t\ticon: globe,\n\t\t};\n\n\t\t// Only include `urlSource` option if `onSelectURL` prop is present, in order to match the web behavior.\n\t\tconst internalSources = [\n\t\t\tdeviceLibrarySource,\n\t\t\tcameraImageSource,\n\t\t\tcameraVideoSource,\n\t\t\tsiteLibrarySource,\n\t\t\t...( onSelectURL ? [ urlSource ] : [] ),\n\t\t];\n\n\t\treturn internalSources.concat( this.state.otherMediaOptions );\n\t}\n\n\tgetMediaOptionsItems() {\n\t\tconst {\n\t\t\tallowedTypes = [],\n\t\t\t__experimentalOnlyMediaLibrary,\n\t\t\tisAudioBlockMediaUploadEnabled,\n\t\t} = this.props;\n\n\t\treturn this.getAllSources()\n\t\t\t.filter( ( source ) => {\n\t\t\t\tif ( __experimentalOnlyMediaLibrary ) {\n\t\t\t\t\treturn source.mediaLibrary;\n\t\t\t\t} else if (\n\t\t\t\t\tallowedTypes.every(\n\t\t\t\t\t\t( allowedType ) =>\n\t\t\t\t\t\t\tallowedType === MEDIA_TYPE_AUDIO &&\n\t\t\t\t\t\t\tsource.types.includes( allowedType )\n\t\t\t\t\t) &&\n\t\t\t\t\tsource.id !== URL_MEDIA_SOURCE\n\t\t\t\t) {\n\t\t\t\t\treturn isAudioBlockMediaUploadEnabled === true;\n\t\t\t\t}\n\n\t\t\t\treturn allowedTypes.some( ( allowedType ) =>\n\t\t\t\t\tsource.types.includes( allowedType )\n\t\t\t\t);\n\t\t\t} )\n\t\t\t.map( ( source ) => {\n\t\t\t\treturn {\n\t\t\t\t\t...source,\n\t\t\t\t\ticon: source.icon || this.getChooseFromDeviceIcon(),\n\t\t\t\t};\n\t\t\t} );\n\t}\n\n\tgetChooseFromDeviceIcon() {\n\t\treturn mobile;\n\t}\n\n\tonPickerPresent() {\n\t\tconst { autoOpen } = this.props;\n\t\tconst isIOS = Platform.OS === 'ios';\n\n\t\tif ( this.picker ) {\n\t\t\t// the delay below is required because on iOS this action sheet gets dismissed by the close event of the Inserter\n\t\t\t// so this delay allows the Inserter to be closed fully before presenting action sheet.\n\t\t\tif ( autoOpen && isIOS ) {\n\t\t\t\tthis.pickerTimeout = setTimeout(\n\t\t\t\t\t() => this.picker.presentPicker(),\n\t\t\t\t\tPICKER_OPENING_DELAY\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.picker.presentPicker();\n\t\t\t}\n\t\t}\n\t}\n\n\tonPickerSelect( value ) {\n\t\tconst {\n\t\t\tallowedTypes = [],\n\t\t\tonSelect,\n\t\t\tonSelectURL,\n\t\t\tmultiple = false,\n\t\t} = this.props;\n\n\t\tif ( value === URL_MEDIA_SOURCE ) {\n\t\t\tprompt(\n\t\t\t\t__( 'Type a URL' ), // title\n\t\t\t\tundefined, // message\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: __( 'Cancel' ),\n\t\t\t\t\t\tstyle: 'cancel',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: __( 'Apply' ),\n\t\t\t\t\t\tonPress: onSelectURL,\n\t\t\t\t\t},\n\t\t\t\t], // Buttons.\n\t\t\t\t'plain-text', // type\n\t\t\t\tundefined, // defaultValue\n\t\t\t\t'url' // keyboardType\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst mediaSource = this.getAllSources()\n\t\t\t.filter( ( source ) => source.value === value )\n\t\t\t.shift();\n\t\tconst types = allowedTypes.filter( ( type ) =>\n\t\t\tmediaSource.types.includes( type )\n\t\t);\n\n\t\trequestMediaPicker( mediaSource.id, types, multiple, ( media ) => {\n\t\t\tif ( ( multiple && media ) || ( media && media.id ) ) {\n\t\t\t\tonSelect( media );\n\t\t\t}\n\t\t} );\n\t}\n\n\trender() {\n\t\tconst { allowedTypes = [], isReplacingMedia, multiple } = this.props;\n\t\tconst isOneType = allowedTypes.length === 1;\n\t\tconst isImage = isOneType && allowedTypes.includes( MEDIA_TYPE_IMAGE );\n\t\tconst isVideo = isOneType && allowedTypes.includes( MEDIA_TYPE_VIDEO );\n\t\tconst isAudio = isOneType && allowedTypes.includes( MEDIA_TYPE_AUDIO );\n\t\tconst isAnyType = isOneType && allowedTypes.includes( MEDIA_TYPE_ANY );\n\n\t\tconst isImageOrVideo =\n\t\t\tallowedTypes.length === 2 &&\n\t\t\tallowedTypes.includes( MEDIA_TYPE_IMAGE ) &&\n\t\t\tallowedTypes.includes( MEDIA_TYPE_VIDEO );\n\n\t\tlet pickerTitle;\n\t\tif ( isImage ) {\n\t\t\tif ( isReplacingMedia ) {\n\t\t\t\tpickerTitle = __( 'Replace image' );\n\t\t\t} else {\n\t\t\t\tpickerTitle = multiple\n\t\t\t\t\t? __( 'Choose images' )\n\t\t\t\t\t: __( 'Choose image' );\n\t\t\t}\n\t\t} else if ( isVideo ) {\n\t\t\tif ( isReplacingMedia ) {\n\t\t\t\tpickerTitle = __( 'Replace video' );\n\t\t\t} else {\n\t\t\t\tpickerTitle = __( 'Choose video' );\n\t\t\t}\n\t\t} else if ( isImageOrVideo ) {\n\t\t\tif ( isReplacingMedia ) {\n\t\t\t\tpickerTitle = __( 'Replace image or video' );\n\t\t\t} else {\n\t\t\t\tpickerTitle = __( 'Choose image or video' );\n\t\t\t}\n\t\t} else if ( isAudio ) {\n\t\t\tif ( isReplacingMedia ) {\n\t\t\t\tpickerTitle = __( 'Replace audio' );\n\t\t\t} else {\n\t\t\t\tpickerTitle = __( 'Choose audio' );\n\t\t\t}\n\t\t} else if ( isAnyType ) {\n\t\t\tpickerTitle = __( 'Choose file' );\n\t\t\tif ( isReplacingMedia ) {\n\t\t\t\tpickerTitle = __( 'Replace file' );\n\t\t\t} else {\n\t\t\t\tpickerTitle = __( 'Choose file' );\n\t\t\t}\n\t\t}\n\n\t\tconst getMediaOptions = () => (\n\t\t\t<Picker\n\t\t\t\ttitle={ pickerTitle }\n\t\t\t\thideCancelButton\n\t\t\t\tref={ ( instance ) => ( this.picker = instance ) }\n\t\t\t\toptions={ this.getMediaOptionsItems() }\n\t\t\t\tonChange={ this.onPickerSelect }\n\t\t\t\ttestID=\"media-options-picker\"\n\t\t\t/>\n\t\t);\n\n\t\treturn this.props.render( {\n\t\t\topen: this.onPickerPresent,\n\t\t\tgetMediaOptions,\n\t\t} );\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { capabilities } = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tisAudioBlockMediaUploadEnabled:\n\t\t\t\tcapabilities?.isAudioBlockMediaUploadEnabled === true,\n\t\t};\n\t} ),\n] )( MediaUpload );\n"]}
@@ -11,10 +11,18 @@ var _element = require("@wordpress/element");
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
+ var _compose = require("@wordpress/compose");
15
+
16
+ var _a11y = require("@wordpress/a11y");
17
+
14
18
  var _data = require("@wordpress/data");
15
19
 
20
+ var _i18n = require("@wordpress/i18n");
21
+
16
22
  var _store = require("../../store");
17
23
 
24
+ var _useBlockDisplayTitle = _interopRequireDefault(require("../block-title/use-block-display-title"));
25
+
18
26
  var _inserter = _interopRequireDefault(require("../inserter"));
19
27
 
20
28
  /**
@@ -24,7 +32,14 @@ var _inserter = _interopRequireDefault(require("../inserter"));
24
32
  /**
25
33
  * Internal dependencies
26
34
  */
27
- const Appender = (0, _element.forwardRef)((props, ref) => {
35
+ const Appender = (0, _element.forwardRef)((_ref, ref) => {
36
+ let {
37
+ nestingLevel,
38
+ blockCount,
39
+ ...props
40
+ } = _ref;
41
+ const [insertedBlock, setInsertedBlock] = (0, _element.useState)(null);
42
+ const instanceId = (0, _compose.useInstanceId)(Appender);
28
43
  const {
29
44
  hideInserter,
30
45
  clientId
@@ -42,13 +57,33 @@ const Appender = (0, _element.forwardRef)((props, ref) => {
42
57
  hideInserter: !!getTemplateLock(_clientId) || __unstableGetEditorMode() === 'zoom-out'
43
58
  };
44
59
  }, []);
60
+ const blockTitle = (0, _useBlockDisplayTitle.default)({
61
+ clientId,
62
+ context: 'list-view'
63
+ });
64
+ const insertedBlockTitle = (0, _useBlockDisplayTitle.default)({
65
+ clientId: insertedBlock === null || insertedBlock === void 0 ? void 0 : insertedBlock.clientId,
66
+ context: 'list-view'
67
+ });
68
+ (0, _element.useEffect)(() => {
69
+ if (!(insertedBlockTitle !== null && insertedBlockTitle !== void 0 && insertedBlockTitle.length)) {
70
+ return;
71
+ }
72
+
73
+ (0, _a11y.speak)((0, _i18n.sprintf)( // translators: %s: name of block being inserted (i.e. Paragraph, Image, Group etc)
74
+ (0, _i18n.__)('%s block inserted'), insertedBlockTitle), 'assertive');
75
+ }, [insertedBlockTitle]);
45
76
 
46
77
  if (hideInserter) {
47
78
  return null;
48
79
  }
49
80
 
81
+ const descriptionId = `off-canvas-editor-appender__${instanceId}`;
82
+ const description = (0, _i18n.sprintf)(
83
+ /* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */
84
+ (0, _i18n.__)('Append to %1$s block at position %2$d, Level %3$d'), blockTitle, blockCount + 1, nestingLevel);
50
85
  return (0, _element.createElement)("div", {
51
- className: "offcanvas-editor__appender"
86
+ className: "offcanvas-editor-appender"
52
87
  }, (0, _element.createElement)(_inserter.default, (0, _extends2.default)({
53
88
  ref: ref,
54
89
  rootClientId: clientId,
@@ -57,7 +92,19 @@ const Appender = (0, _element.forwardRef)((props, ref) => {
57
92
  selectBlockOnInsert: false,
58
93
  shouldDirectInsert: false,
59
94
  __experimentalIsQuick: true
60
- }, props)));
95
+ }, props, {
96
+ toggleProps: {
97
+ 'aria-describedby': descriptionId
98
+ },
99
+ onSelectOrClose: maybeInsertedBlock => {
100
+ if (maybeInsertedBlock !== null && maybeInsertedBlock !== void 0 && maybeInsertedBlock.clientId) {
101
+ setInsertedBlock(maybeInsertedBlock);
102
+ }
103
+ }
104
+ })), (0, _element.createElement)("div", {
105
+ className: "offcanvas-editor-appender__description",
106
+ id: descriptionId
107
+ }, description));
61
108
  });
62
109
  exports.Appender = Appender;
63
110
  //# sourceMappingURL=appender.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/appender.js"],"names":["Appender","props","ref","hideInserter","clientId","select","getTemplateLock","__unstableGetEditorMode","getSelectedBlockClientId","blockEditorStore","_clientId"],"mappings":";;;;;;;;;AAIA;;;;AADA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIO,MAAMA,QAAQ,GAAG,yBAAY,CAAEC,KAAF,EAASC,GAAT,KAAkB;AACrD,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAA6B,qBAAaC,MAAF,IAAc;AAC3D,UAAM;AACLC,MAAAA,eADK;AAELC,MAAAA,uBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEI,YAAF,CAJV;;AAMA,UAAMC,SAAS,GAAGF,wBAAwB,EAA1C;;AAEA,WAAO;AACNJ,MAAAA,QAAQ,EAAEI,wBAAwB,EAD5B;AAENL,MAAAA,YAAY,EACX,CAAC,CAAEG,eAAe,CAAEI,SAAF,CAAlB,IACAH,uBAAuB,OAAO;AAJzB,KAAP;AAMA,GAfkC,EAehC,EAfgC,CAAnC;;AAiBA,MAAKJ,YAAL,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,iBAAD;AACC,IAAA,GAAG,EAAGD,GADP;AAEC,IAAA,YAAY,EAAGE,QAFhB;AAGC,IAAA,QAAQ,EAAC,cAHV;AAIC,IAAA,UAAU,EAAG,IAJd;AAKC,IAAA,mBAAmB,EAAG,KALvB;AAMC,IAAA,kBAAkB,EAAG,KANtB;AAOC,IAAA,qBAAqB;AAPtB,KAQMH,KARN,EADD,CADD;AAcA,CApCuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport Inserter from '../inserter';\n\nexport const Appender = forwardRef( ( props, ref ) => {\n\tconst { hideInserter, clientId } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetTemplateLock,\n\t\t\t__unstableGetEditorMode,\n\t\t\tgetSelectedBlockClientId,\n\t\t} = select( blockEditorStore );\n\n\t\tconst _clientId = getSelectedBlockClientId();\n\n\t\treturn {\n\t\t\tclientId: getSelectedBlockClientId(),\n\t\t\thideInserter:\n\t\t\t\t!! getTemplateLock( _clientId ) ||\n\t\t\t\t__unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tif ( hideInserter ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"offcanvas-editor__appender\">\n\t\t\t<Inserter\n\t\t\t\tref={ ref }\n\t\t\t\trootClientId={ clientId }\n\t\t\t\tposition=\"bottom right\"\n\t\t\t\tisAppender={ true }\n\t\t\t\tselectBlockOnInsert={ false }\n\t\t\t\tshouldDirectInsert={ false }\n\t\t\t\t__experimentalIsQuick\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</div>\n\t);\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/appender.js"],"names":["Appender","ref","nestingLevel","blockCount","props","insertedBlock","setInsertedBlock","instanceId","hideInserter","clientId","select","getTemplateLock","__unstableGetEditorMode","getSelectedBlockClientId","blockEditorStore","_clientId","blockTitle","context","insertedBlockTitle","length","descriptionId","description","maybeInsertedBlock"],"mappings":";;;;;;;;;AAMA;;;;AAHA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AAdA;AACA;AACA;;AAOA;AACA;AACA;AAKO,MAAMA,QAAQ,GAAG,yBACvB,OAA0CC,GAA1C,KAAmD;AAAA,MAAjD;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,UAAhB;AAA4B,OAAGC;AAA/B,GAAiD;AAClD,QAAM,CAAEC,aAAF,EAAiBC,gBAAjB,IAAsC,uBAAU,IAAV,CAA5C;AAEA,QAAMC,UAAU,GAAG,4BAAeP,QAAf,CAAnB;AACA,QAAM;AAAEQ,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAA6B,qBAAaC,MAAF,IAAc;AAC3D,UAAM;AACLC,MAAAA,eADK;AAELC,MAAAA,uBAFK;AAGLC,MAAAA;A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;AAOC,IAAA,qBAAqB;AAPtB,KAQML,KARN;AASC,IAAA,WAAW,EAAG;AAAE,0BAAoBgB;AAAtB,KATf;AAUC,IAAA,eAAe,EAAKE,kBAAF,IAA0B;AAC3C,UAAKA,kBAAL,aAAKA,kBAAL,eAAKA,kBAAkB,CAAEb,QAAzB,EAAoC;AACnCH,QAAAA,gBAAgB,CAAEgB,kBAAF,CAAhB;AACA;AACD;AAdF,KADD,EAiBC;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,EAAE,EAAGF;AAFN,KAIGC,WAJH,CAjBD,CADD;AA0BA,CAtFsB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef, useState, useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport Inserter from '../inserter';\n\nexport const Appender = forwardRef(\n\t( { nestingLevel, blockCount, ...props }, ref ) => {\n\t\tconst [ insertedBlock, setInsertedBlock ] = useState( null );\n\n\t\tconst instanceId = useInstanceId( Appender );\n\t\tconst { hideInserter, clientId } = useSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetTemplateLock,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _clientId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tclientId: getSelectedBlockClientId(),\n\t\t\t\thideInserter:\n\t\t\t\t\t!! getTemplateLock( _clientId ) ||\n\t\t\t\t\t__unstableGetEditorMode() === 'zoom-out',\n\t\t\t};\n\t\t}, [] );\n\n\t\tconst blockTitle = useBlockDisplayTitle( {\n\t\t\tclientId,\n\t\t\tcontext: 'list-view',\n\t\t} );\n\n\t\tconst insertedBlockTitle = useBlockDisplayTitle( {\n\t\t\tclientId: insertedBlock?.clientId,\n\t\t\tcontext: 'list-view',\n\t\t} );\n\n\t\tuseEffect( () => {\n\t\t\tif ( ! insertedBlockTitle?.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tspeak(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: name of block being inserted (i.e. Paragraph, Image, Group etc)\n\t\t\t\t\t__( '%s block inserted' ),\n\t\t\t\t\tinsertedBlockTitle\n\t\t\t\t),\n\t\t\t\t'assertive'\n\t\t\t);\n\t\t}, [ insertedBlockTitle ] );\n\n\t\tif ( hideInserter ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst descriptionId = `off-canvas-editor-appender__${ instanceId }`;\n\t\tconst description = sprintf(\n\t\t\t/* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */\n\t\t\t__( 'Append to %1$s block at position %2$d, Level %3$d' ),\n\t\t\tblockTitle,\n\t\t\tblockCount + 1,\n\t\t\tnestingLevel\n\t\t);\n\n\t\treturn (\n\t\t\t<div className=\"offcanvas-editor-appender\">\n\t\t\t\t<Inserter\n\t\t\t\t\tref={ ref }\n\t\t\t\t\trootClientId={ clientId }\n\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\tisAppender={ true }\n\t\t\t\t\tselectBlockOnInsert={ false }\n\t\t\t\t\tshouldDirectInsert={ false }\n\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t{ ...props }\n\t\t\t\t\ttoggleProps={ { 'aria-describedby': descriptionId } }\n\t\t\t\t\tonSelectOrClose={ ( maybeInsertedBlock ) => {\n\t\t\t\t\t\tif ( maybeInsertedBlock?.clientId ) {\n\t\t\t\t\t\t\tsetInsertedBlock( maybeInsertedBlock );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"offcanvas-editor-appender__description\"\n\t\t\t\t\tid={ descriptionId }\n\t\t\t\t>\n\t\t\t\t\t{ description }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n);\n"]}
@@ -17,6 +17,8 @@ var _icons = require("@wordpress/icons");
17
17
 
18
18
  var _keycodes = require("@wordpress/keycodes");
19
19
 
20
+ var _i18n = require("@wordpress/i18n");
21
+
20
22
  var _blockIcon = _interopRequireDefault(require("../block-icon"));
21
23
 
22
24
  var _useBlockDisplayInformation = _interopRequireDefault(require("../use-block-display-information"));
@@ -41,9 +43,7 @@ var _blockLock = require("../block-lock");
41
43
  function ListViewBlockSelectButton(_ref, ref) {
42
44
  let {
43
45
  className,
44
- block: {
45
- clientId
46
- },
46
+ block,
47
47
  onClick,
48
48
  onToggleExpanded,
49
49
  tabIndex,
@@ -52,6 +52,9 @@ function ListViewBlockSelectButton(_ref, ref) {
52
52
  onDragEnd,
53
53
  draggable
54
54
  } = _ref;
55
+ const {
56
+ clientId
57
+ } = block;
55
58
  const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
56
59
  const blockTitle = (0, _useBlockDisplayTitle.default)({
57
60
  clientId,
@@ -75,6 +78,8 @@ function ListViewBlockSelectButton(_ref, ref) {
75
78
  }
76
79
  }
77
80
 
81
+ const editAriaLabel = blockInformation ? (0, _i18n.sprintf)( // translators: %s: The title of the block.
82
+ (0, _i18n.__)('Edit %s block'), blockInformation.title) : (0, _i18n.__)('Edit');
78
83
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.Button, {
79
84
  className: (0, _classnames.default)('block-editor-list-view-block-select-button', className),
80
85
  onClick: onClick,
@@ -86,7 +91,8 @@ function ListViewBlockSelectButton(_ref, ref) {
86
91
  onDragEnd: onDragEnd,
87
92
  draggable: draggable,
88
93
  href: `#block-${clientId}`,
89
- "aria-hidden": true
94
+ "aria-hidden": true,
95
+ title: editAriaLabel
90
96
  }, (0, _element.createElement)(_expander.default, {
91
97
  onClick: onToggleExpanded
92
98
  }), (0, _element.createElement)(_blockIcon.default, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/block-select-button.js"],"names":["ListViewBlockSelectButton","ref","className","block","clientId","onClick","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","blockInformation","blockTitle","context","isLocked","onDragStartHandler","event","dataTransfer","clearData","onKeyDownHandler","keyCode","ENTER","SPACE","icon","anchor","lock"],"mappings":";;;;;;;;;AAaA;;AAVA;;AAKA;;AAMA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAOA,SAASA,yBAAT,OAYCC,GAZD,EAaE;AAAA,MAZD;AACCC,IAAAA,SADD;AAECC,IAAAA,KAAK,EAAE;AAAEC,MAAAA;AAAF,KAFR;AAGCC,IAAAA,OAHD;AAICC,IAAAA,gBAJD;AAKCC,IAAAA,QALD;AAMCC,IAAAA,OAND;AAOCC,IAAAA,WAPD;AAQCC,IAAAA,SARD;AASCC,IAAAA;AATD,GAYC;AACD,QAAMC,gBAAgB,GAAG,yCAA4BR,QAA5B,CAAzB;AACA,QAAMS,UAAU,GAAG,mCAAsB;AACxCT,IAAAA,QADwC;AAExCU,IAAAA,OAAO,EAAE;AAF+B,GAAtB,CAAnB;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAe,6BAAcX,QAAd,CAArB,CANC,CAQD;AACA;AACA;AACA;;AACA,QAAMY,kBAAkB,GAAKC,KAAF,IAAa;AACvCA,IAAAA,KAAK,CAACC,YAAN,CAAmBC,SAAnB;AACAV,IAAAA,WAAW,SAAX,IAAAA,WAAW,WAAX,YAAAA,WAAW,CAAIQ,KAAJ,CAAX;AACA,GAHD;;AAKA,WAASG,gBAAT,CAA2BH,KAA3B,EAAmC;AAClC,QAAKA,KAAK,CAACI,OAAN,KAAkBC,eAAlB,IAA2BL,KAAK,CAACI,OAAN,KAAkBE,eAAlD,EAA0D;AACzDlB,MAAAA,OAAO,CAAEY,KAAF,CA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BF,CAtBD,CADD,CADD;AAoDA;;eAEc,yBAAY1B,yBAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock } from '@wordpress/icons';\nimport { SPACE, ENTER } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock: { clientId },\n\t\tonClick,\n\t\tonToggleExpanded,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t},\n\tref\n) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst { isLocked } = useBlockLock( clientId );\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart?.( event );\n\t};\n\n\tfunction onKeyDownHandler( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonKeyDown={ onKeyDownHandler }\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tonDragStart={ onDragStartHandler }\n\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\tdraggable={ draggable }\n\t\t\t\thref={ `#block-${ clientId }` }\n\t\t\t\taria-hidden={ true }\n\t\t\t>\n\t\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\t\tshowColors\n\t\t\t\t\tcontext=\"list-view\"\n\t\t\t\t/>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__label-wrapper\"\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tspacing={ 1 }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__title\">\n\t\t\t\t\t\t<Truncate ellipsizeMode=\"auto\">{ blockTitle }</Truncate>\n\t\t\t\t\t</span>\n\t\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor-wrapper\">\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__anchor\"\n\t\t\t\t\t\t\t\tellipsizeMode=\"auto\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isLocked && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__lock\">\n\t\t\t\t\t\t\t<Icon icon={ lock } />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSelectButton );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/block-select-button.js"],"names":["ListViewBlockSelectButton","ref","className","block","onClick","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","clientId","blockInformation","blockTitle","context","isLocked","onDragStartHandler","event","dataTransfer","clearData","onKeyDownHandler","keyCode","ENTER","SPACE","editAriaLabel","title","icon","anchor","lock"],"mappings":";;;;;;;;;AAaA;;AAVA;;AAKA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;AAOA,SAASA,yBAAT,OAYCC,GAZD,EAaE;AAAA,MAZD;AACCC,IAAAA,SADD;AAECC,IAAAA,KAFD;AAGCC,IAAAA,OAHD;AAICC,IAAAA,gBAJD;AAKCC,IAAAA,QALD;AAMCC,IAAAA,OAND;AAOCC,IAAAA,WAPD;AAQCC,IAAAA,SARD;AASCC,IAAAA;AATD,GAYC;AACD,QAAM;AAAEC,IAAAA;AAAF,MAAeR,KAArB;AACA,QAAMS,gBAAgB,GAAG,yCAA4BD,QAA5B,CAAzB;AACA,QAAME,UAAU,GAAG,mCAAsB;AACxCF,IAAAA,QADwC;AAExCG,IAAAA,OAAO,EAAE;AAF+B,GAAtB,CAAnB;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAe,6BAAcJ,QAAd,CAArB,CAPC,CASD;AACA;AACA;AACA;;AACA,QAAMK,kBAAkB,GAAKC,KAAF,IAAa;AACvCA,IAAAA,KAAK,CAACC,YAAN,CAAmBC,SAAnB;AACAX,IAAAA,WAAW,SAAX,IAAAA,WAAW,WAAX,YAAAA,WAAW,CAAIS,KAAJ,CAAX;AACA,GAHD;;AAKA,WAASG,gBAAT,CAA2BH,KAA3B,EAAmC;AAClC,QAAKA,KAAK,CAACI,OAAN,KAAkBC,eAAlB,IAA2BL,KAAK,CAACI,OAAN,KAAkBE,eAAlD,EAA0D;AACzDnB,MAAAA,OAAO,CA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X;AAEC,IAAA,aAAa,EAAC;AAFf,KAIGf,gBAAgB,CAACe,MAJpB,CADD,CAVF,EAmBGZ,QAAQ,IACT;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGa;AAAb,IADD,CApBF,CAvBD,CADD,CADD;AAqDA;;eAEc,yBAAY5B,yBAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock } from '@wordpress/icons';\nimport { SPACE, ENTER } from '@wordpress/keycodes';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock,\n\t\tonClick,\n\t\tonToggleExpanded,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t},\n\tref\n) {\n\tconst { clientId } = block;\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst { isLocked } = useBlockLock( clientId );\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart?.( event );\n\t};\n\n\tfunction onKeyDownHandler( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\tconst editAriaLabel = blockInformation\n\t\t? sprintf(\n\t\t\t\t// translators: %s: The title of the block.\n\t\t\t\t__( 'Edit %s block' ),\n\t\t\t\tblockInformation.title\n\t\t )\n\t\t: __( 'Edit' );\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonKeyDown={ onKeyDownHandler }\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tonDragStart={ onDragStartHandler }\n\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\tdraggable={ draggable }\n\t\t\t\thref={ `#block-${ clientId }` }\n\t\t\t\taria-hidden={ true }\n\t\t\t\ttitle={ editAriaLabel }\n\t\t\t>\n\t\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\t\tshowColors\n\t\t\t\t\tcontext=\"list-view\"\n\t\t\t\t/>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__label-wrapper\"\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tspacing={ 1 }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__title\">\n\t\t\t\t\t\t<Truncate ellipsizeMode=\"auto\">{ blockTitle }</Truncate>\n\t\t\t\t\t</span>\n\t\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor-wrapper\">\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__anchor\"\n\t\t\t\t\t\t\t\tellipsizeMode=\"auto\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isLocked && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__lock\">\n\t\t\t\t\t\t\t<Icon icon={ lock } />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSelectButton );\n"]}