@wordpress/block-editor 10.5.0 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (716) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +2 -1
  3. package/build/autocompleters/block.js +2 -6
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/autocompleters/link.js +2 -0
  6. package/build/autocompleters/link.js.map +1 -1
  7. package/build/components/alignment-control/ui.js +1 -7
  8. package/build/components/alignment-control/ui.js.map +1 -1
  9. package/build/components/block-alignment-control/use-available-alignments.js +4 -3
  10. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  11. package/build/components/block-card/index.js +51 -3
  12. package/build/components/block-card/index.js.map +1 -1
  13. package/build/components/block-draggable/index.native.js +46 -39
  14. package/build/components/block-draggable/index.native.js.map +1 -1
  15. package/build/components/block-edit/edit.js +4 -3
  16. package/build/components/block-edit/edit.js.map +1 -1
  17. package/build/components/block-edit/edit.native.js +4 -7
  18. package/build/components/block-edit/edit.native.js.map +1 -1
  19. package/build/components/block-icon/index.js +4 -2
  20. package/build/components/block-icon/index.js.map +1 -1
  21. package/build/components/block-inspector/index.js +90 -37
  22. package/build/components/block-inspector/index.js.map +1 -1
  23. package/build/components/block-list/block-list-context.native.js +5 -8
  24. package/build/components/block-list/block-list-context.native.js.map +1 -1
  25. package/build/components/block-list/block.js +55 -24
  26. package/build/components/block-list/block.js.map +1 -1
  27. package/build/components/block-list/block.native.js +61 -28
  28. package/build/components/block-list/block.native.js.map +1 -1
  29. package/build/components/block-list-appender/index.js +46 -34
  30. package/build/components/block-list-appender/index.js.map +1 -1
  31. package/build/components/block-list-appender/index.native.js +39 -34
  32. package/build/components/block-list-appender/index.native.js.map +1 -1
  33. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +30 -22
  34. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  35. package/build/components/block-mobile-toolbar/index.native.js +1 -1
  36. package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
  37. package/build/components/block-pattern-setup/index.js +16 -8
  38. package/build/components/block-pattern-setup/index.js.map +1 -1
  39. package/build/components/block-patterns-list/index.js +33 -11
  40. package/build/components/block-patterns-list/index.js.map +1 -1
  41. package/build/components/block-preview/auto.js +9 -3
  42. package/build/components/block-preview/auto.js.map +1 -1
  43. package/build/components/block-preview/index.js +5 -9
  44. package/build/components/block-preview/index.js.map +1 -1
  45. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
  46. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  47. package/build/components/block-styles/index.native.js +1 -3
  48. package/build/components/block-styles/index.native.js.map +1 -1
  49. package/build/components/block-styles/utils.js +7 -10
  50. package/build/components/block-styles/utils.js.map +1 -1
  51. package/build/components/block-toolbar/index.js +5 -1
  52. package/build/components/block-toolbar/index.js.map +1 -1
  53. package/build/components/block-toolbar/index.native.js +6 -8
  54. package/build/components/block-toolbar/index.native.js.map +1 -1
  55. package/build/components/block-tools/insertion-point.js +8 -49
  56. package/build/components/block-tools/insertion-point.js.map +1 -1
  57. package/build/components/block-tools/selected-block-popover.js +1 -3
  58. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  59. package/build/components/block-variation-picker/index.js +2 -3
  60. package/build/components/block-variation-picker/index.js.map +1 -1
  61. package/build/components/colors/utils.js +2 -6
  62. package/build/components/colors/utils.js.map +1 -1
  63. package/build/components/colors-gradients/control.js +0 -3
  64. package/build/components/colors-gradients/control.js.map +1 -1
  65. package/build/components/colors-gradients/dropdown.js +0 -2
  66. package/build/components/colors-gradients/dropdown.js.map +1 -1
  67. package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
  68. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  69. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
  70. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  71. package/build/components/copy-handler/index.js +37 -9
  72. package/build/components/copy-handler/index.js.map +1 -1
  73. package/build/components/font-sizes/fluid-utils.js +5 -2
  74. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  75. package/build/components/font-sizes/utils.js +10 -4
  76. package/build/components/font-sizes/utils.js.map +1 -1
  77. package/build/components/font-sizes/with-font-sizes.js +11 -6
  78. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  79. package/build/components/gradients/use-gradient.js +2 -8
  80. package/build/components/gradients/use-gradient.js.map +1 -1
  81. package/build/components/height-control/index.js +115 -0
  82. package/build/components/height-control/index.js.map +1 -0
  83. package/build/components/iframe/index.js +22 -101
  84. package/build/components/iframe/index.js.map +1 -1
  85. package/build/components/iframe/use-compatibility-styles.js +93 -0
  86. package/build/components/iframe/use-compatibility-styles.js.map +1 -0
  87. package/build/components/image-editor/use-save-image.js +2 -0
  88. package/build/components/image-editor/use-save-image.js.map +1 -1
  89. package/build/components/image-editor/zoom-dropdown.js +1 -0
  90. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  91. package/build/components/index.js +9 -0
  92. package/build/components/index.js.map +1 -1
  93. package/build/components/inner-blocks/index.js +25 -7
  94. package/build/components/inner-blocks/index.js.map +1 -1
  95. package/build/components/inner-blocks/use-inner-block-template-sync.js +25 -10
  96. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  97. package/build/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  98. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  99. package/build/components/inserter/block-patterns-tab.js +25 -46
  100. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  101. package/build/components/inserter/block-types-tab.js +3 -1
  102. package/build/components/inserter/block-types-tab.js.map +1 -1
  103. package/build/components/inserter/hooks/use-debounced-input.js +27 -0
  104. package/build/components/inserter/hooks/use-debounced-input.js.map +1 -0
  105. package/build/components/inserter/hooks/use-insertion-point.js +4 -3
  106. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  107. package/build/components/inserter/index.js +20 -6
  108. package/build/components/inserter/index.js.map +1 -1
  109. package/build/components/inserter/index.native.js +3 -4
  110. package/build/components/inserter/index.native.js.map +1 -1
  111. package/build/components/inserter/media-tab/hooks.js +106 -0
  112. package/build/components/inserter/media-tab/hooks.js.map +1 -0
  113. package/build/components/inserter/media-tab/index.js +32 -0
  114. package/build/components/inserter/media-tab/index.js.map +1 -0
  115. package/build/components/inserter/media-tab/media-list.js +100 -0
  116. package/build/components/inserter/media-tab/media-list.js.map +1 -0
  117. package/build/components/inserter/media-tab/media-panel.js +96 -0
  118. package/build/components/inserter/media-tab/media-panel.js.map +1 -0
  119. package/build/components/inserter/media-tab/media-tab.js +120 -0
  120. package/build/components/inserter/media-tab/media-tab.js.map +1 -0
  121. package/build/components/inserter/media-tab/utils.js +54 -0
  122. package/build/components/inserter/media-tab/utils.js.map +1 -0
  123. package/build/components/inserter/menu.js +35 -12
  124. package/build/components/inserter/menu.js.map +1 -1
  125. package/build/components/inserter/mobile-tab-navigation.js +70 -0
  126. package/build/components/inserter/mobile-tab-navigation.js.map +1 -0
  127. package/build/components/inserter/quick-inserter.js +7 -3
  128. package/build/components/inserter/quick-inserter.js.map +1 -1
  129. package/build/components/inserter/search-items.js +15 -14
  130. package/build/components/inserter/search-items.js.map +1 -1
  131. package/build/components/inserter/search-results.js +7 -3
  132. package/build/components/inserter/search-results.js.map +1 -1
  133. package/build/components/inserter/tabs.js +16 -2
  134. package/build/components/inserter/tabs.js.map +1 -1
  135. package/build/components/inserter-list-item/index.js +4 -1
  136. package/build/components/inserter-list-item/index.js.map +1 -1
  137. package/build/components/inspector-controls/groups.js +2 -0
  138. package/build/components/inspector-controls/groups.js.map +1 -1
  139. package/build/components/inspector-controls-tabs/advanced-controls-panel.js +46 -0
  140. package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
  141. package/build/components/inspector-controls-tabs/index.js +71 -0
  142. package/build/components/inspector-controls-tabs/index.js.map +1 -0
  143. package/build/components/inspector-controls-tabs/settings-tab.js +28 -0
  144. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -0
  145. package/build/components/inspector-controls-tabs/styles-tab.js +61 -0
  146. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -0
  147. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +97 -0
  148. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
  149. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +18 -0
  150. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
  151. package/build/components/inspector-controls-tabs/utils.js +37 -0
  152. package/build/components/inspector-controls-tabs/utils.js.map +1 -0
  153. package/build/components/link-control/index.js +1 -0
  154. package/build/components/link-control/index.js.map +1 -1
  155. package/build/components/link-control/search-input.js +0 -1
  156. package/build/components/link-control/search-input.js.map +1 -1
  157. package/build/components/link-control/use-internal-input-value.js +3 -3
  158. package/build/components/link-control/use-internal-input-value.js.map +1 -1
  159. package/build/components/list-view/block-select-button.js +1 -1
  160. package/build/components/list-view/block-select-button.js.map +1 -1
  161. package/build/components/list-view/block.js +5 -2
  162. package/build/components/list-view/block.js.map +1 -1
  163. package/build/components/list-view/branch.js +13 -12
  164. package/build/components/list-view/branch.js.map +1 -1
  165. package/build/components/media-upload/index.native.js +2 -3
  166. package/build/components/media-upload/index.native.js.map +1 -1
  167. package/build/components/off-canvas-editor/appender.js +99 -0
  168. package/build/components/off-canvas-editor/appender.js.map +1 -0
  169. package/build/components/off-canvas-editor/block-edit-button.js +50 -0
  170. package/build/components/off-canvas-editor/block-edit-button.js.map +1 -0
  171. package/build/components/off-canvas-editor/block-select-button.js +3 -2
  172. package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
  173. package/build/components/off-canvas-editor/block.js +82 -38
  174. package/build/components/off-canvas-editor/block.js.map +1 -1
  175. package/build/components/off-canvas-editor/branch.js +3 -5
  176. package/build/components/off-canvas-editor/branch.js.map +1 -1
  177. package/build/components/off-canvas-editor/index.js +24 -11
  178. package/build/components/off-canvas-editor/index.js.map +1 -1
  179. package/build/components/off-canvas-editor/leaf.js +1 -1
  180. package/build/components/off-canvas-editor/leaf.js.map +1 -1
  181. package/build/components/off-canvas-editor/link-ui.js +185 -0
  182. package/build/components/off-canvas-editor/link-ui.js.map +1 -0
  183. package/build/components/off-canvas-editor/update-attributes.js +108 -0
  184. package/build/components/off-canvas-editor/update-attributes.js.map +1 -0
  185. package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
  186. package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
  187. package/build/components/responsive-block-control/label.js.map +1 -1
  188. package/build/components/rich-text/format-edit.js +12 -10
  189. package/build/components/rich-text/format-edit.js.map +1 -1
  190. package/build/components/rich-text/format-toolbar/index.js +8 -4
  191. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  192. package/build/components/rich-text/index.js +3 -3
  193. package/build/components/rich-text/index.js.map +1 -1
  194. package/build/components/rich-text/index.native.js +0 -2
  195. package/build/components/rich-text/index.native.js.map +1 -1
  196. package/build/components/rich-text/use-insert-replacement-text.js +43 -0
  197. package/build/components/rich-text/use-insert-replacement-text.js.map +1 -0
  198. package/build/components/rich-text/use-paste-handler.js +21 -12
  199. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  200. package/build/components/rich-text/use-undo-automatic-change.js +9 -1
  201. package/build/components/rich-text/use-undo-automatic-change.js.map +1 -1
  202. package/build/components/rich-text/utils.js +1 -19
  203. package/build/components/rich-text/utils.js.map +1 -1
  204. package/build/components/spacing-sizes-control/index.js +0 -1
  205. package/build/components/spacing-sizes-control/index.js.map +1 -1
  206. package/build/components/spacing-sizes-control/spacing-input-control.js +12 -3
  207. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  208. package/build/components/spacing-sizes-control/utils.js +1 -1
  209. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  210. package/build/components/typewriter/index.js +1 -1
  211. package/build/components/typewriter/index.js.map +1 -1
  212. package/build/components/ungroup-button/index.native.js +4 -2
  213. package/build/components/ungroup-button/index.native.js.map +1 -1
  214. package/build/components/url-input/index.js +46 -43
  215. package/build/components/url-input/index.js.map +1 -1
  216. package/build/components/url-popover/image-url-input-ui.js +2 -2
  217. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  218. package/build/components/use-block-display-information/index.js +8 -4
  219. package/build/components/use-block-display-information/index.js.map +1 -1
  220. package/build/components/use-setting/index.js +9 -1
  221. package/build/components/use-setting/index.js.map +1 -1
  222. package/build/components/writing-flow/index.js +1 -1
  223. package/build/components/writing-flow/index.js.map +1 -1
  224. package/build/hooks/border.js +0 -1
  225. package/build/hooks/border.js.map +1 -1
  226. package/build/hooks/child-layout.js +209 -0
  227. package/build/hooks/child-layout.js.map +1 -0
  228. package/build/hooks/color-panel.js +0 -1
  229. package/build/hooks/color-panel.js.map +1 -1
  230. package/build/hooks/color.js +1 -2
  231. package/build/hooks/color.js.map +1 -1
  232. package/build/hooks/content-lock-ui.js +1 -1
  233. package/build/hooks/content-lock-ui.js.map +1 -1
  234. package/build/hooks/dimensions.js +25 -7
  235. package/build/hooks/dimensions.js.map +1 -1
  236. package/build/hooks/font-family.js +4 -4
  237. package/build/hooks/font-family.js.map +1 -1
  238. package/build/hooks/font-size.js +5 -3
  239. package/build/hooks/font-size.js.map +1 -1
  240. package/build/hooks/layout.js +57 -1
  241. package/build/hooks/layout.js.map +1 -1
  242. package/build/hooks/min-height.js +4 -10
  243. package/build/hooks/min-height.js.map +1 -1
  244. package/build/hooks/use-typography-props.js +11 -8
  245. package/build/hooks/use-typography-props.js.map +1 -1
  246. package/build/store/reducer.js +411 -274
  247. package/build/store/reducer.js.map +1 -1
  248. package/build/store/selectors.js +58 -48
  249. package/build/store/selectors.js.map +1 -1
  250. package/build/utils/pasting.js +6 -11
  251. package/build/utils/pasting.js.map +1 -1
  252. package/build/utils/sorting.js +63 -0
  253. package/build/utils/sorting.js.map +1 -0
  254. package/build-module/autocompleters/block.js +2 -6
  255. package/build-module/autocompleters/block.js.map +1 -1
  256. package/build-module/autocompleters/link.js +2 -0
  257. package/build-module/autocompleters/link.js.map +1 -1
  258. package/build-module/components/alignment-control/ui.js +1 -6
  259. package/build-module/components/alignment-control/ui.js.map +1 -1
  260. package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
  261. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  262. package/build-module/components/block-card/index.js +45 -3
  263. package/build-module/components/block-card/index.js.map +1 -1
  264. package/build-module/components/block-draggable/index.native.js +40 -31
  265. package/build-module/components/block-draggable/index.native.js.map +1 -1
  266. package/build-module/components/block-edit/edit.js +4 -2
  267. package/build-module/components/block-edit/edit.js.map +1 -1
  268. package/build-module/components/block-edit/edit.native.js +4 -6
  269. package/build-module/components/block-edit/edit.native.js.map +1 -1
  270. package/build-module/components/block-icon/index.js +4 -2
  271. package/build-module/components/block-icon/index.js.map +1 -1
  272. package/build-module/components/block-inspector/index.js +87 -34
  273. package/build-module/components/block-inspector/index.js.map +1 -1
  274. package/build-module/components/block-list/block-list-context.native.js +5 -8
  275. package/build-module/components/block-list/block-list-context.native.js.map +1 -1
  276. package/build-module/components/block-list/block.js +55 -25
  277. package/build-module/components/block-list/block.js.map +1 -1
  278. package/build-module/components/block-list/block.native.js +61 -28
  279. package/build-module/components/block-list/block.native.js.map +1 -1
  280. package/build-module/components/block-list-appender/index.js +46 -34
  281. package/build-module/components/block-list-appender/index.js.map +1 -1
  282. package/build-module/components/block-list-appender/index.native.js +39 -32
  283. package/build-module/components/block-list-appender/index.native.js.map +1 -1
  284. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +31 -24
  285. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  286. package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
  287. package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
  288. package/build-module/components/block-pattern-setup/index.js +16 -8
  289. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  290. package/build-module/components/block-patterns-list/index.js +35 -13
  291. package/build-module/components/block-patterns-list/index.js.map +1 -1
  292. package/build-module/components/block-preview/auto.js +9 -3
  293. package/build-module/components/block-preview/auto.js.map +1 -1
  294. package/build-module/components/block-preview/index.js +5 -8
  295. package/build-module/components/block-preview/index.js.map +1 -1
  296. package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -2
  297. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  298. package/build-module/components/block-styles/index.native.js +1 -2
  299. package/build-module/components/block-styles/index.native.js.map +1 -1
  300. package/build-module/components/block-styles/utils.js +7 -9
  301. package/build-module/components/block-styles/utils.js.map +1 -1
  302. package/build-module/components/block-toolbar/index.js +6 -2
  303. package/build-module/components/block-toolbar/index.js.map +1 -1
  304. package/build-module/components/block-toolbar/index.native.js +6 -8
  305. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  306. package/build-module/components/block-tools/insertion-point.js +8 -49
  307. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  308. package/build-module/components/block-tools/selected-block-popover.js +1 -2
  309. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  310. package/build-module/components/block-variation-picker/index.js +2 -3
  311. package/build-module/components/block-variation-picker/index.js.map +1 -1
  312. package/build-module/components/colors/utils.js +3 -7
  313. package/build-module/components/colors/utils.js.map +1 -1
  314. package/build-module/components/colors-gradients/control.js +0 -3
  315. package/build-module/components/colors-gradients/control.js.map +1 -1
  316. package/build-module/components/colors-gradients/dropdown.js +0 -2
  317. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  318. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
  319. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  320. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
  321. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  322. package/build-module/components/copy-handler/index.js +38 -10
  323. package/build-module/components/copy-handler/index.js.map +1 -1
  324. package/build-module/components/font-sizes/fluid-utils.js +5 -2
  325. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  326. package/build-module/components/font-sizes/utils.js +11 -5
  327. package/build-module/components/font-sizes/utils.js.map +1 -1
  328. package/build-module/components/font-sizes/with-font-sizes.js +12 -7
  329. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  330. package/build-module/components/gradients/use-gradient.js +2 -7
  331. package/build-module/components/gradients/use-gradient.js.map +1 -1
  332. package/build-module/components/height-control/index.js +103 -0
  333. package/build-module/components/height-control/index.js.map +1 -0
  334. package/build-module/components/iframe/index.js +21 -101
  335. package/build-module/components/iframe/index.js.map +1 -1
  336. package/build-module/components/iframe/use-compatibility-styles.js +85 -0
  337. package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
  338. package/build-module/components/image-editor/use-save-image.js +2 -0
  339. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  340. package/build-module/components/image-editor/zoom-dropdown.js +1 -0
  341. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
  342. package/build-module/components/index.js +1 -0
  343. package/build-module/components/index.js.map +1 -1
  344. package/build-module/components/inner-blocks/index.js +27 -9
  345. package/build-module/components/inner-blocks/index.js.map +1 -1
  346. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +23 -10
  347. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  348. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  349. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  350. package/build-module/components/inserter/block-patterns-tab.js +27 -49
  351. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  352. package/build-module/components/inserter/block-types-tab.js +3 -2
  353. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  354. package/build-module/components/inserter/hooks/use-debounced-input.js +18 -0
  355. package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -0
  356. package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
  357. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  358. package/build-module/components/inserter/index.js +20 -6
  359. package/build-module/components/inserter/index.js.map +1 -1
  360. package/build-module/components/inserter/index.native.js +3 -5
  361. package/build-module/components/inserter/index.native.js.map +1 -1
  362. package/build-module/components/inserter/media-tab/hooks.js +92 -0
  363. package/build-module/components/inserter/media-tab/hooks.js.map +1 -0
  364. package/build-module/components/inserter/media-tab/index.js +4 -0
  365. package/build-module/components/inserter/media-tab/index.js.map +1 -0
  366. package/build-module/components/inserter/media-tab/media-list.js +86 -0
  367. package/build-module/components/inserter/media-tab/media-list.js.map +1 -0
  368. package/build-module/components/inserter/media-tab/media-panel.js +77 -0
  369. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -0
  370. package/build-module/components/inserter/media-tab/media-tab.js +100 -0
  371. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -0
  372. package/build-module/components/inserter/media-tab/utils.js +45 -0
  373. package/build-module/components/inserter/media-tab/utils.js.map +1 -0
  374. package/build-module/components/inserter/menu.js +33 -12
  375. package/build-module/components/inserter/menu.js.map +1 -1
  376. package/build-module/components/inserter/mobile-tab-navigation.js +61 -0
  377. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -0
  378. package/build-module/components/inserter/quick-inserter.js +7 -3
  379. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  380. package/build-module/components/inserter/search-items.js +15 -13
  381. package/build-module/components/inserter/search-items.js.map +1 -1
  382. package/build-module/components/inserter/search-results.js +7 -4
  383. package/build-module/components/inserter/search-results.js.map +1 -1
  384. package/build-module/components/inserter/tabs.js +15 -2
  385. package/build-module/components/inserter/tabs.js.map +1 -1
  386. package/build-module/components/inserter-list-item/index.js +5 -2
  387. package/build-module/components/inserter-list-item/index.js.map +1 -1
  388. package/build-module/components/inspector-controls/groups.js +2 -0
  389. package/build-module/components/inspector-controls/groups.js.map +1 -1
  390. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +32 -0
  391. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
  392. package/build-module/components/inspector-controls-tabs/index.js +56 -0
  393. package/build-module/components/inspector-controls-tabs/index.js.map +1 -0
  394. package/build-module/components/inspector-controls-tabs/settings-tab.js +17 -0
  395. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -0
  396. package/build-module/components/inspector-controls-tabs/styles-tab.js +46 -0
  397. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -0
  398. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +81 -0
  399. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
  400. package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +8 -0
  401. package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
  402. package/build-module/components/inspector-controls-tabs/utils.js +26 -0
  403. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -0
  404. package/build-module/components/link-control/index.js +1 -0
  405. package/build-module/components/link-control/index.js.map +1 -1
  406. package/build-module/components/link-control/search-input.js +0 -1
  407. package/build-module/components/link-control/search-input.js.map +1 -1
  408. package/build-module/components/link-control/use-internal-input-value.js +3 -3
  409. package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
  410. package/build-module/components/list-view/block-select-button.js +1 -1
  411. package/build-module/components/list-view/block-select-button.js.map +1 -1
  412. package/build-module/components/list-view/block.js +5 -2
  413. package/build-module/components/list-view/block.js.map +1 -1
  414. package/build-module/components/list-view/branch.js +12 -11
  415. package/build-module/components/list-view/branch.js.map +1 -1
  416. package/build-module/components/media-upload/index.native.js +2 -4
  417. package/build-module/components/media-upload/index.native.js.map +1 -1
  418. package/build-module/components/off-canvas-editor/appender.js +83 -0
  419. package/build-module/components/off-canvas-editor/appender.js.map +1 -0
  420. package/build-module/components/off-canvas-editor/block-edit-button.js +35 -0
  421. package/build-module/components/off-canvas-editor/block-edit-button.js.map +1 -0
  422. package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
  423. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
  424. package/build-module/components/off-canvas-editor/block.js +83 -41
  425. package/build-module/components/off-canvas-editor/block.js.map +1 -1
  426. package/build-module/components/off-canvas-editor/branch.js +3 -4
  427. package/build-module/components/off-canvas-editor/branch.js.map +1 -1
  428. package/build-module/components/off-canvas-editor/index.js +24 -12
  429. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  430. package/build-module/components/off-canvas-editor/leaf.js +1 -1
  431. package/build-module/components/off-canvas-editor/leaf.js.map +1 -1
  432. package/build-module/components/off-canvas-editor/link-ui.js +165 -0
  433. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -0
  434. package/build-module/components/off-canvas-editor/update-attributes.js +97 -0
  435. package/build-module/components/off-canvas-editor/update-attributes.js.map +1 -0
  436. package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
  437. package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
  438. package/build-module/components/responsive-block-control/label.js +1 -2
  439. package/build-module/components/responsive-block-control/label.js.map +1 -1
  440. package/build-module/components/rich-text/format-edit.js +12 -9
  441. package/build-module/components/rich-text/format-edit.js.map +1 -1
  442. package/build-module/components/rich-text/format-toolbar/index.js +6 -2
  443. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  444. package/build-module/components/rich-text/index.js +2 -3
  445. package/build-module/components/rich-text/index.js.map +1 -1
  446. package/build-module/components/rich-text/index.native.js +0 -2
  447. package/build-module/components/rich-text/index.native.js.map +1 -1
  448. package/build-module/components/rich-text/use-insert-replacement-text.js +33 -0
  449. package/build-module/components/rich-text/use-insert-replacement-text.js.map +1 -0
  450. package/build-module/components/rich-text/use-paste-handler.js +22 -12
  451. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  452. package/build-module/components/rich-text/use-undo-automatic-change.js +9 -1
  453. package/build-module/components/rich-text/use-undo-automatic-change.js.map +1 -1
  454. package/build-module/components/rich-text/utils.js +1 -16
  455. package/build-module/components/rich-text/utils.js.map +1 -1
  456. package/build-module/components/spacing-sizes-control/index.js +0 -1
  457. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  458. package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -3
  459. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  460. package/build-module/components/spacing-sizes-control/utils.js +1 -1
  461. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  462. package/build-module/components/typewriter/index.js +1 -1
  463. package/build-module/components/typewriter/index.js.map +1 -1
  464. package/build-module/components/ungroup-button/index.native.js +3 -2
  465. package/build-module/components/ungroup-button/index.native.js.map +1 -1
  466. package/build-module/components/url-input/index.js +46 -43
  467. package/build-module/components/url-input/index.js.map +1 -1
  468. package/build-module/components/url-popover/image-url-input-ui.js +3 -3
  469. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  470. package/build-module/components/use-block-display-information/index.js +9 -5
  471. package/build-module/components/use-block-display-information/index.js.map +1 -1
  472. package/build-module/components/use-setting/index.js +8 -1
  473. package/build-module/components/use-setting/index.js.map +1 -1
  474. package/build-module/components/writing-flow/index.js +1 -1
  475. package/build-module/components/writing-flow/index.js.map +1 -1
  476. package/build-module/hooks/border.js +0 -1
  477. package/build-module/hooks/border.js.map +1 -1
  478. package/build-module/hooks/child-layout.js +189 -0
  479. package/build-module/hooks/child-layout.js.map +1 -0
  480. package/build-module/hooks/color-panel.js +0 -1
  481. package/build-module/hooks/color-panel.js.map +1 -1
  482. package/build-module/hooks/color.js +1 -2
  483. package/build-module/hooks/color.js.map +1 -1
  484. package/build-module/hooks/content-lock-ui.js +1 -1
  485. package/build-module/hooks/content-lock-ui.js.map +1 -1
  486. package/build-module/hooks/dimensions.js +25 -8
  487. package/build-module/hooks/dimensions.js.map +1 -1
  488. package/build-module/hooks/font-family.js +5 -5
  489. package/build-module/hooks/font-family.js.map +1 -1
  490. package/build-module/hooks/font-size.js +5 -3
  491. package/build-module/hooks/font-size.js.map +1 -1
  492. package/build-module/hooks/layout.js +55 -0
  493. package/build-module/hooks/layout.js.map +1 -1
  494. package/build-module/hooks/min-height.js +3 -9
  495. package/build-module/hooks/min-height.js.map +1 -1
  496. package/build-module/hooks/use-typography-props.js +11 -8
  497. package/build-module/hooks/use-typography-props.js.map +1 -1
  498. package/build-module/store/reducer.js +409 -274
  499. package/build-module/store/reducer.js.map +1 -1
  500. package/build-module/store/selectors.js +55 -48
  501. package/build-module/store/selectors.js.map +1 -1
  502. package/build-module/utils/pasting.js +6 -10
  503. package/build-module/utils/pasting.js.map +1 -1
  504. package/build-module/utils/sorting.js +56 -0
  505. package/build-module/utils/sorting.js.map +1 -0
  506. package/build-style/content-rtl.css +701 -0
  507. package/build-style/content.css +701 -0
  508. package/build-style/default-editor-styles-rtl.css +17 -3
  509. package/build-style/default-editor-styles.css +17 -3
  510. package/build-style/style-rtl.css +313 -665
  511. package/build-style/style.css +313 -665
  512. package/package.json +32 -30
  513. package/src/autocompleters/block.js +2 -6
  514. package/src/autocompleters/link.js +2 -0
  515. package/src/components/alignment-control/test/index.js +6 -1
  516. package/src/components/alignment-control/ui.js +1 -7
  517. package/src/components/block-alignment-control/test/index.js +6 -1
  518. package/src/components/block-alignment-control/use-available-alignments.js +4 -3
  519. package/src/components/block-card/index.js +46 -2
  520. package/src/components/block-card/style.scss +4 -0
  521. package/src/components/block-content-overlay/{style.scss → content.scss} +7 -1
  522. package/src/components/block-draggable/content.scss +20 -0
  523. package/src/components/block-draggable/index.native.js +54 -40
  524. package/src/components/block-draggable/style.scss +0 -21
  525. package/src/components/block-draggable/test/helpers.native.js +7 -9
  526. package/src/components/block-draggable/test/index.native.js +35 -45
  527. package/src/components/block-edit/edit.js +5 -2
  528. package/src/components/block-edit/edit.native.js +5 -6
  529. package/src/components/block-icon/index.js +4 -2
  530. package/src/components/block-icon/test/index.js +9 -5
  531. package/src/components/block-inspector/index.js +173 -85
  532. package/src/components/block-inspector/style.scss +16 -1
  533. package/src/components/block-list/block-list-context.native.js +5 -8
  534. package/src/components/block-list/block.js +74 -23
  535. package/src/components/block-list/block.native.js +78 -23
  536. package/src/components/block-list/{style.scss → content.scss} +1 -15
  537. package/src/components/block-list-appender/{style.scss → content.scss} +0 -0
  538. package/src/components/block-list-appender/index.js +65 -54
  539. package/src/components/block-list-appender/index.native.js +45 -34
  540. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +42 -28
  541. package/src/components/block-mobile-toolbar/index.native.js +1 -1
  542. package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
  543. package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
  544. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -2
  545. package/src/components/block-mover/test/index.native.js +157 -1
  546. package/src/components/block-pattern-setup/index.js +17 -7
  547. package/src/components/block-pattern-setup/style.scss +29 -1
  548. package/src/components/block-patterns-list/index.js +47 -24
  549. package/src/components/block-preview/README.md +15 -10
  550. package/src/components/block-preview/auto.js +7 -1
  551. package/src/components/block-preview/content.scss +4 -0
  552. package/src/components/block-preview/index.js +7 -12
  553. package/src/components/block-preview/style.scss +0 -7
  554. package/src/components/block-preview/test/index.js +18 -35
  555. package/src/components/block-selection-clearer/test/index.js +12 -12
  556. package/src/components/block-settings-menu/block-settings-dropdown.js +32 -20
  557. package/src/components/block-styles/index.native.js +1 -2
  558. package/src/components/block-styles/utils.js +5 -7
  559. package/src/components/block-switcher/test/index.js +6 -1
  560. package/src/components/block-toolbar/index.js +12 -5
  561. package/src/components/block-toolbar/index.native.js +8 -11
  562. package/src/components/block-toolbar/style.scss +10 -0
  563. package/src/components/block-tools/insertion-point.js +3 -47
  564. package/src/components/block-tools/selected-block-popover.js +1 -3
  565. package/src/components/block-tools/style.scss +12 -5
  566. package/src/components/block-variation-picker/index.js +6 -5
  567. package/src/components/block-vertical-alignment-control/test/index.js +6 -1
  568. package/src/components/colors/test/with-colors.js +2 -0
  569. package/src/components/colors/utils.js +5 -3
  570. package/src/components/colors-gradients/control.js +0 -7
  571. package/src/components/colors-gradients/dropdown.js +0 -2
  572. package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
  573. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
  574. package/src/components/copy-handler/index.js +53 -7
  575. package/src/components/default-block-appender/{style.scss → content.scss} +0 -0
  576. package/src/components/default-block-appender/test/index.js +2 -0
  577. package/src/components/font-sizes/fluid-utils.js +7 -1
  578. package/src/components/font-sizes/utils.js +5 -3
  579. package/src/components/font-sizes/with-font-sizes.js +4 -4
  580. package/src/components/gradients/use-gradient.js +2 -7
  581. package/src/components/height-control/index.js +123 -0
  582. package/src/components/height-control/stories/index.js +21 -0
  583. package/src/components/height-control/style.scss +5 -0
  584. package/src/components/iframe/index.js +33 -121
  585. package/src/components/iframe/use-compatibility-styles.js +95 -0
  586. package/src/components/image-editor/use-save-image.js +2 -0
  587. package/src/components/image-editor/zoom-dropdown.js +1 -0
  588. package/src/components/image-size-control/test/index.js +147 -79
  589. package/src/components/index.js +1 -0
  590. package/src/components/inner-blocks/{style.scss → content.scss} +0 -0
  591. package/src/components/inner-blocks/index.js +26 -7
  592. package/src/components/inner-blocks/use-inner-block-template-sync.js +28 -10
  593. package/src/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  594. package/src/components/inserter/block-patterns-tab.js +28 -71
  595. package/src/components/inserter/block-types-tab.js +3 -2
  596. package/src/components/inserter/hooks/use-debounced-input.js +17 -0
  597. package/src/components/inserter/hooks/use-insertion-point.js +3 -2
  598. package/src/components/inserter/index.js +24 -3
  599. package/src/components/inserter/index.native.js +1 -1
  600. package/src/components/inserter/media-tab/hooks.js +89 -0
  601. package/src/components/inserter/media-tab/index.js +3 -0
  602. package/src/components/inserter/media-tab/media-list.js +93 -0
  603. package/src/components/inserter/media-tab/media-panel.js +83 -0
  604. package/src/components/inserter/media-tab/media-tab.js +135 -0
  605. package/src/components/inserter/media-tab/utils.js +37 -0
  606. package/src/components/inserter/menu.js +55 -13
  607. package/src/components/inserter/mobile-tab-navigation.js +85 -0
  608. package/src/components/inserter/quick-inserter.js +4 -0
  609. package/src/components/inserter/search-items.js +1 -2
  610. package/src/components/inserter/search-results.js +5 -2
  611. package/src/components/inserter/stories/index.js +1 -1
  612. package/src/components/inserter/stories/{fixtures.js → utils/fixtures.js} +0 -0
  613. package/src/components/inserter/style.scss +176 -11
  614. package/src/components/inserter/tabs.js +12 -1
  615. package/src/components/inserter-list-item/index.js +11 -1
  616. package/src/components/inserter-list-item/style.scss +26 -0
  617. package/src/components/inspector-controls/groups.js +2 -0
  618. package/src/components/inspector-controls-tabs/advanced-controls-panel.js +37 -0
  619. package/src/components/inspector-controls-tabs/index.js +62 -0
  620. package/src/components/inspector-controls-tabs/settings-tab.js +18 -0
  621. package/src/components/inspector-controls-tabs/styles-tab.js +51 -0
  622. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +89 -0
  623. package/src/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +9 -0
  624. package/src/components/inspector-controls-tabs/utils.js +28 -0
  625. package/src/components/line-height-control/test/index.js +5 -5
  626. package/src/components/link-control/README.md +1 -1
  627. package/src/components/link-control/index.js +1 -0
  628. package/src/components/link-control/search-input.js +0 -1
  629. package/src/components/link-control/test/index.js +204 -403
  630. package/src/components/link-control/use-internal-input-value.js +3 -3
  631. package/src/components/list-view/block-select-button.js +1 -1
  632. package/src/components/list-view/block.js +3 -0
  633. package/src/components/list-view/branch.js +10 -8
  634. package/src/components/list-view/style.scss +21 -16
  635. package/src/components/media-placeholder/{style.scss → content.scss} +0 -0
  636. package/src/components/media-replace-flow/test/index.js +39 -9
  637. package/src/components/media-upload/test/index.native.js +2 -0
  638. package/src/components/off-canvas-editor/appender.js +98 -0
  639. package/src/components/off-canvas-editor/block-edit-button.js +27 -0
  640. package/src/components/off-canvas-editor/block-select-button.js +6 -2
  641. package/src/components/off-canvas-editor/block.js +160 -77
  642. package/src/components/off-canvas-editor/branch.js +3 -5
  643. package/src/components/off-canvas-editor/index.js +68 -33
  644. package/src/components/off-canvas-editor/leaf.js +5 -1
  645. package/src/components/off-canvas-editor/link-ui.js +166 -0
  646. package/src/components/off-canvas-editor/style.scss +19 -386
  647. package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
  648. package/src/components/off-canvas-editor/update-attributes.js +99 -0
  649. package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
  650. package/src/components/plain-text/{style.scss → content.scss} +0 -0
  651. package/src/components/recursion-provider/test/index.js +27 -29
  652. package/src/components/responsive-block-control/label.js +2 -3
  653. package/src/components/responsive-block-control/test/index.js +4 -2
  654. package/src/components/rich-text/content.scss +42 -0
  655. package/src/components/rich-text/format-edit.js +6 -10
  656. package/src/components/rich-text/format-toolbar/index.js +6 -4
  657. package/src/components/rich-text/index.js +3 -2
  658. package/src/components/rich-text/index.native.js +0 -2
  659. package/src/components/rich-text/style.scss +0 -43
  660. package/src/components/rich-text/use-insert-replacement-text.js +31 -0
  661. package/src/components/rich-text/use-paste-handler.js +33 -14
  662. package/src/components/rich-text/use-undo-automatic-change.js +7 -1
  663. package/src/components/rich-text/utils.js +2 -21
  664. package/src/components/spacing-sizes-control/index.js +0 -1
  665. package/src/components/spacing-sizes-control/spacing-input-control.js +9 -0
  666. package/src/components/spacing-sizes-control/utils.js +1 -1
  667. package/src/components/typewriter/index.js +3 -1
  668. package/src/components/ungroup-button/index.native.js +6 -2
  669. package/src/components/url-input/index.js +57 -73
  670. package/src/components/url-input/test/button.js +2 -0
  671. package/src/components/url-popover/image-url-input-ui.js +5 -4
  672. package/src/components/url-popover/test/__snapshots__/index.js.snap +8 -6
  673. package/src/components/url-popover/test/index.js +37 -9
  674. package/src/components/use-block-display-information/index.js +14 -5
  675. package/src/components/use-setting/index.js +13 -1
  676. package/src/components/use-setting/test/index.js +99 -0
  677. package/src/components/warning/test/index.js +2 -0
  678. package/src/components/writing-flow/index.js +1 -1
  679. package/src/content.scss +10 -0
  680. package/src/hooks/border.js +0 -1
  681. package/src/hooks/child-layout.js +190 -0
  682. package/src/hooks/color-panel.js +0 -1
  683. package/src/hooks/color.js +0 -2
  684. package/src/hooks/content-lock-ui.js +1 -1
  685. package/src/hooks/dimensions.js +45 -7
  686. package/src/hooks/font-family.js +3 -5
  687. package/src/hooks/font-size.js +13 -4
  688. package/src/hooks/layout.js +60 -0
  689. package/src/hooks/min-height.js +2 -19
  690. package/src/hooks/test/use-typography-props.js +26 -0
  691. package/src/hooks/use-typography-props.js +15 -7
  692. package/src/store/reducer.js +471 -428
  693. package/src/store/selectors.js +57 -59
  694. package/src/store/test/performance.js +71 -0
  695. package/src/store/test/reducer.js +623 -491
  696. package/src/store/test/selectors.js +1820 -1306
  697. package/src/style.scss +4 -7
  698. package/src/utils/pasting.js +3 -9
  699. package/src/utils/sorting.js +54 -0
  700. package/src/utils/test/sorting.js +49 -0
  701. package/tsconfig.tsbuildinfo +1 -1
  702. package/build/components/block-preview/live.js +0 -30
  703. package/build/components/block-preview/live.js.map +0 -1
  704. package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
  705. package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
  706. package/build/components/rich-text/file-paste-handler.js +0 -21
  707. package/build/components/rich-text/file-paste-handler.js.map +0 -1
  708. package/build-module/components/block-preview/live.js +0 -20
  709. package/build-module/components/block-preview/live.js.map +0 -1
  710. package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
  711. package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
  712. package/build-module/components/rich-text/file-paste-handler.js +0 -13
  713. package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
  714. package/src/components/block-preview/live.js +0 -19
  715. package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
  716. package/src/components/rich-text/file-paste-handler.js +0 -13
@@ -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","constructor","props","onPickerPresent","bind","onPickerSelect","getAllSources","state","otherMediaOptions","componentDidMount","allowedTypes","autoOpen","otherMediaOptionsWithIcons","map","option","requiresModal","types","id","value","setState","componentWillUnmount","clearTimeout","pickerTimeout","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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AA;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","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,KA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F,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"]}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.Appender = void 0;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+
14
+ var _data = require("@wordpress/data");
15
+
16
+ var _store = require("../../store");
17
+
18
+ var _inserter = _interopRequireDefault(require("../inserter"));
19
+
20
+ var _linkUi = require("./link-ui");
21
+
22
+ var _updateAttributes = require("./update-attributes");
23
+
24
+ var _useInsertedBlock = require("./use-inserted-block");
25
+
26
+ /**
27
+ * WordPress dependencies
28
+ */
29
+
30
+ /**
31
+ * Internal dependencies
32
+ */
33
+ const BLOCKS_WITH_LINK_UI_SUPPORT = ['core/navigation-link', 'core/navigation-submenu'];
34
+ const Appender = (0, _element.forwardRef)((props, ref) => {
35
+ const [insertedBlockClientId, setInsertedBlockClientId] = (0, _element.useState)();
36
+ const {
37
+ hideInserter,
38
+ clientId
39
+ } = (0, _data.useSelect)(select => {
40
+ const {
41
+ getTemplateLock,
42
+ __unstableGetEditorMode,
43
+ getSelectedBlockClientId
44
+ } = select(_store.store);
45
+
46
+ const _clientId = getSelectedBlockClientId();
47
+
48
+ return {
49
+ clientId: getSelectedBlockClientId(),
50
+ hideInserter: !!getTemplateLock(_clientId) || __unstableGetEditorMode() === 'zoom-out'
51
+ };
52
+ }, []);
53
+ const {
54
+ insertedBlockAttributes,
55
+ insertedBlockName,
56
+ setInsertedBlockAttributes
57
+ } = (0, _useInsertedBlock.useInsertedBlock)(insertedBlockClientId);
58
+
59
+ const maybeSetInsertedBlockOnInsertion = _insertedBlock => {
60
+ if (!(_insertedBlock !== null && _insertedBlock !== void 0 && _insertedBlock.clientId)) {
61
+ return;
62
+ }
63
+
64
+ setInsertedBlockClientId(_insertedBlock === null || _insertedBlock === void 0 ? void 0 : _insertedBlock.clientId);
65
+ };
66
+
67
+ let maybeLinkUI;
68
+
69
+ if (insertedBlockClientId && BLOCKS_WITH_LINK_UI_SUPPORT !== null && BLOCKS_WITH_LINK_UI_SUPPORT !== void 0 && BLOCKS_WITH_LINK_UI_SUPPORT.includes(insertedBlockName)) {
70
+ maybeLinkUI = (0, _element.createElement)(_linkUi.LinkUI, {
71
+ clientId: insertedBlockClientId,
72
+ link: insertedBlockAttributes,
73
+ onClose: () => setInsertedBlockClientId(null),
74
+ hasCreateSuggestion: false,
75
+ onChange: updatedValue => {
76
+ (0, _updateAttributes.updateAttributes)(updatedValue, setInsertedBlockAttributes, insertedBlockAttributes);
77
+ setInsertedBlockClientId(null);
78
+ }
79
+ });
80
+ }
81
+
82
+ if (hideInserter) {
83
+ return null;
84
+ }
85
+
86
+ return (0, _element.createElement)("div", {
87
+ className: "offcanvas-editor__appender"
88
+ }, maybeLinkUI, (0, _element.createElement)(_inserter.default, (0, _extends2.default)({
89
+ ref: ref,
90
+ rootClientId: clientId,
91
+ position: "bottom right",
92
+ isAppender: true,
93
+ selectBlockOnInsert: false,
94
+ onSelectOrClose: maybeSetInsertedBlockOnInsertion,
95
+ __experimentalIsQuick: true
96
+ }, props)));
97
+ });
98
+ exports.Appender = Appender;
99
+ //# sourceMappingURL=appender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/appender.js"],"names":["BLOCKS_WITH_LINK_UI_SUPPORT","Appender","props","ref","insertedBlockClientId","setInsertedBlockClientId","hideInserter","clientId","select","getTemplateLock","__unstableGetEditorMode","getSelectedBlockClientId","blockEditorStore","_clientId","insertedBlockAttributes","insertedBlockName","setInsertedBlockAttributes","maybeSetInsertedBlockOnInsertion","_insertedBlock","maybeLinkUI","includes","updatedValue"],"mappings":";;;;;;;;;AAIA;;;;AADA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;AAOA,MAAMA,2BAA2B,GAAG,CACnC,sBADmC,EAEnC,yBAFmC,CAApC;AAKO,MAAMC,QAAQ,GAAG,yBAAY,CAAEC,KAAF,EAASC,GAAT,KAAkB;AACrD,QAAM,CAAEC,qBAAF,EAAyBC,wBAAzB,IAAsD,wBAA5D;AAEA,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,O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AgBA,CA9EuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef, useState } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport Inserter from '../inserter';\nimport { LinkUI } from './link-ui';\nimport { updateAttributes } from './update-attributes';\nimport { useInsertedBlock } from './use-inserted-block';\n\nconst BLOCKS_WITH_LINK_UI_SUPPORT = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\n\nexport const Appender = forwardRef( ( props, ref ) => {\n\tconst [ insertedBlockClientId, setInsertedBlockClientId ] = useState();\n\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\tconst {\n\t\tinsertedBlockAttributes,\n\t\tinsertedBlockName,\n\t\tsetInsertedBlockAttributes,\n\t} = useInsertedBlock( insertedBlockClientId );\n\n\tconst maybeSetInsertedBlockOnInsertion = ( _insertedBlock ) => {\n\t\tif ( ! _insertedBlock?.clientId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetInsertedBlockClientId( _insertedBlock?.clientId );\n\t};\n\n\tlet maybeLinkUI;\n\n\tif (\n\t\tinsertedBlockClientId &&\n\t\tBLOCKS_WITH_LINK_UI_SUPPORT?.includes( insertedBlockName )\n\t) {\n\t\tmaybeLinkUI = (\n\t\t\t<LinkUI\n\t\t\t\tclientId={ insertedBlockClientId }\n\t\t\t\tlink={ insertedBlockAttributes }\n\t\t\t\tonClose={ () => setInsertedBlockClientId( null ) }\n\t\t\t\thasCreateSuggestion={ false }\n\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\tsetInsertedBlockAttributes,\n\t\t\t\t\t\tinsertedBlockAttributes\n\t\t\t\t\t);\n\t\t\t\t\tsetInsertedBlockClientId( null );\n\t\t\t\t} }\n\t\t\t/>\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{ maybeLinkUI }\n\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\tonSelectOrClose={ maybeSetInsertedBlockOnInsertion }\n\t\t\t\t__experimentalIsQuick\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</div>\n\t);\n} );\n"]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+
14
+ var _icons = require("@wordpress/icons");
15
+
16
+ var _components = require("@wordpress/components");
17
+
18
+ var _data = require("@wordpress/data");
19
+
20
+ var _store = require("../../store");
21
+
22
+ /**
23
+ * WordPress dependencies
24
+ */
25
+
26
+ /**
27
+ * Internal dependencies
28
+ */
29
+ var _default = (0, _element.forwardRef)(function BlockEditButton(_ref, ref) {
30
+ let {
31
+ clientId,
32
+ ...props
33
+ } = _ref;
34
+ const {
35
+ selectBlock
36
+ } = (0, _data.useDispatch)(_store.store);
37
+
38
+ const onClick = () => {
39
+ selectBlock(clientId);
40
+ };
41
+
42
+ return (0, _element.createElement)(_components.Button, (0, _extends2.default)({}, props, {
43
+ ref: ref,
44
+ icon: _icons.edit,
45
+ onClick: onClick
46
+ }));
47
+ });
48
+
49
+ exports.default = _default;
50
+ //# sourceMappingURL=block-edit-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/block-edit-button.js"],"names":["BlockEditButton","ref","clientId","props","selectBlock","blockEditorStore","onClick","edit"],"mappings":";;;;;;;;;AAMA;;;;AAHA;;AACA;;AACA;;AAMA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;eAGe,yBAAY,SAASA,eAAT,OAE1BC,GAF0B,EAGzB;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAY,OAAGC;AAAf,GAEC;AACD,QAAM;AAAEC,IAAAA;AAAF,MAAkB,uBAAaC,YAAb,CAAxB;;AAEA,QAAMC,OAAO,GAAG,MAAM;AACrBF,IAAAA,WAAW,CAAEF,QAAF,CAAX;AACA,GAFD;;AAIA,SACC,4BAAC,kBAAD,6BAAaC,KAAb;AAAqB,IAAA,GAAG,EAAGF,GAA3B;AAAiC,IAAA,IAAI,EAAGM,WAAxC;AAA+C,IAAA,OAAO,EAAGD;AAAzD,KADD;AAGA,CAbc,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { edit } from '@wordpress/icons';\nimport { Button } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport default forwardRef( function BlockEditButton(\n\t{ clientId, ...props },\n\tref\n) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst onClick = () => {\n\t\tselectBlock( clientId );\n\t};\n\n\treturn (\n\t\t<Button { ...props } ref={ ref } icon={ edit } onClick={ onClick } />\n\t);\n} );\n"]}
@@ -91,7 +91,8 @@ function ListViewBlockSelectButton(_ref, ref) {
91
91
  onClick: onToggleExpanded
92
92
  }), (0, _element.createElement)(_blockIcon.default, {
93
93
  icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon,
94
- showColors: true
94
+ showColors: true,
95
+ context: "list-view"
95
96
  }), (0, _element.createElement)(_components.__experimentalHStack, {
96
97
  alignment: "center",
97
98
  className: "block-editor-list-view-block-select-button__label-wrapper",
@@ -109,7 +110,7 @@ function ListViewBlockSelectButton(_ref, ref) {
109
110
  }, blockInformation.anchor)), isLocked && (0, _element.createElement)("span", {
110
111
  className: "block-editor-list-view-block-select-button__lock"
111
112
  }, (0, _element.createElement)(_icons.Icon, {
112
- icon: _icons.lock
113
+ icon: _icons.lockSmall
113
114
  })))));
114
115
  }
115
116
 
@@ -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;AAA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U,IAAA,aAAa,EAAC;AAAxB,KAAiCX,UAAjC,CADD,CAND,EASG,CAAAD,gBAAgB,SAAhB,IAAAA,gBAAgB,WAAhB,YAAAA,gBAAgB,CAAEa,MAAlB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,kCAAD;AACC,IAAA,SAAS,EAAC,oDADX;AAEC,IAAA,aAAa,EAAC;AAFf,KAIGb,gBAAgB,CAACa,MAJpB,CADD,CAVF,EAmBGV,QAAQ,IACT;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGW;AAAb,IADD,CApBF,CAlBD,CADD,CADD;AAgDA;;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, 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 icon={ blockInformation?.icon } showColors />\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","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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B,WAAhB,YAAAA,gBAAgB,CAAEa,MAAlB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,kCAAD;AACC,IAAA,SAAS,EAAC,oDADX;AAEC,IAAA,aAAa,EAAC;AAFf,KAIGb,gBAAgB,CAACa,MAJpB,CADD,CAVF,EAmBGV,QAAQ,IACT;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGW;AAAb,IADD,CApBF,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"]}
@@ -9,6 +9,8 @@ exports.default = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+
12
14
  var _classnames = _interopRequireDefault(require("classnames"));
13
15
 
14
16
  var _blocks = require("@wordpress/blocks");
@@ -31,6 +33,8 @@ var _blockContents = _interopRequireDefault(require("./block-contents"));
31
33
 
32
34
  var _blockSettingsDropdown = _interopRequireDefault(require("../block-settings-menu/block-settings-dropdown"));
33
35
 
36
+ var _blockEditButton = _interopRequireDefault(require("./block-edit-button"));
37
+
34
38
  var _context = require("./context");
35
39
 
36
40
  var _utils = require("./utils");
@@ -54,7 +58,9 @@ var _blockLock = require("../block-lock");
54
58
  */
55
59
  function ListViewBlock(_ref) {
56
60
  let {
57
- block,
61
+ block: {
62
+ clientId
63
+ },
58
64
  isDragged,
59
65
  isSelected,
60
66
  isBranchSelected,
@@ -72,9 +78,6 @@ function ListViewBlock(_ref) {
72
78
  } = _ref;
73
79
  const cellRef = (0, _element.useRef)(null);
74
80
  const [isHovered, setIsHovered] = (0, _element.useState)(false);
75
- const {
76
- clientId
77
- } = block;
78
81
  const {
79
82
  isLocked,
80
83
  isContentLocked
@@ -93,40 +96,12 @@ function ListViewBlock(_ref) {
93
96
  const isFirstSelectedBlock = forceSelectionContentLock || isSelected && selectedClientIds[0] === clientId;
94
97
  const isLastSelectedBlock = forceSelectionContentLock || isSelected && selectedClientIds[selectedClientIds.length - 1] === clientId;
95
98
  const {
99
+ insertBlock,
100
+ replaceBlock,
96
101
  toggleBlockHighlight
97
102
  } = (0, _data.useDispatch)(_store.store);
98
103
  const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
99
- const blockName = (0, _data.useSelect)(select => select(_store.store).getBlockName(clientId), [clientId]); // When a block hides its toolbar it also hides the block settings menu,
100
- // since that menu is part of the toolbar in the editor canvas.
101
- // List View respects this by also hiding the block settings menu.
102
-
103
- const showBlockActions = (0, _blocks.hasBlockSupport)(blockName, '__experimentalToolbar', true);
104
- const instanceId = (0, _compose.useInstanceId)(ListViewBlock);
105
- const descriptionId = `list-view-block-select-button__${instanceId}`;
106
- const blockPositionDescription = (0, _utils.getBlockPositionDescription)(position, siblingBlockCount, level);
107
- let blockAriaLabel = (0, _i18n.__)('Link');
108
-
109
- if (blockInformation) {
110
- blockAriaLabel = isLocked ? (0, _i18n.sprintf)( // translators: %s: The title of the block. This string indicates a link to select the locked block.
111
- (0, _i18n.__)('%s link (locked)'), blockInformation.title) : (0, _i18n.sprintf)( // translators: %s: The title of the block. This string indicates a link to select the block.
112
- (0, _i18n.__)('%s link'), blockInformation.title);
113
- }
114
-
115
- const settingsAriaLabel = blockInformation ? (0, _i18n.sprintf)( // translators: %s: The title of the block.
116
- (0, _i18n.__)('Options for %s block'), blockInformation.title) : (0, _i18n.__)('Options');
117
- const {
118
- isTreeGridMounted,
119
- expand,
120
- collapse
121
- } = (0, _context.useListViewContext)();
122
- const hasSiblings = siblingBlockCount > 0;
123
- const hasRenderedMovers = showBlockMovers && hasSiblings;
124
- const moverCellClassName = (0, _classnames.default)('block-editor-list-view-block__mover-cell', {
125
- 'is-visible': isHovered || isSelected
126
- });
127
- const listViewBlockSettingsClassName = (0, _classnames.default)('block-editor-list-view-block__menu-cell', {
128
- 'is-visible': isHovered || isFirstSelectedBlock
129
- }); // If ListView has experimental features related to the Persistent List View,
104
+ const block = (0, _data.useSelect)(select => select(_store.store).getBlock(clientId), [clientId]); // If ListView has experimental features related to the Persistent List View,
130
105
  // only focus the selected list item on mount; otherwise the list would always
131
106
  // try to steal the focus from the editor canvas.
132
107
 
@@ -150,6 +125,11 @@ function ListViewBlock(_ref) {
150
125
  const updateSelection = (0, _element.useCallback)(newClientId => {
151
126
  selectBlock(undefined, newClientId);
152
127
  }, [selectBlock]);
128
+ const {
129
+ isTreeGridMounted,
130
+ expand,
131
+ collapse
132
+ } = (0, _context.useListViewContext)();
153
133
  const toggleExpanded = (0, _element.useCallback)(event => {
154
134
  // Prevent shift+click from opening link in a new window when toggling.
155
135
  event.preventDefault();
@@ -161,6 +141,42 @@ function ListViewBlock(_ref) {
161
141
  expand(clientId);
162
142
  }
163
143
  }, [clientId, expand, collapse, isExpanded]);
144
+ const instanceId = (0, _compose.useInstanceId)(ListViewBlock);
145
+
146
+ if (!block) {
147
+ return null;
148
+ } // When a block hides its toolbar it also hides the block settings menu,
149
+ // since that menu is part of the toolbar in the editor canvas.
150
+ // List View respects this by also hiding the block settings menu.
151
+
152
+
153
+ const showBlockActions = !!block && (0, _blocks.hasBlockSupport)(block.name, '__experimentalToolbar', true);
154
+ const descriptionId = `list-view-block-select-button__${instanceId}`;
155
+ const blockPositionDescription = (0, _utils.getBlockPositionDescription)(position, siblingBlockCount, level);
156
+ let blockAriaLabel = (0, _i18n.__)('Link');
157
+
158
+ if (blockInformation) {
159
+ blockAriaLabel = isLocked ? (0, _i18n.sprintf)( // translators: %s: The title of the block. This string indicates a link to select the locked block.
160
+ (0, _i18n.__)('%s link (locked)'), blockInformation.title) : (0, _i18n.sprintf)( // translators: %s: The title of the block. This string indicates a link to select the block.
161
+ (0, _i18n.__)('%s link'), blockInformation.title);
162
+ }
163
+
164
+ const settingsAriaLabel = blockInformation ? (0, _i18n.sprintf)( // translators: %s: The title of the block.
165
+ (0, _i18n.__)('Options for %s block'), blockInformation.title) : (0, _i18n.__)('Options');
166
+ const editAriaLabel = blockInformation ? (0, _i18n.sprintf)( // translators: %s: The title of the block.
167
+ (0, _i18n.__)('Edit %s block'), blockInformation.title) : (0, _i18n.__)('Edit');
168
+ const isEditable = !!block && block.name !== 'core/page-list-item';
169
+ const hasSiblings = siblingBlockCount > 0;
170
+ const hasRenderedMovers = showBlockMovers && hasSiblings;
171
+ const moverCellClassName = (0, _classnames.default)('block-editor-list-view-block__mover-cell', {
172
+ 'is-visible': isHovered || isSelected
173
+ });
174
+ const listViewBlockSettingsClassName = (0, _classnames.default)('block-editor-list-view-block__menu-cell', {
175
+ 'is-visible': isHovered || isFirstSelectedBlock
176
+ });
177
+ const listViewBlockEditClassName = (0, _classnames.default)('block-editor-list-view-block__menu-cell', {
178
+ 'is-visible': isHovered || isFirstSelectedBlock
179
+ });
164
180
  let colSpan;
165
181
 
166
182
  if (hasRenderedMovers) {
@@ -261,9 +277,17 @@ function ListViewBlock(_ref) {
261
277
  tabIndex: tabIndex,
262
278
  onFocus: onFocus
263
279
  });
264
- }))), showBlockActions && (0, _element.createElement)(_components.__experimentalTreeGridCell, {
265
- className: listViewBlockSettingsClassName,
280
+ }))), showBlockActions && (0, _element.createElement)(_element.Fragment, null, isEditable && (0, _element.createElement)(_components.__experimentalTreeGridCell, {
281
+ className: listViewBlockEditClassName,
266
282
  "aria-selected": !!isSelected || forceSelectionContentLock
283
+ }, props => (0, _element.createElement)(_blockEditButton.default, (0, _extends2.default)({}, props, {
284
+ label: editAriaLabel,
285
+ clientId: clientId
286
+ }))), (0, _element.createElement)(_components.__experimentalTreeGridCell, {
287
+ className: listViewBlockSettingsClassName,
288
+ "aria-selected": !!isSelected || forceSelectionContentLock,
289
+ colSpan: isEditable ? 1 : 2 // When an item is not editable then we don't output the cell for the edit button, so we need to adjust the colspan so that the HTML is valid.
290
+
267
291
  }, _ref5 => {
268
292
  let {
269
293
  ref,
@@ -282,8 +306,28 @@ function ListViewBlock(_ref) {
282
306
  },
283
307
  disableOpenOnArrowDown: true,
284
308
  __experimentalSelectBlock: updateSelection
309
+ }, _ref6 => {
310
+ let {
311
+ onClose
312
+ } = _ref6;
313
+ return (0, _element.createElement)(_components.MenuItem, {
314
+ onClick: () => {
315
+ const newLink = (0, _blocks.createBlock)('core/navigation-link');
316
+
317
+ if (block.name === 'core/navigation-submenu') {
318
+ const updateSelectionOnInsert = false;
319
+ insertBlock(newLink, block.innerBlocks.length, clientId, updateSelectionOnInsert);
320
+ } else {
321
+ // Convert to a submenu if the block currently isn't one.
322
+ const newSubmenu = (0, _blocks.createBlock)('core/navigation-submenu', block.attributes, block.innerBlocks ? [...block.innerBlocks, newLink] : [newLink]);
323
+ replaceBlock(clientId, newSubmenu);
324
+ }
325
+
326
+ onClose();
327
+ }
328
+ }, (0, _i18n.__)('Add submenu item'));
285
329
  });
286
- }));
330
+ })));
287
331
  }
288
332
 
289
333
  var _default = (0, _element.memo)(ListViewBlock);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/block.js"],"names":["ListViewBlock","block","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","preventAnnouncement","selectBlockInCanvas","cellRef","isHovered","setIsHovered","clientId","isLocked","isContentLocked","forceSelectionContentLock","select","blockEditorStore","hasSelectedInnerBlock","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","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;;AAkB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A,SAAS,EAAG,CAAE9C,QAAF,CAFb;AAGC,MAAA,GAAG,EAAG4C,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,CAAE9C,QAAF,CAFb;AAGC,MAAA,GAAG,EAAG4C,GAHP;AAIC,MAAA,QAAQ,EAAGC,QAJZ;AAKC,MAAA,OAAO,EAAGC;AALX,MADC;AAAA,GADH,CAfD,CADD,CAzDF,EAwFGhC,gBAAgB,IACjB,4BAAC,sCAAD;AACC,IAAA,SAAS,EAAGa,8BADb;AAEC,qBAAgB,CAAC,CAAE3C,UAAH,IAAiBmB;AAFlC,KAIG;AAAA,QAAE;AAAEyC,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,EAAG3B,iBAHT;AAIC,MAAA,WAAW,EAAG;AACbwB,QAAAA,GADa;AAEbI,QAAAA,SAAS,EAAE,oCAFE;AAGbH,QAAAA,QAHa;AAIbC,QAAAA;AAJa,OAJf;AAUC,MAAA,sBAAsB,MAVvB;AAWC,MAAA,yBAAyB,EAAGX;AAX7B,MADC;AAAA,GAJH,CAzFF,CADD;AAiHA;;eAEc,mBAAMtD,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\tselectBlockInCanvas,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst { clientId } = block;\n\n\tconst { isLocked, isContentLocked } = 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 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-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\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={ isContentLocked ? undefined : isExpanded }\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={ isContentLocked ? undefined : isExpanded }\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={\n\t\t\t\t\t\t\t\tselectBlockInCanvas\n\t\t\t\t\t\t\t\t\t? selectEditorBlock\n\t\t\t\t\t\t\t\t\t: ( event ) => {\n\t\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t}\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/off-canvas-editor/block.js"],"names":["ListViewBlock","block","clientId","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","preventAnnouncement","selectBlockInCanvas","cellRef","isHovered","setIsHovered","isLocked","isContentLocked","forceSelectionContentLock","select","blockEditorStore","hasSelectedInnerBlock","isFirstSelectedBlock","isLastSelectedBlock","length","insertBlock","replaceBlock","toggleBlockHighlight","blockInformation","getBlock","isTreeGridMounted","current","focus","onMouseEnter","onMouseLeave","selectEditorBlock","event","preventDefault","updateSelection","newClientId","undefined","expand","collapse","toggleExpanded","stopPropagation","instanceId","showBlockActions","name","descriptionId","blockPositionDescription","blockAriaLabel","title","settingsAriaLabel","editAriaLabel","isEditable","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","listViewBlockEditClassName","colSpan","classes","dropdownClientIds","includes","ref","tabIndex","onFocus","props","moreVertical","className","onClose","newLink","updateSelectionOnInsert","innerBlocks","newSubmenu","attributes"],"mappings":";;;;;;;;;AAgBA;;;;AAbA;;AAKA;;AACA;;AAKA;;AACA;;AAQA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzCA;AACA;AACA;;AAGA;AACA;AACA;;AAmBA;AACA;AACA;AAeA,SAASA,aAAT,OAgBI;AAAA,MAhBoB;AACvBC,IAAAA,KAAK,EAAE;AAAEC,MAAAA;AAAF,KADgB;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,IAA8B,uBAAU,KAAV,CAApC;AAEA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAgC,6BAAcnB,QAAd,CAAtC;AACA,QAAMoB,yBAAyB,GAAG,qB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M;AACf,gBAAMC,OAAO,GAAG,yBACf,sBADe,CAAhB;;AAGA,cACC1E,KAAK,CAACkD,IAAN,KACA,yBAFD,EAGE;AACD,kBAAMyB,uBAAuB,GAAG,KAAhC;AACA/C,YAAAA,WAAW,CACV8C,OADU,EAEV1E,KAAK,CAAC4E,WAAN,CAAkBjD,MAFR,EAGV1B,QAHU,EAIV0E,uBAJU,CAAX;AAMA,WAXD,MAWO;AACN;AACA,kBAAME,UAAU,GAAG,yBAClB,yBADkB,EAElB7E,KAAK,CAAC8E,UAFY,EAGlB9E,KAAK,CAAC4E,WAAN,GACG,CACA,GAAG5E,KAAK,CAAC4E,WADT,EAEAF,OAFA,CADH,GAKG,CAAEA,OAAF,CARe,CAAnB;AAUA7C,YAAAA,YAAY,CACX5B,QADW,EAEX4E,UAFW,CAAZ;AAIA;;AACDJ,UAAAA,OAAO;AACP;AAlCF,SAoCG,cAAI,kBAAJ,CApCH,CADC;AAAA,KAdH,CADC;AAAA,GAPH,CAjBD,CAzFF,CADD;AAgLA;;eAEc,mBAAM1E,aAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n\tMenuItem,\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 BlockEditButton from './block-edit-button';\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: { clientId },\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\tselectBlockInCanvas,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\n\tconst { isLocked, isContentLocked } = 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 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 { insertBlock, replaceBlock, toggleBlockHighlight } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst block = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t[ clientId ]\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 { isTreeGridMounted, expand, collapse } = useListViewContext();\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\tconst instanceId = useInstanceId( ListViewBlock );\n\n\tif ( ! block ) {\n\t\treturn null;\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 =\n\t\t!! block &&\n\t\thasBlockSupport( block.name, '__experimentalToolbar', true );\n\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 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\tconst isEditable = !! block && block.name !== 'core/page-list-item';\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\tconst listViewBlockEditClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isFirstSelectedBlock }\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-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\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={ isContentLocked ? undefined : isExpanded }\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={ isContentLocked ? undefined : isExpanded }\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={\n\t\t\t\t\t\t\t\tselectBlockInCanvas\n\t\t\t\t\t\t\t\t\t? selectEditorBlock\n\t\t\t\t\t\t\t\t\t: ( event ) => {\n\t\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t}\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<>\n\t\t\t\t\t{ isEditable && (\n\t\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\t\tclassName={ listViewBlockEditClassName }\n\t\t\t\t\t\t\taria-selected={\n\t\t\t\t\t\t\t\t!! isSelected || forceSelectionContentLock\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ ( props ) => (\n\t\t\t\t\t\t\t\t<BlockEditButton\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tlabel={ editAriaLabel }\n\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridCell>\n\t\t\t\t\t) }\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\t\taria-selected={\n\t\t\t\t\t\t\t!! isSelected || forceSelectionContentLock\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcolSpan={ isEditable ? 1 : 2 } // When an item is not editable then we don't output the cell for the edit button, so we need to adjust the colspan so that the HTML is valid.\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t<BlockSettingsDropdown\n\t\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\tlabel={ settingsAriaLabel }\n\t\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t\t\t'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t\t__experimentalSelectBlock={ updateSelection }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tconst newLink = createBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-link'\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\tblock.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-submenu'\n\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\tconst updateSelectionOnInsert = false;\n\t\t\t\t\t\t\t\t\t\t\t\tinsertBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\tnewLink,\n\t\t\t\t\t\t\t\t\t\t\t\t\tblock.innerBlocks.length,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdateSelectionOnInsert\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t// Convert to a submenu if the block currently isn't one.\n\t\t\t\t\t\t\t\t\t\t\t\tconst newSubmenu = createBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-submenu',\n\t\t\t\t\t\t\t\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\t\t\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t...block.innerBlocks,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnewLink,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: [ newLink ]\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\treplaceBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\t\t\t\t\tnewSubmenu\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Add submenu item' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</BlockSettingsDropdown>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"]}
@@ -76,10 +76,12 @@ const countReducer = (expandedState, draggedClientIds, isExpandedByDefault) => (
76
76
  return count + 1;
77
77
  };
78
78
 
79
+ const noop = () => {};
80
+
79
81
  function ListViewBranch(props) {
80
82
  const {
81
83
  blocks,
82
- selectBlock,
84
+ selectBlock = noop,
83
85
  showBlockMovers,
84
86
  selectedClientIds,
85
87
  level = 1,
@@ -171,10 +173,6 @@ function ListViewBranch(props) {
171
173
  }));
172
174
  }
173
175
 
174
- ListViewBranch.defaultProps = {
175
- selectBlock: () => {}
176
- };
177
-
178
176
  var _default = (0, _element.memo)(ListViewBranch);
179
177
 
180
178
  exports.default = _default;