@wordpress/block-editor 12.9.1-next.5a1d1283.0 → 12.10.1

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 (448) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +33 -3
  3. package/build/components/block-canvas/index.js +107 -0
  4. package/build/components/block-canvas/index.js.map +1 -0
  5. package/build/components/block-inspector/index.js +4 -1
  6. package/build/components/block-inspector/index.js.map +1 -1
  7. package/build/components/block-patterns-list/index.js +28 -8
  8. package/build/components/block-patterns-list/index.js.map +1 -1
  9. package/build/components/block-patterns-paging/index.js +68 -0
  10. package/build/components/block-patterns-paging/index.js.map +1 -0
  11. package/build/components/block-settings-menu/block-settings-dropdown.js +28 -0
  12. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  13. package/build/components/block-settings-menu-controls/index.js +4 -7
  14. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  15. package/build/components/block-styles/index.js +1 -0
  16. package/build/components/block-styles/index.js.map +1 -1
  17. package/build/components/block-toolbar/block-toolbar-menu.native.js +3 -7
  18. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  19. package/build/components/block-tools/block-contextual-toolbar.js +18 -7
  20. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  21. package/build/components/block-tools/block-selection-button.js +5 -1
  22. package/build/components/block-tools/block-selection-button.js.map +1 -1
  23. package/build/components/border-radius-control/input-controls.js +1 -1
  24. package/build/components/border-radius-control/input-controls.js.map +1 -1
  25. package/build/components/border-radius-control/linked-button.js +2 -4
  26. package/build/components/border-radius-control/linked-button.js.map +1 -1
  27. package/build/components/colors/with-colors.js.map +1 -1
  28. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
  29. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  30. package/build/components/default-block-appender/index.native.js +20 -1
  31. package/build/components/default-block-appender/index.native.js.map +1 -1
  32. package/build/components/duotone/utils.js +68 -0
  33. package/build/components/duotone/utils.js.map +1 -1
  34. package/build/components/editor-styles/index.js +28 -9
  35. package/build/components/editor-styles/index.js.map +1 -1
  36. package/build/components/global-styles/hooks.js +2 -101
  37. package/build/components/global-styles/hooks.js.map +1 -1
  38. package/build/components/global-styles/image-settings-panel.js +61 -0
  39. package/build/components/global-styles/image-settings-panel.js.map +1 -0
  40. package/build/components/global-styles/index.js +11 -17
  41. package/build/components/global-styles/index.js.map +1 -1
  42. package/build/components/global-styles/use-global-styles-output.js +19 -15
  43. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  44. package/build/components/global-styles/utils.js +1 -1
  45. package/build/components/global-styles/utils.js.map +1 -1
  46. package/build/components/iframe/index.js +67 -33
  47. package/build/components/iframe/index.js.map +1 -1
  48. package/build/components/image-editor/use-save-image.js +2 -5
  49. package/build/components/image-editor/use-save-image.js.map +1 -1
  50. package/build/components/image-editor/use-transform-image.js +9 -9
  51. package/build/components/image-editor/use-transform-image.js.map +1 -1
  52. package/build/components/index.js +8 -12
  53. package/build/components/index.js.map +1 -1
  54. package/build/components/index.native.js +6 -5
  55. package/build/components/index.native.js.map +1 -1
  56. package/build/components/inner-blocks/use-nested-settings-update.js +13 -7
  57. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  58. package/build/components/inserter/block-patterns-explorer/explorer.js +12 -6
  59. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  60. package/build/components/inserter/block-patterns-explorer/patterns-list.js +45 -22
  61. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  62. package/build/components/inserter/block-patterns-explorer/sidebar.js +9 -9
  63. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  64. package/build/components/inserter/block-patterns-filter.js +137 -0
  65. package/build/components/inserter/block-patterns-filter.js.map +1 -0
  66. package/build/components/inserter/block-patterns-tab.js +128 -42
  67. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  68. package/build/components/inserter/hooks/use-patterns-paging.js +61 -0
  69. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  70. package/build/components/inserter/hooks/use-patterns-state.js +21 -10
  71. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  72. package/build/components/inserter/menu.js +13 -11
  73. package/build/components/inserter/menu.js.map +1 -1
  74. package/build/components/inserter/search-results.js +4 -3
  75. package/build/components/inserter/search-results.js.map +1 -1
  76. package/build/components/inserter/tabs.js +1 -12
  77. package/build/components/inserter/tabs.js.map +1 -1
  78. package/build/components/inspector-controls/block-support-slot-container.js +12 -1
  79. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
  80. package/build/components/inspector-controls/fill.js +24 -13
  81. package/build/components/inspector-controls/fill.js.map +1 -1
  82. package/build/components/inspector-controls/groups.js +5 -3
  83. package/build/components/inspector-controls/groups.js.map +1 -1
  84. package/build/components/inspector-controls/slot.js +13 -0
  85. package/build/components/inspector-controls/slot.js.map +1 -1
  86. package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
  87. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  88. package/build/components/link-control/index.js +12 -2
  89. package/build/components/link-control/index.js.map +1 -1
  90. package/build/components/list-view/block-select-button.js +1 -3
  91. package/build/components/list-view/block-select-button.js.map +1 -1
  92. package/build/components/list-view/block.js +13 -1
  93. package/build/components/list-view/block.js.map +1 -1
  94. package/build/components/list-view/use-block-selection.js +29 -24
  95. package/build/components/list-view/use-block-selection.js.map +1 -1
  96. package/build/components/media-placeholder/index.js +2 -2
  97. package/build/components/media-placeholder/index.js.map +1 -1
  98. package/build/components/media-placeholder/index.native.js +11 -11
  99. package/build/components/media-placeholder/index.native.js.map +1 -1
  100. package/build/components/media-replace-flow/index.js +2 -3
  101. package/build/components/media-replace-flow/index.js.map +1 -1
  102. package/build/components/media-upload/constants.js +30 -0
  103. package/build/components/media-upload/constants.js.map +1 -0
  104. package/build/components/media-upload/index.native.js +63 -53
  105. package/build/components/media-upload/index.native.js.map +1 -1
  106. package/build/components/preview-options/index.js +1 -1
  107. package/build/components/preview-options/index.js.map +1 -1
  108. package/build/components/rich-text/index.js +34 -35
  109. package/build/components/rich-text/index.js.map +1 -1
  110. package/build/components/rich-text/index.native.js +14 -32
  111. package/build/components/rich-text/index.native.js.map +1 -1
  112. package/build/components/rich-text/multiline.js +95 -0
  113. package/build/components/rich-text/multiline.js.map +1 -0
  114. package/build/components/rich-text/split-value.js +10 -16
  115. package/build/components/rich-text/split-value.js.map +1 -1
  116. package/build/components/rich-text/use-enter.js +31 -40
  117. package/build/components/rich-text/use-enter.js.map +1 -1
  118. package/build/components/rich-text/use-paste-handler.js +18 -33
  119. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  120. package/build/components/spacing-sizes-control/utils.js +1 -1
  121. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  122. package/build/components/use-block-commands/index.js +30 -18
  123. package/build/components/use-block-commands/index.js.map +1 -1
  124. package/build/components/use-block-display-information/index.js +5 -2
  125. package/build/components/use-block-display-information/index.js.map +1 -1
  126. package/build/hooks/background.js +263 -0
  127. package/build/hooks/background.js.map +1 -0
  128. package/build/hooks/block-hooks.js +188 -0
  129. package/build/hooks/block-hooks.js.map +1 -0
  130. package/build/hooks/block-rename-ui.js +161 -0
  131. package/build/hooks/block-rename-ui.js.map +1 -0
  132. package/build/hooks/duotone.js +29 -42
  133. package/build/hooks/duotone.js.map +1 -1
  134. package/build/hooks/index.js +2 -2
  135. package/build/hooks/index.js.map +1 -1
  136. package/build/hooks/layout.js +31 -14
  137. package/build/hooks/layout.js.map +1 -1
  138. package/build/hooks/position.js +4 -2
  139. package/build/hooks/position.js.map +1 -1
  140. package/build/hooks/style.js +10 -3
  141. package/build/hooks/style.js.map +1 -1
  142. package/build/private-apis.js +2 -0
  143. package/build/private-apis.js.map +1 -1
  144. package/build/store/actions.js +33 -10
  145. package/build/store/actions.js.map +1 -1
  146. package/build/store/private-actions.js +42 -8
  147. package/build/store/private-actions.js.map +1 -1
  148. package/build/store/private-selectors.js +25 -3
  149. package/build/store/private-selectors.js.map +1 -1
  150. package/build/store/reducer.js +43 -1
  151. package/build/store/reducer.js.map +1 -1
  152. package/build/store/selectors.js +84 -23
  153. package/build/store/selectors.js.map +1 -1
  154. package/build/store/utils.js +0 -4
  155. package/build/store/utils.js.map +1 -1
  156. package/build-module/components/block-canvas/index.js +97 -0
  157. package/build-module/components/block-canvas/index.js.map +1 -0
  158. package/build-module/components/block-inspector/index.js +4 -1
  159. package/build-module/components/block-inspector/index.js.map +1 -1
  160. package/build-module/components/block-patterns-list/index.js +30 -10
  161. package/build-module/components/block-patterns-list/index.js.map +1 -1
  162. package/build-module/components/block-patterns-paging/index.js +61 -0
  163. package/build-module/components/block-patterns-paging/index.js.map +1 -0
  164. package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -0
  165. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  166. package/build-module/components/block-settings-menu-controls/index.js +4 -7
  167. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  168. package/build-module/components/block-styles/index.js +1 -0
  169. package/build-module/components/block-styles/index.js.map +1 -1
  170. package/build-module/components/block-toolbar/block-toolbar-menu.native.js +3 -7
  171. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  172. package/build-module/components/block-tools/block-contextual-toolbar.js +18 -7
  173. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  174. package/build-module/components/block-tools/block-selection-button.js +5 -1
  175. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  176. package/build-module/components/border-radius-control/input-controls.js +1 -1
  177. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  178. package/build-module/components/border-radius-control/linked-button.js +2 -4
  179. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  180. package/build-module/components/colors/with-colors.js.map +1 -1
  181. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
  182. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  183. package/build-module/components/default-block-appender/index.native.js +20 -1
  184. package/build-module/components/default-block-appender/index.native.js.map +1 -1
  185. package/build-module/components/duotone/utils.js +65 -0
  186. package/build-module/components/duotone/utils.js.map +1 -1
  187. package/build-module/components/editor-styles/index.js +28 -9
  188. package/build-module/components/editor-styles/index.js.map +1 -1
  189. package/build-module/components/global-styles/hooks.js +3 -100
  190. package/build-module/components/global-styles/hooks.js.map +1 -1
  191. package/build-module/components/global-styles/image-settings-panel.js +53 -0
  192. package/build-module/components/global-styles/image-settings-panel.js.map +1 -0
  193. package/build-module/components/global-styles/index.js +2 -2
  194. package/build-module/components/global-styles/index.js.map +1 -1
  195. package/build-module/components/global-styles/use-global-styles-output.js +18 -16
  196. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  197. package/build-module/components/global-styles/utils.js +1 -1
  198. package/build-module/components/global-styles/utils.js.map +1 -1
  199. package/build-module/components/iframe/index.js +66 -33
  200. package/build-module/components/iframe/index.js.map +1 -1
  201. package/build-module/components/image-editor/use-save-image.js +2 -5
  202. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  203. package/build-module/components/image-editor/use-transform-image.js +9 -9
  204. package/build-module/components/image-editor/use-transform-image.js.map +1 -1
  205. package/build-module/components/index.js +1 -1
  206. package/build-module/components/index.js.map +1 -1
  207. package/build-module/components/index.native.js +2 -1
  208. package/build-module/components/index.native.js.map +1 -1
  209. package/build-module/components/inner-blocks/use-nested-settings-update.js +14 -8
  210. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  211. package/build-module/components/inserter/block-patterns-explorer/explorer.js +12 -6
  212. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  213. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +47 -24
  214. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  215. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +9 -9
  216. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  217. package/build-module/components/inserter/block-patterns-filter.js +128 -0
  218. package/build-module/components/inserter/block-patterns-filter.js.map +1 -0
  219. package/build-module/components/inserter/block-patterns-tab.js +125 -44
  220. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  221. package/build-module/components/inserter/hooks/use-patterns-paging.js +54 -0
  222. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  223. package/build-module/components/inserter/hooks/use-patterns-state.js +22 -10
  224. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  225. package/build-module/components/inserter/menu.js +13 -11
  226. package/build-module/components/inserter/menu.js.map +1 -1
  227. package/build-module/components/inserter/search-results.js +4 -3
  228. package/build-module/components/inserter/search-results.js.map +1 -1
  229. package/build-module/components/inserter/tabs.js +1 -12
  230. package/build-module/components/inserter/tabs.js.map +1 -1
  231. package/build-module/components/inspector-controls/block-support-slot-container.js +13 -2
  232. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
  233. package/build-module/components/inspector-controls/fill.js +25 -14
  234. package/build-module/components/inspector-controls/fill.js.map +1 -1
  235. package/build-module/components/inspector-controls/groups.js +5 -3
  236. package/build-module/components/inspector-controls/groups.js.map +1 -1
  237. package/build-module/components/inspector-controls/slot.js +15 -1
  238. package/build-module/components/inspector-controls/slot.js.map +1 -1
  239. package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
  240. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  241. package/build-module/components/link-control/index.js +12 -2
  242. package/build-module/components/link-control/index.js.map +1 -1
  243. package/build-module/components/list-view/block-select-button.js +1 -3
  244. package/build-module/components/list-view/block-select-button.js.map +1 -1
  245. package/build-module/components/list-view/block.js +13 -1
  246. package/build-module/components/list-view/block.js.map +1 -1
  247. package/build-module/components/list-view/use-block-selection.js +30 -25
  248. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  249. package/build-module/components/media-placeholder/index.js +2 -2
  250. package/build-module/components/media-placeholder/index.js.map +1 -1
  251. package/build-module/components/media-placeholder/index.native.js +7 -7
  252. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  253. package/build-module/components/media-replace-flow/index.js +2 -3
  254. package/build-module/components/media-replace-flow/index.js.map +1 -1
  255. package/build-module/components/media-upload/constants.js +14 -0
  256. package/build-module/components/media-upload/constants.js.map +1 -0
  257. package/build-module/components/media-upload/index.native.js +53 -34
  258. package/build-module/components/media-upload/index.native.js.map +1 -1
  259. package/build-module/components/preview-options/index.js +1 -1
  260. package/build-module/components/preview-options/index.js.map +1 -1
  261. package/build-module/components/rich-text/index.js +35 -37
  262. package/build-module/components/rich-text/index.js.map +1 -1
  263. package/build-module/components/rich-text/index.native.js +15 -33
  264. package/build-module/components/rich-text/index.native.js.map +1 -1
  265. package/build-module/components/rich-text/multiline.js +87 -0
  266. package/build-module/components/rich-text/multiline.js.map +1 -0
  267. package/build-module/components/rich-text/split-value.js +10 -16
  268. package/build-module/components/rich-text/split-value.js.map +1 -1
  269. package/build-module/components/rich-text/use-enter.js +33 -42
  270. package/build-module/components/rich-text/use-enter.js.map +1 -1
  271. package/build-module/components/rich-text/use-paste-handler.js +19 -34
  272. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  273. package/build-module/components/spacing-sizes-control/utils.js +2 -2
  274. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  275. package/build-module/components/use-block-commands/index.js +28 -16
  276. package/build-module/components/use-block-commands/index.js.map +1 -1
  277. package/build-module/components/use-block-display-information/index.js +5 -2
  278. package/build-module/components/use-block-display-information/index.js.map +1 -1
  279. package/build-module/hooks/background.js +249 -0
  280. package/build-module/hooks/background.js.map +1 -0
  281. package/build-module/hooks/block-hooks.js +181 -0
  282. package/build-module/hooks/block-hooks.js.map +1 -0
  283. package/build-module/hooks/block-rename-ui.js +154 -0
  284. package/build-module/hooks/block-rename-ui.js.map +1 -0
  285. package/build-module/hooks/duotone.js +26 -39
  286. package/build-module/hooks/duotone.js.map +1 -1
  287. package/build-module/hooks/index.js +2 -2
  288. package/build-module/hooks/index.js.map +1 -1
  289. package/build-module/hooks/layout.js +33 -16
  290. package/build-module/hooks/layout.js.map +1 -1
  291. package/build-module/hooks/position.js +4 -2
  292. package/build-module/hooks/position.js.map +1 -1
  293. package/build-module/hooks/style.js +10 -3
  294. package/build-module/hooks/style.js.map +1 -1
  295. package/build-module/private-apis.js +2 -0
  296. package/build-module/private-apis.js.map +1 -1
  297. package/build-module/store/actions.js +33 -10
  298. package/build-module/store/actions.js.map +1 -1
  299. package/build-module/store/private-actions.js +39 -8
  300. package/build-module/store/private-actions.js.map +1 -1
  301. package/build-module/store/private-selectors.js +23 -3
  302. package/build-module/store/private-selectors.js.map +1 -1
  303. package/build-module/store/reducer.js +41 -1
  304. package/build-module/store/reducer.js.map +1 -1
  305. package/build-module/store/selectors.js +78 -22
  306. package/build-module/store/selectors.js.map +1 -1
  307. package/build-module/store/utils.js +0 -4
  308. package/build-module/store/utils.js.map +1 -1
  309. package/build-style/content-rtl.css +0 -1
  310. package/build-style/content.css +0 -1
  311. package/build-style/style-rtl.css +201 -131
  312. package/build-style/style.css +201 -131
  313. package/package.json +32 -32
  314. package/src/components/block-canvas/index.js +108 -0
  315. package/src/components/block-inspector/index.js +5 -1
  316. package/src/components/block-list/content.scss +0 -1
  317. package/src/components/block-patterns-list/index.js +53 -19
  318. package/src/components/block-patterns-list/style.scss +26 -9
  319. package/src/components/block-patterns-paging/index.js +92 -0
  320. package/src/components/block-patterns-paging/style.scss +45 -0
  321. package/src/components/block-settings-menu/block-settings-dropdown.js +44 -0
  322. package/src/components/block-settings-menu-controls/index.js +4 -9
  323. package/src/components/block-styles/index.js +1 -0
  324. package/src/components/block-styles/style.scss +3 -3
  325. package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -6
  326. package/src/components/block-tools/block-contextual-toolbar.js +16 -5
  327. package/src/components/block-tools/block-selection-button.js +9 -1
  328. package/src/components/block-tools/style.scss +0 -98
  329. package/src/components/border-radius-control/input-controls.js +1 -1
  330. package/src/components/border-radius-control/linked-button.js +8 -11
  331. package/src/components/color-palette/test/__snapshots__/control.js.snap +34 -21
  332. package/src/components/colors/with-colors.js +3 -2
  333. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -35
  334. package/src/components/default-block-appender/index.native.js +26 -3
  335. package/src/components/duotone/utils.js +65 -0
  336. package/src/components/editor-styles/index.js +32 -23
  337. package/src/components/global-styles/hooks.js +4 -112
  338. package/src/components/global-styles/image-settings-panel.js +71 -0
  339. package/src/components/global-styles/index.js +4 -3
  340. package/src/components/global-styles/use-global-styles-output.js +25 -16
  341. package/src/components/global-styles/utils.js +1 -2
  342. package/src/components/iframe/index.js +72 -33
  343. package/src/components/image-editor/use-save-image.js +2 -9
  344. package/src/components/image-editor/use-transform-image.js +9 -9
  345. package/src/components/index.js +1 -1
  346. package/src/components/index.native.js +2 -2
  347. package/src/components/inner-blocks/use-nested-settings-update.js +15 -10
  348. package/src/components/inserter/block-patterns-explorer/explorer.js +17 -5
  349. package/src/components/inserter/block-patterns-explorer/patterns-list.js +68 -43
  350. package/src/components/inserter/block-patterns-explorer/sidebar.js +8 -8
  351. package/src/components/inserter/block-patterns-filter.js +183 -0
  352. package/src/components/inserter/block-patterns-tab.js +217 -58
  353. package/src/components/inserter/hooks/use-patterns-paging.js +76 -0
  354. package/src/components/inserter/hooks/use-patterns-state.js +27 -16
  355. package/src/components/inserter/menu.js +15 -17
  356. package/src/components/inserter/search-results.js +6 -4
  357. package/src/components/inserter/style.scss +36 -7
  358. package/src/components/inserter/tabs.js +2 -12
  359. package/src/components/inserter/test/index.native.js +8 -12
  360. package/src/components/inspector-controls/block-support-slot-container.js +19 -3
  361. package/src/components/inspector-controls/fill.js +28 -14
  362. package/src/components/inspector-controls/groups.js +6 -2
  363. package/src/components/inspector-controls/slot.js +28 -3
  364. package/src/components/inspector-controls-tabs/styles-tab.js +4 -0
  365. package/src/components/link-control/index.js +13 -0
  366. package/src/components/link-control/style.scss +23 -2
  367. package/src/components/link-control/test/index.js +88 -6
  368. package/src/components/list-view/block-select-button.js +1 -3
  369. package/src/components/list-view/block.js +19 -1
  370. package/src/components/list-view/style.scss +1 -2
  371. package/src/components/list-view/use-block-selection.js +38 -32
  372. package/src/components/media-placeholder/README.md +2 -2
  373. package/src/components/media-placeholder/index.js +2 -2
  374. package/src/components/media-placeholder/index.native.js +11 -12
  375. package/src/components/media-replace-flow/index.js +2 -2
  376. package/src/components/media-replace-flow/test/index.js +5 -23
  377. package/src/components/media-upload/README.md +3 -2
  378. package/src/components/media-upload/constants.js +15 -0
  379. package/src/components/media-upload/index.native.js +66 -40
  380. package/src/components/media-upload/style.native.scss +4 -0
  381. package/src/components/media-upload/test/index.native.js +2 -2
  382. package/src/components/preview-options/README.md +7 -0
  383. package/src/components/preview-options/index.js +1 -1
  384. package/src/components/rich-text/index.js +48 -44
  385. package/src/components/rich-text/index.native.js +14 -42
  386. package/src/components/rich-text/multiline.js +121 -0
  387. package/src/components/rich-text/split-value.js +10 -35
  388. package/src/components/rich-text/use-enter.js +32 -42
  389. package/src/components/rich-text/use-paste-handler.js +16 -40
  390. package/src/components/spacing-sizes-control/style.scss +5 -7
  391. package/src/components/spacing-sizes-control/utils.js +1 -2
  392. package/src/components/use-block-commands/index.js +28 -20
  393. package/src/components/use-block-display-information/index.js +3 -0
  394. package/src/hooks/background.js +299 -0
  395. package/src/hooks/background.scss +75 -0
  396. package/src/hooks/block-hooks.js +257 -0
  397. package/src/hooks/block-hooks.scss +16 -0
  398. package/src/hooks/block-rename-ui.js +231 -0
  399. package/src/hooks/block-rename-ui.scss +3 -0
  400. package/src/hooks/duotone.js +42 -43
  401. package/src/hooks/index.js +2 -2
  402. package/src/hooks/layout.js +31 -33
  403. package/src/hooks/position.js +4 -3
  404. package/src/hooks/style.js +11 -2
  405. package/src/hooks/test/align.native.js +4 -3
  406. package/src/private-apis.js +2 -0
  407. package/src/store/actions.js +52 -10
  408. package/src/store/private-actions.js +37 -6
  409. package/src/store/private-selectors.js +28 -3
  410. package/src/store/reducer.js +38 -0
  411. package/src/store/selectors.js +107 -26
  412. package/src/store/test/actions.js +19 -8
  413. package/src/store/test/private-actions.js +17 -0
  414. package/src/store/test/reducer.js +25 -0
  415. package/src/store/test/selectors.js +130 -123
  416. package/src/store/utils.js +3 -10
  417. package/src/style.scss +4 -0
  418. package/build/components/duotone/components.js +0 -135
  419. package/build/components/duotone/components.js.map +0 -1
  420. package/build/components/duotone/index.js +0 -38
  421. package/build/components/duotone/index.js.map +0 -1
  422. package/build/components/global-styles/behaviors-panel.js +0 -64
  423. package/build/components/global-styles/behaviors-panel.js.map +0 -1
  424. package/build/components/inserter/reusable-blocks-tab.js +0 -85
  425. package/build/components/inserter/reusable-blocks-tab.js.map +0 -1
  426. package/build/hooks/auto-inserting-blocks.js +0 -174
  427. package/build/hooks/auto-inserting-blocks.js.map +0 -1
  428. package/build/hooks/behaviors.js +0 -173
  429. package/build/hooks/behaviors.js.map +0 -1
  430. package/build-module/components/duotone/components.js +0 -126
  431. package/build-module/components/duotone/components.js.map +0 -1
  432. package/build-module/components/duotone/index.js +0 -3
  433. package/build-module/components/duotone/index.js.map +0 -1
  434. package/build-module/components/global-styles/behaviors-panel.js +0 -57
  435. package/build-module/components/global-styles/behaviors-panel.js.map +0 -1
  436. package/build-module/components/inserter/reusable-blocks-tab.js +0 -76
  437. package/build-module/components/inserter/reusable-blocks-tab.js.map +0 -1
  438. package/build-module/hooks/auto-inserting-blocks.js +0 -167
  439. package/build-module/hooks/auto-inserting-blocks.js.map +0 -1
  440. package/build-module/hooks/behaviors.js +0 -166
  441. package/build-module/hooks/behaviors.js.map +0 -1
  442. package/src/components/duotone/components.js +0 -133
  443. package/src/components/duotone/index.js +0 -7
  444. package/src/components/global-styles/behaviors-panel.js +0 -71
  445. package/src/components/inserter/reusable-blocks-tab.js +0 -84
  446. package/src/components/inserter/test/reusable-blocks-tab.js +0 -73
  447. package/src/hooks/auto-inserting-blocks.js +0 -232
  448. package/src/hooks/behaviors.js +0 -206
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","Button","Spinner","Notice","TextControl","__","useRef","useState","useEffect","focus","ENTER","isShallowEqualObjects","useSelect","useDispatch","store","preferencesStore","LinkControlSettingsDrawer","LinkControlSearchInput","LinkPreview","LinkSettings","useCreatePage","useInternalValue","ViewerFill","DEFAULT_LINK_SETTINGS","noop","PREFERENCE_SCOPE","PREFERENCE_KEY","LinkControl","searchInputPlaceholder","value","settings","onChange","onRemove","onCancel","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","settingsOpen","setSettingsOpen","advancedSettingsPreference","select","_prefsStore$get","prefsStore","get","set","setPreference","setSettingsOpenWithPreference","prefVal","isSettingsOpen","isMounting","wrapperNode","textInputRef","isEndingEditWithFocus","settingsKeys","map","id","internalControlValue","setInternalControlValue","setInternalURLInputValue","setInternalTextInputValue","createSetInternalSettingValueHandler","valueHasChanges","isEditingLink","setIsEditingLink","url","createPage","isCreatingPage","errorMessage","current","nextFocusTarget","focusable","find","hasLinkValue","trim","length","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","nonSettingsChanges","Object","keys","reduce","acc","key","includes","title","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","currentInputIsEmpty","preventDefault","resetInternalValues","handleCancel","stopPropagation","shownUnlinkControl","showActions","showTextControl","isEditing","isDisabled","showSettings","createElement","tabIndex","ref","className","Fragment","__nextHasNoMarginBottom","label","onKeyDown","size","currentLink","placeholder","onCreateSuggestion","onSelect","allowDirectEntry","withURLSuggestion","hideLabelFromVision","status","isDismissible","onEditClick","hasUnlinkControl","additionalControls","setting","filter","variant","onClick"],"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Spinner, Notice, TextControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\nimport { isShallowEqualObjects } from '@wordpress/is-shallow-equal';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport LinkSettings from './settings';\nimport useCreatePage from './use-create-page';\nimport useInternalValue from './use-internal-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\nconst noop = () => {};\n\nconst PREFERENCE_SCOPE = 'core/block-editor';\nconst PREFERENCE_KEY = 'linkControlSettingsDrawer';\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\n\tconst { advancedSettingsPreference } = useSelect( ( select ) => {\n\t\tconst prefsStore = select( preferencesStore );\n\n\t\treturn {\n\t\t\tadvancedSettingsPreference:\n\t\t\t\tprefsStore.get( PREFERENCE_SCOPE, PREFERENCE_KEY ) ?? false,\n\t\t};\n\t}, [] );\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\t/**\n\t * Sets the open/closed state of the Advanced Settings Drawer,\n\t * optionlly persisting the state to the user's preferences.\n\t *\n\t * Note that Block Editor components can be consumed by non-WordPress\n\t * environments which may not have preferences setup.\n\t * Therefore a local state is also used as a fallback.\n\t *\n\t * @param {boolean} prefVal the open/closed state of the Advanced Settings Drawer.\n\t */\n\tconst setSettingsOpenWithPreference = ( prefVal ) => {\n\t\tif ( setPreference ) {\n\t\t\tsetPreference( PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal );\n\t\t}\n\t\tsetSettingsOpen( prefVal );\n\t};\n\n\t// Block Editor components can be consumed by non-WordPress environments\n\t// which may not have these preferences setup.\n\t// Therefore a local state is used as a fallback.\n\tconst isSettingsOpen = advancedSettingsPreference || settingsOpen;\n\n\tconst isMounting = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst isEndingEditWithFocus = useRef( false );\n\n\tconst settingsKeys = settings.map( ( { id } ) => id );\n\n\tconst [\n\t\tinternalControlValue,\n\t\tsetInternalControlValue,\n\t\tsetInternalURLInputValue,\n\t\tsetInternalTextInputValue,\n\t\tcreateSetInternalSettingValueHandler,\n\t] = useInternalValue( value );\n\n\tconst valueHasChanges =\n\t\tvalue && ! isShallowEqualObjects( internalControlValue, value );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif ( forceIsEditingLink === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsEditingLink( forceIsEditingLink );\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[ 0 ] ||\n\t\t\twrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocus.current = false;\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tconst stopEditing = () => {\n\t\tisEndingEditWithFocus.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\t// Suggestions may contains \"settings\" values (e.g. `opensInNewTab`)\n\t\t// which should not overide any existing settings values set by the\n\t\t// user. This filters out any settings values from the suggestion.\n\t\tconst nonSettingsChanges = Object.keys( updatedValue ).reduce(\n\t\t\t( acc, key ) => {\n\t\t\t\tif ( ! settingsKeys.includes( key ) ) {\n\t\t\t\t\tacc[ key ] = updatedValue[ key ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\tonChange( {\n\t\t\t...internalControlValue,\n\t\t\t...nonSettingsChanges,\n\t\t\t// As title is not a setting, it must be manually applied\n\t\t\t// in such a way as to preserve the users changes over\n\t\t\t// any \"title\" value provided by the \"suggestion\".\n\t\t\ttitle: internalControlValue?.title || updatedValue?.title,\n\t\t} );\n\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif ( valueHasChanges ) {\n\t\t\t// Submit the original value with new stored values applied\n\t\t\t// on top. URL is a special case as it may also be a prop.\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\t...internalControlValue,\n\t\t\t\turl: currentUrlInputValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalControlValue( value );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst currentUrlInputValue =\n\t\tpropInputValue || internalControlValue?.url || '';\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showActions = isEditingLink && hasLinkValue;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\tconst isDisabled = ! valueHasChanges || currentInputIsEmpty;\n\tconst showSettings = !! settings?.length && isEditingLink && hasLinkValue;\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t\tvalue={ internalControlValue?.title }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalURLInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thideLabelFromVision={ ! showTextControl }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tadditionalControls={ () => {\n\t\t\t\t\t\t// Expose the \"Opens in new tab\" settings in the preview\n\t\t\t\t\t\t// as it is the most common setting to change.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tsettings?.find(\n\t\t\t\t\t\t\t\t( setting ) => setting.id === 'opensInNewTab'\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\t\tsettings={ settings?.filter(\n\t\t\t\t\t\t\t\t\t\t( { id } ) => id === 'opensInNewTab'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\tsetIsEditingLink( true );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettings && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ! currentInputIsEmpty && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ isSettingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpenWithPreference }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\tonChange={ createSetInternalSettingValueHandler(\n\t\t\t\t\t\t\t\t\tsettingsKeys\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</LinkControlSettingsDrawer>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ showActions && (\n\t\t\t\t<div className=\"block-editor-link-control__search-actions\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ isDisabled ? noop : handleSubmit }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ handleCancel }>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\nLinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;\n\nexport default LinkControl;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAEC,WAAW,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AAChE,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,yBAAyB,MAAM,mBAAmB;AACzD,OAAOC,sBAAsB,MAAM,gBAAgB;AACnD,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,YAAY,MAAM,YAAY;AACrC,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,qBAAqB,QAAQ,aAAa;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA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G,CAAC,KAAMA,EAAE,KAAK,eACtB,CAAG;UACHpC,QAAQ,EAAGA;QAAU,CACrB,CAAC;MAEJ;IACD,CAAG;IACHC,QAAQ,EAAGA,CAAA,KAAM;MAChBA,QAAQ,CAAC,CAAC;MACV2C,gBAAgB,CAAE,IAAK,CAAC;IACzB;EAAG,CACH,CACD,EAECyC,YAAY,IACbC,aAAA;IAAKG,SAAS,EAAC;EAAkC,GAC9C,CAAEd,mBAAmB,IACtBW,aAAA,CAACrG,yBAAyB;IACzBiC,YAAY,EAAGW,cAAgB;IAC/BV,eAAe,EAAGQ;EAA+B,GAEjD2D,aAAA,CAAClG,YAAY;IACZU,KAAK,EAAGuC,oBAAsB;IAC9BtC,QAAQ,EAAGA,QAAU;IACrBC,QAAQ,EAAGyC,oCAAoC,CAC9CP,YACD;EAAG,CACH,CACyB,CAExB,CACL,EAEC+C,WAAW,IACZK,aAAA;IAAKG,SAAS,EAAC;EAA2C,GACzDH,aAAA,CAACpH,MAAM;IACN2I,OAAO,EAAC,SAAS;IACjBC,OAAO,EAAG1B,UAAU,GAAG3F,IAAI,GAAG6E,YAAc;IAC5CmB,SAAS,EAAC,0CAA0C;IACpD,iBAAgBL;EAAY,GAE1B9G,EAAE,CAAE,MAAO,CACN,CAAC,EACTgH,aAAA,CAACpH,MAAM;IAAC2I,OAAO,EAAC,UAAU;IAACC,OAAO,EAAGhC;EAAc,GAChDxG,EAAE,CAAE,QAAS,CACR,CACJ,CACL,EAEC0C,mBAAmB,IAAIA,mBAAmB,CAAC,CACzC,CAAC;AAER;AAEApB,WAAW,CAACL,UAAU,GAAGA,UAAU;AACnCK,WAAW,CAACJ,qBAAqB,GAAGA,qBAAqB;AAEzD,eAAeI,WAAW"}
1
+ {"version":3,"names":["classnames","Button","Spinner","Notice","TextControl","__","useRef","useState","useEffect","focus","ENTER","isShallowEqualObjects","useSelect","useDispatch","store","preferencesStore","keyboardReturn","LinkControlSettingsDrawer","LinkControlSearchInput","LinkPreview","LinkSettings","useCreatePage","useInternalValue","ViewerFill","DEFAULT_LINK_SETTINGS","noop","PREFERENCE_SCOPE","PREFERENCE_KEY","LinkControl","searchInputPlaceholder","value","settings","onChange","onRemove","onCancel","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","settingsOpen","setSettingsOpen","advancedSettingsPreference","select","_prefsStore$get","prefsStore","get","set","setPreference","setSettingsOpenWithPreference","prefVal","isSettingsOpen","isMounting","wrapperNode","textInputRef","isEndingEditWithFocus","settingsKeys","map","id","internalControlValue","setInternalControlValue","setInternalURLInputValue","setInternalTextInputValue","createSetInternalSettingValueHandler","valueHasChanges","isEditingLink","setIsEditingLink","url","createPage","isCreatingPage","errorMessage","current","nextFocusTarget","focusable","find","hasLinkValue","trim","length","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","nonSettingsChanges","Object","keys","reduce","acc","key","includes","title","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","currentInputIsEmpty","preventDefault","resetInternalValues","handleCancel","stopPropagation","shownUnlinkControl","showActions","showTextControl","isEditing","isDisabled","showSettings","createElement","tabIndex","ref","className","Fragment","__nextHasNoMarginBottom","label","onKeyDown","size","currentLink","placeholder","onCreateSuggestion","onSelect","allowDirectEntry","withURLSuggestion","hideLabelFromVision","onClick","icon","status","isDismissible","onEditClick","hasUnlinkControl","additionalControls","setting","filter","variant"],"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Spinner, Notice, TextControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\nimport { isShallowEqualObjects } from '@wordpress/is-shallow-equal';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport LinkSettings from './settings';\nimport useCreatePage from './use-create-page';\nimport useInternalValue from './use-internal-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\nconst noop = () => {};\n\nconst PREFERENCE_SCOPE = 'core/block-editor';\nconst PREFERENCE_KEY = 'linkControlSettingsDrawer';\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\n\tconst { advancedSettingsPreference } = useSelect( ( select ) => {\n\t\tconst prefsStore = select( preferencesStore );\n\n\t\treturn {\n\t\t\tadvancedSettingsPreference:\n\t\t\t\tprefsStore.get( PREFERENCE_SCOPE, PREFERENCE_KEY ) ?? false,\n\t\t};\n\t}, [] );\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\t/**\n\t * Sets the open/closed state of the Advanced Settings Drawer,\n\t * optionlly persisting the state to the user's preferences.\n\t *\n\t * Note that Block Editor components can be consumed by non-WordPress\n\t * environments which may not have preferences setup.\n\t * Therefore a local state is also used as a fallback.\n\t *\n\t * @param {boolean} prefVal the open/closed state of the Advanced Settings Drawer.\n\t */\n\tconst setSettingsOpenWithPreference = ( prefVal ) => {\n\t\tif ( setPreference ) {\n\t\t\tsetPreference( PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal );\n\t\t}\n\t\tsetSettingsOpen( prefVal );\n\t};\n\n\t// Block Editor components can be consumed by non-WordPress environments\n\t// which may not have these preferences setup.\n\t// Therefore a local state is used as a fallback.\n\tconst isSettingsOpen = advancedSettingsPreference || settingsOpen;\n\n\tconst isMounting = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst isEndingEditWithFocus = useRef( false );\n\n\tconst settingsKeys = settings.map( ( { id } ) => id );\n\n\tconst [\n\t\tinternalControlValue,\n\t\tsetInternalControlValue,\n\t\tsetInternalURLInputValue,\n\t\tsetInternalTextInputValue,\n\t\tcreateSetInternalSettingValueHandler,\n\t] = useInternalValue( value );\n\n\tconst valueHasChanges =\n\t\tvalue && ! isShallowEqualObjects( internalControlValue, value );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif ( forceIsEditingLink === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsEditingLink( forceIsEditingLink );\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[ 0 ] ||\n\t\t\twrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocus.current = false;\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tconst stopEditing = () => {\n\t\tisEndingEditWithFocus.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\t// Suggestions may contains \"settings\" values (e.g. `opensInNewTab`)\n\t\t// which should not overide any existing settings values set by the\n\t\t// user. This filters out any settings values from the suggestion.\n\t\tconst nonSettingsChanges = Object.keys( updatedValue ).reduce(\n\t\t\t( acc, key ) => {\n\t\t\t\tif ( ! settingsKeys.includes( key ) ) {\n\t\t\t\t\tacc[ key ] = updatedValue[ key ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\tonChange( {\n\t\t\t...internalControlValue,\n\t\t\t...nonSettingsChanges,\n\t\t\t// As title is not a setting, it must be manually applied\n\t\t\t// in such a way as to preserve the users changes over\n\t\t\t// any \"title\" value provided by the \"suggestion\".\n\t\t\ttitle: internalControlValue?.title || updatedValue?.title,\n\t\t} );\n\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif ( valueHasChanges ) {\n\t\t\t// Submit the original value with new stored values applied\n\t\t\t// on top. URL is a special case as it may also be a prop.\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\t...internalControlValue,\n\t\t\t\turl: currentUrlInputValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalControlValue( value );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst currentUrlInputValue =\n\t\tpropInputValue || internalControlValue?.url || '';\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showActions = isEditingLink && hasLinkValue;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\tconst isDisabled = ! valueHasChanges || currentInputIsEmpty;\n\tconst showSettings = !! settings?.length && isEditingLink && hasLinkValue;\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t\t'has-actions': showActions,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t\tvalue={ internalControlValue?.title }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalURLInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thideLabelFromVision={ ! showTextControl }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! showActions && (\n\t\t\t\t\t\t\t<div className=\"block-editor-link-control__search-enter\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tonClick={ isDisabled ? noop : handleSubmit }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Submit' ) }\n\t\t\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tadditionalControls={ () => {\n\t\t\t\t\t\t// Expose the \"Opens in new tab\" settings in the preview\n\t\t\t\t\t\t// as it is the most common setting to change.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tsettings?.find(\n\t\t\t\t\t\t\t\t( setting ) => setting.id === 'opensInNewTab'\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\t\tsettings={ settings?.filter(\n\t\t\t\t\t\t\t\t\t\t( { id } ) => id === 'opensInNewTab'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\tsetIsEditingLink( true );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettings && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ! currentInputIsEmpty && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ isSettingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpenWithPreference }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\tonChange={ createSetInternalSettingValueHandler(\n\t\t\t\t\t\t\t\t\tsettingsKeys\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</LinkControlSettingsDrawer>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ showActions && (\n\t\t\t\t<div className=\"block-editor-link-control__search-actions\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ isDisabled ? noop : handleSubmit }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ handleCancel }>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\nLinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;\n\nexport default LinkControl;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAEC,WAAW,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AAChE,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,cAAc,QAAQ,kBAAkB;;AAEjD;AACA;AACA;AACA,OAAOC,yBAAyB,MAAM,mBAAmB;AACzD,OAAOC,sBAAsB,MAAM,gBAAgB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A,CAACrH,MAAM;IACN8I,OAAO,EAAC,SAAS;IACjBT,OAAO,EAAGlB,UAAU,GAAG3F,IAAI,GAAG6E,YAAc;IAC5CmB,SAAS,EAAC,0CAA0C;IACpD,iBAAgBL;EAAY,GAE1B/G,EAAE,CAAE,MAAO,CACN,CAAC,EACTiH,aAAA,CAACrH,MAAM;IAAC8I,OAAO,EAAC,UAAU;IAACT,OAAO,EAAGxB;EAAc,GAChDzG,EAAE,CAAE,QAAS,CACR,CACJ,CACL,EAEC2C,mBAAmB,IAAIA,mBAAmB,CAAC,CACzC,CAAC;AAER;AAEApB,WAAW,CAACL,UAAU,GAAGA,UAAU;AACnCK,WAAW,CAACJ,qBAAqB,GAAGA,qBAAqB;AAEzD,eAAeI,WAAW"}
@@ -190,11 +190,9 @@ function ListViewBlockSelectButton({
190
190
  ellipsizeMode: "auto"
191
191
  }, blockInformation.anchor)), positionLabel && isSticky && createElement(Tooltip, {
192
192
  text: positionLabel
193
- }, createElement("span", {
194
- className: "block-editor-list-view-block-select-button__sticky"
195
193
  }, createElement(Icon, {
196
194
  icon: pinSmall
197
- }))), images.length ? createElement("span", {
195
+ })), images.length ? createElement("span", {
198
196
  className: "block-editor-list-view-block-select-button__images",
199
197
  "aria-hidden": true
200
198
  }, images.map((image, index) => createElement("span", {
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","hasBlockSupport","Button","__experimentalHStack","HStack","__experimentalTruncate","Truncate","Tooltip","forwardRef","Icon","lockSmall","lock","pinSmall","SPACE","ENTER","BACKSPACE","DELETE","useSelect","useDispatch","__unstableUseShortcutEventMatch","useShortcutEventMatch","__","sprintf","BlockIcon","useBlockDisplayInformation","useBlockDisplayTitle","ListViewExpander","useBlockLock","store","blockEditorStore","useListViewImages","ListViewBlockSelectButton","className","block","clientId","onClick","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaLabel","ariaDescribedBy","updateFocusAndSelection","ref","blockInformation","blockTitle","context","isLocked","canInsertBlockType","getSelectedBlockClientIds","getPreviousBlockClientId","getBlockRootClientId","getBlockOrder","getBlocksByClientId","canRemoveBlocks","duplicateBlocks","removeBlocks","isMatch","isSticky","positionType","images","positionLabel","onDragStartHandler","event","dataTransfer","clearData","getBlocksToUpdate","selectedBlockClientIds","isUpdatingSelectedBlocks","includes","firstBlockClientId","firstBlockRootClientId","blocksToUpdate","onKeyDownHandler","keyCode","_getPreviousBlockClie","blocksToDelete","blockToFocus","shouldUpdateSelection","length","defaultPrevented","preventDefault","canDuplicate","every","name","updatedBlocks","createElement","Fragment","onKeyDown","href","icon","showColors","alignment","justify","spacing","ellipsizeMode","anchor","text","map","image","index","key","style","backgroundImage","url","zIndex"],"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tTooltip,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';\nimport { SPACE, ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\nimport { store as blockEditorStore } from '../../store';\nimport useListViewImages from './use-list-view-images';\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\tisExpanded,\n\t\tariaLabel,\n\t\tariaDescribedBy,\n\t\tupdateFocusAndSelection,\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\tconst {\n\t\tcanInsertBlockType,\n\t\tgetSelectedBlockClientIds,\n\t\tgetPreviousBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { duplicateBlocks, removeBlocks } = useDispatch( blockEditorStore );\n\tconst isMatch = useShortcutEventMatch();\n\tconst isSticky = blockInformation?.positionType === 'sticky';\n\tconst images = useListViewImages( { clientId, isExpanded } );\n\n\tconst positionLabel = blockInformation?.positionLabel\n\t\t? sprintf(\n\t\t\t\t// translators: 1: Position of selected block, e.g. \"Sticky\" or \"Fixed\".\n\t\t\t\t__( 'Position: %1$s' ),\n\t\t\t\tblockInformation.positionLabel\n\t\t )\n\t\t: '';\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\t// Determine which blocks to update:\n\t// If the current (focused) block is part of the block selection, use the whole selection.\n\t// If the focused block is not part of the block selection, only update the focused block.\n\tfunction getBlocksToUpdate() {\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst isUpdatingSelectedBlocks =\n\t\t\tselectedBlockClientIds.includes( clientId );\n\t\tconst firstBlockClientId = isUpdatingSelectedBlocks\n\t\t\t? selectedBlockClientIds[ 0 ]\n\t\t\t: clientId;\n\t\tconst firstBlockRootClientId =\n\t\t\tgetBlockRootClientId( firstBlockClientId );\n\n\t\tconst blocksToUpdate = isUpdatingSelectedBlocks\n\t\t\t? selectedBlockClientIds\n\t\t\t: [ clientId ];\n\n\t\treturn {\n\t\t\tblocksToUpdate,\n\t\t\tfirstBlockClientId,\n\t\t\tfirstBlockRootClientId,\n\t\t\tselectedBlockClientIds,\n\t\t};\n\t}\n\n\t/**\n\t * @param {KeyboardEvent} event\n\t */\n\tasync function onKeyDownHandler( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t} else if (\n\t\t\tevent.keyCode === BACKSPACE ||\n\t\t\tevent.keyCode === DELETE ||\n\t\t\tisMatch( 'core/block-editor/remove', event )\n\t\t) {\n\t\t\tconst {\n\t\t\t\tblocksToUpdate: blocksToDelete,\n\t\t\t\tfirstBlockClientId,\n\t\t\t\tfirstBlockRootClientId,\n\t\t\t\tselectedBlockClientIds,\n\t\t\t} = getBlocksToUpdate();\n\n\t\t\t// Don't update the selection if the blocks cannot be deleted.\n\t\t\tif ( ! canRemoveBlocks( blocksToDelete, firstBlockRootClientId ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet blockToFocus =\n\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ) ??\n\t\t\t\t// If the previous block is not found (when the first block is deleted),\n\t\t\t\t// fallback to focus the parent block.\n\t\t\t\tfirstBlockRootClientId;\n\n\t\t\tremoveBlocks( blocksToDelete, false );\n\n\t\t\t// Update the selection if the original selection has been removed.\n\t\t\tconst shouldUpdateSelection =\n\t\t\t\tselectedBlockClientIds.length > 0 &&\n\t\t\t\tgetSelectedBlockClientIds().length === 0;\n\n\t\t\t// If there's no previous block nor parent block, focus the first block.\n\t\t\tif ( ! blockToFocus ) {\n\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t}\n\n\t\t\tupdateFocusAndSelection( blockToFocus, shouldUpdateSelection );\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\n\t\t\tconst { blocksToUpdate, firstBlockRootClientId } =\n\t\t\t\tgetBlocksToUpdate();\n\n\t\t\tconst canDuplicate = getBlocksByClientId( blocksToUpdate ).every(\n\t\t\t\t( block ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\thasBlockSupport( block.name, 'multiple', true ) &&\n\t\t\t\t\t\tcanInsertBlockType( block.name, firstBlockRootClientId )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( canDuplicate ) {\n\t\t\t\tconst updatedBlocks = await duplicateBlocks(\n\t\t\t\t\tblocksToUpdate,\n\t\t\t\t\tfalse\n\t\t\t\t);\n\n\t\t\t\tif ( updatedBlocks?.length ) {\n\t\t\t\t\t// If blocks have been duplicated, focus the first duplicated block.\n\t\t\t\t\tupdateFocusAndSelection( updatedBlocks[ 0 ], false );\n\t\t\t\t}\n\t\t\t}\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-label={ ariaLabel }\n\t\t\t\taria-describedby={ ariaDescribedBy }\n\t\t\t\taria-expanded={ isExpanded }\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{ positionLabel && isSticky && (\n\t\t\t\t\t\t<Tooltip text={ positionLabel }>\n\t\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__sticky\">\n\t\t\t\t\t\t\t\t<Icon icon={ pinSmall } />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t{ images.length ? (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__images\"\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ images.map( ( image, index ) => (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__image\"\n\t\t\t\t\t\t\t\t\tkey={ image.clientId }\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\tbackgroundImage: `url(${ image.url })`,\n\t\t\t\t\t\t\t\t\t\tzIndex: images.length - index, // Ensure the first image is on top, and subsequent images are behind.\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null }\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"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SACCC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,sBAAsB,IAAIC,QAAQ,EAClCC,OAAO,QACD,uBAAuB;AAC9B,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,IAAI,EAAEC,SAAS,IAAIC,IAAI,EAAEC,QAAQ,QAAQ,kBAAkB;AACpE,SAASC,KAAK,EAAEC,KAAK,EAAEC,SAAS,EAAEC,MAAM,QAAQ,qBAAqB;AACrE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,+BAA+B,IAAIC,qBAAqB,QAAQ,+BAA+B;AACxG,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,0BAA0B,MAAM,kCAAkC;AACzE,OAAOC,oBAAoB,MAAM,wCAAwC;AACzE,OAAOC,gBAAgB,MAAM,YAAY;AACzC,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD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CzD,SAAS,EAAC,mDAAmD;IAC7DwE,GAAG,EAAGF,KAAK,CAACpE,QAAU;IACtBuE,KAAK,EAAG;MACPC,eAAe,EAAG,OAAOJ,KAAK,CAACK,GAAK,GAAE;MACtCC,MAAM,EAAE7C,MAAM,CAACmB,MAAM,GAAGqB,KAAK,CAAE;IAChC;EAAG,CACH,CACA,CACG,CAAC,GACJ,IAAI,EACNrD,QAAQ,IACTuC,aAAA;IAAMzD,SAAS,EAAC;EAAkD,GACjEyD,aAAA,CAAChF,IAAI;IAACoF,IAAI,EAAGlF;EAAM,CAAE,CAChB,CAEA,CACD,CACP,CAAC;AAEL;AAEA,eAAeH,UAAU,CAAEuB,yBAA0B,CAAC"}
1
+ {"version":3,"names":["classnames","hasBlockSupport","Button","__experimentalHStack","HStack","__experimentalTruncate","Truncate","Tooltip","forwardRef","Icon","lockSmall","lock","pinSmall","SPACE","ENTER","BACKSPACE","DELETE","useSelect","useDispatch","__unstableUseShortcutEventMatch","useShortcutEventMatch","__","sprintf","BlockIcon","useBlockDisplayInformation","useBlockDisplayTitle","ListViewExpander","useBlockLock","store","blockEditorStore","useListViewImages","ListViewBlockSelectButton","className","block","clientId","onClick","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaLabel","ariaDescribedBy","updateFocusAndSelection","ref","blockInformation","blockTitle","context","isLocked","canInsertBlockType","getSelectedBlockClientIds","getPreviousBlockClientId","getBlockRootClientId","getBlockOrder","getBlocksByClientId","canRemoveBlocks","duplicateBlocks","removeBlocks","isMatch","isSticky","positionType","images","positionLabel","onDragStartHandler","event","dataTransfer","clearData","getBlocksToUpdate","selectedBlockClientIds","isUpdatingSelectedBlocks","includes","firstBlockClientId","firstBlockRootClientId","blocksToUpdate","onKeyDownHandler","keyCode","_getPreviousBlockClie","blocksToDelete","blockToFocus","shouldUpdateSelection","length","defaultPrevented","preventDefault","canDuplicate","every","name","updatedBlocks","createElement","Fragment","onKeyDown","href","icon","showColors","alignment","justify","spacing","ellipsizeMode","anchor","text","map","image","index","key","style","backgroundImage","url","zIndex"],"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tTooltip,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';\nimport { SPACE, ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\nimport { store as blockEditorStore } from '../../store';\nimport useListViewImages from './use-list-view-images';\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\tisExpanded,\n\t\tariaLabel,\n\t\tariaDescribedBy,\n\t\tupdateFocusAndSelection,\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\tconst {\n\t\tcanInsertBlockType,\n\t\tgetSelectedBlockClientIds,\n\t\tgetPreviousBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { duplicateBlocks, removeBlocks } = useDispatch( blockEditorStore );\n\tconst isMatch = useShortcutEventMatch();\n\tconst isSticky = blockInformation?.positionType === 'sticky';\n\tconst images = useListViewImages( { clientId, isExpanded } );\n\n\tconst positionLabel = blockInformation?.positionLabel\n\t\t? sprintf(\n\t\t\t\t// translators: 1: Position of selected block, e.g. \"Sticky\" or \"Fixed\".\n\t\t\t\t__( 'Position: %1$s' ),\n\t\t\t\tblockInformation.positionLabel\n\t\t )\n\t\t: '';\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\t// Determine which blocks to update:\n\t// If the current (focused) block is part of the block selection, use the whole selection.\n\t// If the focused block is not part of the block selection, only update the focused block.\n\tfunction getBlocksToUpdate() {\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst isUpdatingSelectedBlocks =\n\t\t\tselectedBlockClientIds.includes( clientId );\n\t\tconst firstBlockClientId = isUpdatingSelectedBlocks\n\t\t\t? selectedBlockClientIds[ 0 ]\n\t\t\t: clientId;\n\t\tconst firstBlockRootClientId =\n\t\t\tgetBlockRootClientId( firstBlockClientId );\n\n\t\tconst blocksToUpdate = isUpdatingSelectedBlocks\n\t\t\t? selectedBlockClientIds\n\t\t\t: [ clientId ];\n\n\t\treturn {\n\t\t\tblocksToUpdate,\n\t\t\tfirstBlockClientId,\n\t\t\tfirstBlockRootClientId,\n\t\t\tselectedBlockClientIds,\n\t\t};\n\t}\n\n\t/**\n\t * @param {KeyboardEvent} event\n\t */\n\tasync function onKeyDownHandler( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t} else if (\n\t\t\tevent.keyCode === BACKSPACE ||\n\t\t\tevent.keyCode === DELETE ||\n\t\t\tisMatch( 'core/block-editor/remove', event )\n\t\t) {\n\t\t\tconst {\n\t\t\t\tblocksToUpdate: blocksToDelete,\n\t\t\t\tfirstBlockClientId,\n\t\t\t\tfirstBlockRootClientId,\n\t\t\t\tselectedBlockClientIds,\n\t\t\t} = getBlocksToUpdate();\n\n\t\t\t// Don't update the selection if the blocks cannot be deleted.\n\t\t\tif ( ! canRemoveBlocks( blocksToDelete, firstBlockRootClientId ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet blockToFocus =\n\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ) ??\n\t\t\t\t// If the previous block is not found (when the first block is deleted),\n\t\t\t\t// fallback to focus the parent block.\n\t\t\t\tfirstBlockRootClientId;\n\n\t\t\tremoveBlocks( blocksToDelete, false );\n\n\t\t\t// Update the selection if the original selection has been removed.\n\t\t\tconst shouldUpdateSelection =\n\t\t\t\tselectedBlockClientIds.length > 0 &&\n\t\t\t\tgetSelectedBlockClientIds().length === 0;\n\n\t\t\t// If there's no previous block nor parent block, focus the first block.\n\t\t\tif ( ! blockToFocus ) {\n\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t}\n\n\t\t\tupdateFocusAndSelection( blockToFocus, shouldUpdateSelection );\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\n\t\t\tconst { blocksToUpdate, firstBlockRootClientId } =\n\t\t\t\tgetBlocksToUpdate();\n\n\t\t\tconst canDuplicate = getBlocksByClientId( blocksToUpdate ).every(\n\t\t\t\t( block ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\thasBlockSupport( block.name, 'multiple', true ) &&\n\t\t\t\t\t\tcanInsertBlockType( block.name, firstBlockRootClientId )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( canDuplicate ) {\n\t\t\t\tconst updatedBlocks = await duplicateBlocks(\n\t\t\t\t\tblocksToUpdate,\n\t\t\t\t\tfalse\n\t\t\t\t);\n\n\t\t\t\tif ( updatedBlocks?.length ) {\n\t\t\t\t\t// If blocks have been duplicated, focus the first duplicated block.\n\t\t\t\t\tupdateFocusAndSelection( updatedBlocks[ 0 ], false );\n\t\t\t\t}\n\t\t\t}\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-label={ ariaLabel }\n\t\t\t\taria-describedby={ ariaDescribedBy }\n\t\t\t\taria-expanded={ isExpanded }\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{ positionLabel && isSticky && (\n\t\t\t\t\t\t<Tooltip text={ positionLabel }>\n\t\t\t\t\t\t\t<Icon icon={ pinSmall } />\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t{ images.length ? (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__images\"\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ images.map( ( image, index ) => (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__image\"\n\t\t\t\t\t\t\t\t\tkey={ image.clientId }\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\tbackgroundImage: `url(${ image.url })`,\n\t\t\t\t\t\t\t\t\t\tzIndex: images.length - index, // Ensure the first image is on top, and subsequent images are behind.\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null }\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 );\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
15
  import { useDispatch, useSelect } from '@wordpress/data';
16
16
  import { sprintf, __ } from '@wordpress/i18n';
17
17
  import { focus } from '@wordpress/dom';
18
+ import { ESCAPE } from '@wordpress/keycodes';
18
19
 
19
20
  /**
20
21
  * Internal dependencies
@@ -60,7 +61,7 @@ function ListViewBlock({
60
61
  toggleBlockHighlight
61
62
  } = useDispatch(blockEditorStore);
62
63
  const blockInformation = useBlockDisplayInformation(clientId);
63
- const blockTitle = blockInformation?.title || __('Untitled');
64
+ const blockTitle = blockInformation?.name || blockInformation?.title || __('Untitled');
64
65
  const block = useSelect(select => select(blockEditorStore).getBlock(clientId), [clientId]);
65
66
  const blockName = useSelect(select => select(blockEditorStore).getBlockName(clientId), [clientId]);
66
67
  const blockEditingMode = useSelect(select => select(blockEditorStore).getBlockEditingMode(clientId), [clientId]);
@@ -107,6 +108,16 @@ function ListViewBlock({
107
108
  cellRef.current.focus();
108
109
  }
109
110
  }, []);
111
+
112
+ // If multiple blocks are selected, deselect all blocks when the user
113
+ // presses the escape key.
114
+ const onKeyDown = event => {
115
+ if (event.keyCode === ESCAPE && !event.defaultPrevented && selectedClientIds.length > 0) {
116
+ event.stopPropagation();
117
+ event.preventDefault();
118
+ selectBlock(event, undefined);
119
+ }
120
+ };
110
121
  const onMouseEnter = useCallback(() => {
111
122
  setIsHovered(true);
112
123
  toggleBlockHighlight(clientId, true);
@@ -191,6 +202,7 @@ function ListViewBlock({
191
202
  const currentlyEditingBlockInCanvas = isSelected && selectedClientIds.length === 1;
192
203
  return createElement(ListViewLeaf, {
193
204
  className: classes,
205
+ onKeyDown: onKeyDown,
194
206
  onMouseEnter: onMouseEnter,
195
207
  onMouseLeave: onMouseLeave,
196
208
  onFocus: onMouseEnter,
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","hasBlockSupport","__experimentalTreeGridCell","TreeGridCell","__experimentalTreeGridItem","TreeGridItem","useInstanceId","moreVertical","useState","useRef","useEffect","useCallback","memo","useDispatch","useSelect","sprintf","__","focus","ListViewLeaf","useListViewScrollIntoView","BlockMoverUpButton","BlockMoverDownButton","ListViewBlockContents","useListViewContext","getBlockPositionDescription","store","blockEditorStore","useBlockDisplayInformation","useBlockLock","AriaReferencedText","ListViewBlock","block","clientId","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","isSyncedBranch","cellRef","rowRef","isHovered","setIsHovered","isLocked","canEdit","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","blockInformation","blockTitle","title","select","getBlock","blockName","getBlockName","blockEditingMode","getBlockEditingMode","showBlockActions","instanceId","descriptionId","blockPositionDescription","blockAriaLabel","settingsAriaLabel","isTreeGridMounted","expand","collapse","BlockSettingsMenu","listViewInstanceId","expandedState","setInsertedBlock","treeGridElementRef","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","current","onMouseEnter","onMouseLeave","selectEditorBlock","event","preventDefault","updateFocusAndSelection","focusClientId","shouldSelectBlock","undefined","getFocusElement","row","querySelector","focusable","find","focusElement","window","requestAnimationFrame","toggleExpanded","stopPropagation","colSpan","classes","isSynced","dropdownClientIds","includes","rowItemRef","currentlyEditingBlockInCanvas","createElement","className","onFocus","onBlur","id","ref","tabIndex","onClick","onToggleExpanded","ariaLabel","ariaDescribedBy","Fragment","withoutGridItem","orientation","clientIds","icon","label","toggleProps","disableOpenOnArrowDown","__experimentalSelectBlock"],"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"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';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport useListViewScrollIntoView from './use-list-view-scroll-into-view';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\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';\nimport AriaReferencedText from './aria-referenced-text';\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\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst rowRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\n\tconst { isLocked, canEdit } = useBlockLock( clientId );\n\n\tconst isFirstSelectedBlock =\n\t\tisSelected && selectedClientIds[ 0 ] === clientId;\n\tconst isLastSelectedBlock =\n\t\tisSelected &&\n\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId;\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = blockInformation?.title || __( 'Untitled' );\n\tconst block = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst blockName = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockName( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst blockEditingMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockEditingMode( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tconst showBlockActions =\n\t\t// When a block hides its toolbar it also hides the block settings menu,\n\t\t// since that menu is part of the toolbar in the editor canvas.\n\t\t// List View respects this by also hiding the block settings menu.\n\t\thasBlockSupport( blockName, '__experimentalToolbar', true ) &&\n\t\t// Don't show the settings menu if block is disabled or content only.\n\t\tblockEditingMode === 'default';\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\tconst blockAriaLabel = isLocked\n\t\t? sprintf(\n\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__( '%s (locked)' ),\n\t\t\t\tblockTitle\n\t\t )\n\t\t: blockTitle;\n\n\tconst settingsAriaLabel = sprintf(\n\t\t// translators: %s: The title of the block.\n\t\t__( 'Options for %s' ),\n\t\tblockTitle\n\t);\n\n\tconst {\n\t\tisTreeGridMounted,\n\t\texpand,\n\t\tcollapse,\n\t\tBlockSettingsMenu,\n\t\tlistViewInstanceId,\n\t\texpandedState,\n\t\tsetInsertedBlock,\n\t\ttreeGridElementRef,\n\t} = 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 updateFocusAndSelection = useCallback(\n\t\t( focusClientId, shouldSelectBlock ) => {\n\t\t\tif ( shouldSelectBlock ) {\n\t\t\t\tselectBlock( undefined, focusClientId, null, null );\n\t\t\t}\n\n\t\t\tconst getFocusElement = () => {\n\t\t\t\tconst row = treeGridElementRef.current?.querySelector(\n\t\t\t\t\t`[role=row][data-block=\"${ focusClientId }\"]`\n\t\t\t\t);\n\t\t\t\tif ( ! row ) return null;\n\t\t\t\t// Focus the first focusable in the row, which is the ListViewBlockSelectButton.\n\t\t\t\treturn focus.focusable.find( row )[ 0 ];\n\t\t\t};\n\n\t\t\tlet focusElement = getFocusElement();\n\t\t\tif ( focusElement ) {\n\t\t\t\tfocusElement.focus();\n\t\t\t} else {\n\t\t\t\t// The element hasn't been painted yet. Defer focusing on the next frame.\n\t\t\t\t// This could happen when all blocks have been deleted and the default block\n\t\t\t\t// hasn't been added to the editor yet.\n\t\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\t\tfocusElement = getFocusElement();\n\t\t\t\t\t// Ignore if the element still doesn't exist.\n\t\t\t\t\tif ( focusElement ) {\n\t\t\t\t\t\tfocusElement.focus();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ selectBlock, treeGridElementRef ]\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,\n\t\t'is-first-selected': isFirstSelectedBlock,\n\t\t'is-last-selected': isLastSelectedBlock,\n\t\t'is-branch-selected': isBranchSelected,\n\t\t'is-synced-branch': isSyncedBranch,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\n\t\t'is-synced': blockInformation?.isSynced,\n\t} );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\t// Pass in a ref to the row, so that it can be scrolled\n\t// into view when selected. For long lists, the placeholder for the\n\t// selected block is also observed, within ListViewLeafPlaceholder.\n\tuseListViewScrollIntoView( {\n\t\tisSelected,\n\t\trowItemRef: rowRef,\n\t\tselectedClientIds,\n\t} );\n\n\t// Detect if there is a block in the canvas currently being edited and multi-selection is not happening.\n\tconst currentlyEditingBlockInCanvas =\n\t\tisSelected && selectedClientIds.length === 1;\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-${ listViewInstanceId }-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tdata-expanded={ canEdit ? isExpanded : undefined }\n\t\t\tref={ rowRef }\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-selected={ !! isSelected }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={\n\t\t\t\t\t\t\t\tcurrentlyEditingBlockInCanvas ? 0 : tabIndex\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ canEdit ? isExpanded : undefined }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tariaLabel={ blockAriaLabel }\n\t\t\t\t\t\t\tariaDescribedBy={ descriptionId }\n\t\t\t\t\t\t\tupdateFocusAndSelection={ updateFocusAndSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<AriaReferencedText id={ descriptionId }>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</AriaReferencedText>\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 && BlockSettingsMenu && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsMenu\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\tblock={ block }\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\texpand={ expand }\n\t\t\t\t\t\t\texpandedState={ expandedState }\n\t\t\t\t\t\t\tsetInsertedBlock={ setInsertedBlock }\n\t\t\t\t\t\t\t__experimentalSelectBlock={\n\t\t\t\t\t\t\t\tupdateFocusAndSelection\n\t\t\t\t\t\t\t}\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"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SACCC,0BAA0B,IAAIC,YAAY,EAC1CC,0BAA0B,IAAIC,YAAY,QACpC,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACCC,QAAQ,EACRC,MAAM,EACNC,SAAS,EACTC,WAAW,EACXC,IAAI,QACE,oBAAoB;AAC3B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,QAAQ,gBAAgB;;AAEtC;AACA;AACA;AACA,OAAOC,YAAY,MAAM,QAAQ;AACjC,OAAOC,yBAAyB,MAAM,kCAAkC;AACxE,SACCC,kBAAkB,EAClBC,oBAAoB,QACd,uBAAuB;AAC9B,OAAOC,qBAAqB,MAAM,kBAAkB;AACpD,SAASC,kBAAkB,QAAQ,WAAW;AAC9C,SAASC,2BAA2B,QAAQ,SAAS;AACrD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,0BAA0B,MAAM,kCAA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GAE7B,CAAE;IAAEiF,GAAG;IAAEC,QAAQ;IAAEJ;EAAQ,CAAC,KAC7BF,aAAA,CAACpC,iBAAiB;IACjBkD,SAAS,EAAGlB,iBAAmB;IAC/B3E,KAAK,EAAGA,KAAO;IACf8F,IAAI,EAAGtH,YAAc;IACrBuH,KAAK,EAAGxD,iBAAmB;IAC3ByD,WAAW,EAAG;MACbZ,GAAG;MACHJ,SAAS,EAAE,oCAAoC;MAC/CK,QAAQ;MACRJ;IACD,CAAG;IACHgB,sBAAsB;IACtBxD,MAAM,EAAGA,MAAQ;IACjBI,aAAa,EAAGA,aAAe;IAC/BC,gBAAgB,EAAGA,gBAAkB;IACrCoD,yBAAyB,EACxBxC;EACA,CACD,CAEW,CAEF,CAAC;AAEjB;AAEA,eAAe7E,IAAI,CAAEkB,aAAc,CAAC"}
1
+ {"version":3,"names":["classnames","hasBlockSupport","__experimentalTreeGridCell","TreeGridCell","__experimentalTreeGridItem","TreeGridItem","useInstanceId","moreVertical","useState","useRef","useEffect","useCallback","memo","useDispatch","useSelect","sprintf","__","focus","ESCAPE","ListViewLeaf","useListViewScrollIntoView","BlockMoverUpButton","BlockMoverDownButton","ListViewBlockContents","useListViewContext","getBlockPositionDescription","store","blockEditorStore","useBlockDisplayInformation","useBlockLock","AriaReferencedText","ListViewBlock","block","clientId","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","isSyncedBranch","cellRef","rowRef","isHovered","setIsHovered","isLocked","canEdit","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","blockInformation","blockTitle","name","title","select","getBlock","blockName","getBlockName","blockEditingMode","getBlockEditingMode","showBlockActions","instanceId","descriptionId","blockPositionDescription","blockAriaLabel","settingsAriaLabel","isTreeGridMounted","expand","collapse","BlockSettingsMenu","listViewInstanceId","expandedState","setInsertedBlock","treeGridElementRef","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","current","onKeyDown","event","keyCode","defaultPrevented","stopPropagation","preventDefault","undefined","onMouseEnter","onMouseLeave","selectEditorBlock","updateFocusAndSelection","focusClientId","shouldSelectBlock","getFocusElement","row","querySelector","focusable","find","focusElement","window","requestAnimationFrame","toggleExpanded","colSpan","classes","isSynced","dropdownClientIds","includes","rowItemRef","currentlyEditingBlockInCanvas","createElement","className","onFocus","onBlur","id","ref","tabIndex","onClick","onToggleExpanded","ariaLabel","ariaDescribedBy","Fragment","withoutGridItem","orientation","clientIds","icon","label","toggleProps","disableOpenOnArrowDown","__experimentalSelectBlock"],"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"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';\nimport { focus } from '@wordpress/dom';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport useListViewScrollIntoView from './use-list-view-scroll-into-view';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\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';\nimport AriaReferencedText from './aria-referenced-text';\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\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst rowRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\n\tconst { isLocked, canEdit } = useBlockLock( clientId );\n\n\tconst isFirstSelectedBlock =\n\t\tisSelected && selectedClientIds[ 0 ] === clientId;\n\tconst isLastSelectedBlock =\n\t\tisSelected &&\n\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId;\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle =\n\t\tblockInformation?.name || blockInformation?.title || __( 'Untitled' );\n\n\tconst block = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst blockName = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockName( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst blockEditingMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockEditingMode( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tconst showBlockActions =\n\t\t// When a block hides its toolbar it also hides the block settings menu,\n\t\t// since that menu is part of the toolbar in the editor canvas.\n\t\t// List View respects this by also hiding the block settings menu.\n\t\thasBlockSupport( blockName, '__experimentalToolbar', true ) &&\n\t\t// Don't show the settings menu if block is disabled or content only.\n\t\tblockEditingMode === 'default';\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\tconst blockAriaLabel = isLocked\n\t\t? sprintf(\n\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__( '%s (locked)' ),\n\t\t\t\tblockTitle\n\t\t )\n\t\t: blockTitle;\n\n\tconst settingsAriaLabel = sprintf(\n\t\t// translators: %s: The title of the block.\n\t\t__( 'Options for %s' ),\n\t\tblockTitle\n\t);\n\n\tconst {\n\t\tisTreeGridMounted,\n\t\texpand,\n\t\tcollapse,\n\t\tBlockSettingsMenu,\n\t\tlistViewInstanceId,\n\t\texpandedState,\n\t\tsetInsertedBlock,\n\t\ttreeGridElementRef,\n\t} = 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\t// If multiple blocks are selected, deselect all blocks when the user\n\t// presses the escape key.\n\tconst onKeyDown = ( event ) => {\n\t\tif (\n\t\t\tevent.keyCode === ESCAPE &&\n\t\t\t! event.defaultPrevented &&\n\t\t\tselectedClientIds.length > 0\n\t\t) {\n\t\t\tevent.stopPropagation();\n\t\t\tevent.preventDefault();\n\t\t\tselectBlock( event, undefined );\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 updateFocusAndSelection = useCallback(\n\t\t( focusClientId, shouldSelectBlock ) => {\n\t\t\tif ( shouldSelectBlock ) {\n\t\t\t\tselectBlock( undefined, focusClientId, null, null );\n\t\t\t}\n\n\t\t\tconst getFocusElement = () => {\n\t\t\t\tconst row = treeGridElementRef.current?.querySelector(\n\t\t\t\t\t`[role=row][data-block=\"${ focusClientId }\"]`\n\t\t\t\t);\n\t\t\t\tif ( ! row ) return null;\n\t\t\t\t// Focus the first focusable in the row, which is the ListViewBlockSelectButton.\n\t\t\t\treturn focus.focusable.find( row )[ 0 ];\n\t\t\t};\n\n\t\t\tlet focusElement = getFocusElement();\n\t\t\tif ( focusElement ) {\n\t\t\t\tfocusElement.focus();\n\t\t\t} else {\n\t\t\t\t// The element hasn't been painted yet. Defer focusing on the next frame.\n\t\t\t\t// This could happen when all blocks have been deleted and the default block\n\t\t\t\t// hasn't been added to the editor yet.\n\t\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\t\tfocusElement = getFocusElement();\n\t\t\t\t\t// Ignore if the element still doesn't exist.\n\t\t\t\t\tif ( focusElement ) {\n\t\t\t\t\t\tfocusElement.focus();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ selectBlock, treeGridElementRef ]\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,\n\t\t'is-first-selected': isFirstSelectedBlock,\n\t\t'is-last-selected': isLastSelectedBlock,\n\t\t'is-branch-selected': isBranchSelected,\n\t\t'is-synced-branch': isSyncedBranch,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\n\t\t'is-synced': blockInformation?.isSynced,\n\t} );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\t// Pass in a ref to the row, so that it can be scrolled\n\t// into view when selected. For long lists, the placeholder for the\n\t// selected block is also observed, within ListViewLeafPlaceholder.\n\tuseListViewScrollIntoView( {\n\t\tisSelected,\n\t\trowItemRef: rowRef,\n\t\tselectedClientIds,\n\t} );\n\n\t// Detect if there is a block in the canvas currently being edited and multi-selection is not happening.\n\tconst currentlyEditingBlockInCanvas =\n\t\tisSelected && selectedClientIds.length === 1;\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonKeyDown={ onKeyDown }\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-${ listViewInstanceId }-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tdata-expanded={ canEdit ? isExpanded : undefined }\n\t\t\tref={ rowRef }\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-selected={ !! isSelected }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={\n\t\t\t\t\t\t\t\tcurrentlyEditingBlockInCanvas ? 0 : tabIndex\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ canEdit ? isExpanded : undefined }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tariaLabel={ blockAriaLabel }\n\t\t\t\t\t\t\tariaDescribedBy={ descriptionId }\n\t\t\t\t\t\t\tupdateFocusAndSelection={ updateFocusAndSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<AriaReferencedText id={ descriptionId }>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</AriaReferencedText>\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 && BlockSettingsMenu && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsMenu\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\tblock={ block }\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\texpand={ expand }\n\t\t\t\t\t\t\texpandedState={ expandedState }\n\t\t\t\t\t\t\tsetInsertedBlock={ setInsertedBlock }\n\t\t\t\t\t\t\t__experimentalSelectBlock={\n\t\t\t\t\t\t\t\tupdateFocusAndSelection\n\t\t\t\t\t\t\t}\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"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SACCC,0BAA0B,IAAIC,YAAY,EAC1CC,0BAA0B,IAAIC,YAAY,QACpC,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACCC,QAAQ,EACRC,MAAM,EACNC,SAAS,EACTC,WAAW,EACXC,IAAI,QACE,oBAAoB;AAC3B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,MAAM,QAAQ,qBAAqB;;AAE5C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,QAAQ;AACjC,OAAOC,yBAAyB,MAAM,kCAAkC;AACxE,SACCC,kBAAkB,EAClBC,oBAAoB,QACd,uBAAuB;AAC9B,OAAOC,qBAAqB,MAAM,kBAAkB;AACpD,SAASC,kBAAkB,QAAQ,WAAW;AAC9C,SAASC,2BAA2B,QAAQ,SAAS;AACrD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,0BAA0B,MAAM,kCAAkC;AACzE,SAASC,YAAY,QAAQ,eAAe;AAC5C,OAAOC,kBAAkB,MAAM,wBAAwB;AAEvD,SAASC,aAAaA,CAAE;EACvBC,KAAK,EAAE;IAAEC;EAAS,CAAC;EACnBC,SAAS;EACTC,UAAU;EACVC,gBA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,EAAGA,QAAU;IACrBJ,OAAO,EAAGA;EAAS,CACnB,CAEW,CACD,CACb,CACF,EAEClD,gBAAgB,IAAIS,iBAAiB,IACtCuC,aAAA,CAAChH,YAAY;IACZiH,SAAS,EAAGhC,8BAAgC;IAC5C,iBAAgB,CAAC,CAAEjD;EAAY,GAE7B,CAAE;IAAEqF,GAAG;IAAEC,QAAQ;IAAEJ;EAAQ,CAAC,KAC7BF,aAAA,CAACvC,iBAAiB;IACjBqD,SAAS,EAAGlB,iBAAmB;IAC/B/E,KAAK,EAAGA,KAAO;IACfkG,IAAI,EAAG3H,YAAc;IACrB4H,KAAK,EAAG3D,iBAAmB;IAC3B4D,WAAW,EAAG;MACbZ,GAAG;MACHJ,SAAS,EAAE,oCAAoC;MAC/CK,QAAQ;MACRJ;IACD,CAAG;IACHgB,sBAAsB;IACtB3D,MAAM,EAAGA,MAAQ;IACjBI,aAAa,EAAGA,aAAe;IAC/BC,gBAAgB,EAAGA,gBAAkB;IACrCuD,yBAAyB,EACxBtC;EACA,CACD,CAEW,CAEF,CAAC;AAEjB;AAEA,eAAepF,IAAI,CAAEmB,aAAc,CAAC"}
@@ -5,7 +5,7 @@ import { speak } from '@wordpress/a11y';
5
5
  import { __, sprintf } from '@wordpress/i18n';
6
6
  import { useDispatch, useSelect } from '@wordpress/data';
7
7
  import { useCallback } from '@wordpress/element';
8
- import { UP, DOWN, HOME, END } from '@wordpress/keycodes';
8
+ import { UP, DOWN, HOME, END, ESCAPE } from '@wordpress/keycodes';
9
9
  import { store as blocksStore } from '@wordpress/blocks';
10
10
 
11
11
  /**
@@ -31,7 +31,7 @@ export default function useBlockSelection() {
31
31
  getBlockType
32
32
  } = useSelect(blocksStore);
33
33
  const updateBlockSelection = useCallback(async (event, clientId, destinationClientId, focusPosition) => {
34
- if (!event?.shiftKey) {
34
+ if (!event?.shiftKey && event?.keyCode !== ESCAPE) {
35
35
  selectBlock(clientId, focusPosition);
36
36
  return;
37
37
  }
@@ -39,6 +39,7 @@ export default function useBlockSelection() {
39
39
  // To handle multiple block selection via the `SHIFT` key, prevent
40
40
  // the browser default behavior of opening the link in a new window.
41
41
  event.preventDefault();
42
+ const isOnlyDeselection = event.type === 'keydown' && event.keyCode === ESCAPE;
42
43
  const isKeyPress = event.type === 'keydown' && (event.keyCode === UP || event.keyCode === DOWN || event.keyCode === HOME || event.keyCode === END);
43
44
 
44
45
  // Handle clicking on a block when no blocks are selected, and return early.
@@ -48,38 +49,42 @@ export default function useBlockSelection() {
48
49
  }
49
50
  const selectedBlocks = getSelectedBlockClientIds();
50
51
  const clientIdWithParents = [...getBlockParents(clientId), clientId];
51
- if (isKeyPress && !selectedBlocks.some(blockId => clientIdWithParents.includes(blockId))) {
52
+ if (isOnlyDeselection || isKeyPress && !selectedBlocks.some(blockId => clientIdWithParents.includes(blockId))) {
52
53
  // Ensure that shift-selecting blocks via the keyboard only
53
54
  // expands the current selection if focusing over already
54
55
  // selected blocks. Otherwise, clear the selection so that
55
56
  // a user can create a new selection entirely by keyboard.
56
57
  await clearSelectedBlock();
57
58
  }
58
- let startTarget = getBlockSelectionStart();
59
- let endTarget = clientId;
60
59
 
61
- // Handle keyboard behavior for selecting multiple blocks.
62
- if (isKeyPress) {
63
- if (!hasSelectedBlock() && !hasMultiSelection()) {
64
- // Set the starting point of the selection to the currently
65
- // focused block, if there are no blocks currently selected.
66
- // This ensures that as the selection is expanded or contracted,
67
- // the starting point of the selection is anchored to that block.
68
- startTarget = clientId;
69
- }
70
- if (destinationClientId) {
71
- // If the user presses UP or DOWN, we want to ensure that the block they're
72
- // moving to is the target for selection, and not the currently focused one.
73
- endTarget = destinationClientId;
60
+ // Update selection, if not only clearing the selection.
61
+ if (!isOnlyDeselection) {
62
+ let startTarget = getBlockSelectionStart();
63
+ let endTarget = clientId;
64
+
65
+ // Handle keyboard behavior for selecting multiple blocks.
66
+ if (isKeyPress) {
67
+ if (!hasSelectedBlock() && !hasMultiSelection()) {
68
+ // Set the starting point of the selection to the currently
69
+ // focused block, if there are no blocks currently selected.
70
+ // This ensures that as the selection is expanded or contracted,
71
+ // the starting point of the selection is anchored to that block.
72
+ startTarget = clientId;
73
+ }
74
+ if (destinationClientId) {
75
+ // If the user presses UP or DOWN, we want to ensure that the block they're
76
+ // moving to is the target for selection, and not the currently focused one.
77
+ endTarget = destinationClientId;
78
+ }
74
79
  }
80
+ const startParents = getBlockParents(startTarget);
81
+ const endParents = getBlockParents(endTarget);
82
+ const {
83
+ start,
84
+ end
85
+ } = getCommonDepthClientIds(startTarget, endTarget, startParents, endParents);
86
+ await multiSelect(start, end, null);
75
87
  }
76
- const startParents = getBlockParents(startTarget);
77
- const endParents = getBlockParents(endTarget);
78
- const {
79
- start,
80
- end
81
- } = getCommonDepthClientIds(startTarget, endTarget, startParents, endParents);
82
- await multiSelect(start, end, null);
83
88
 
84
89
  // Announce deselected block, or number of deselected blocks if
85
90
  // the total number of blocks deselected is greater than one.
@@ -1 +1 @@
1
- {"version":3,"names":["speak","__","sprintf","useDispatch","useSelect","useCallback","UP","DOWN","HOME","END","store","blocksStore","blockEditorStore","getCommonDepthClientIds","useBlockSelection","clearSelectedBlock","multiSelect","selectBlock","getBlockName","getBlockParents","getBlockSelectionStart","getSelectedBlockClientIds","hasMultiSelection","hasSelectedBlock","getBlockType","updateBlockSelection","event","clientId","destinationClientId","focusPosition","shiftKey","preventDefault","isKeyPress","type","keyCode","selectedBlocks","clientIdWithParents","some","blockId","includes","startTarget","endTarget","startParents","endParents","start","end","updatedSelectedBlocks","length","selectionDiff","filter","label","title"],"sources":["@wordpress/block-editor/src/components/list-view/use-block-selection.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\nimport { UP, DOWN, HOME, END } from '@wordpress/keycodes';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getCommonDepthClientIds } from './utils';\n\nexport default function useBlockSelection() {\n\tconst { clearSelectedBlock, multiSelect, selectBlock } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlockName,\n\t\tgetBlockParents,\n\t\tgetBlockSelectionStart,\n\t\tgetSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\thasSelectedBlock,\n\t} = useSelect( blockEditorStore );\n\n\tconst { getBlockType } = useSelect( blocksStore );\n\n\tconst updateBlockSelection = useCallback(\n\t\tasync ( event, clientId, destinationClientId, focusPosition ) => {\n\t\t\tif ( ! event?.shiftKey ) {\n\t\t\t\tselectBlock( clientId, focusPosition );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// To handle multiple block selection via the `SHIFT` key, prevent\n\t\t\t// the browser default behavior of opening the link in a new window.\n\t\t\tevent.preventDefault();\n\n\t\t\tconst isKeyPress =\n\t\t\t\tevent.type === 'keydown' &&\n\t\t\t\t( event.keyCode === UP ||\n\t\t\t\t\tevent.keyCode === DOWN ||\n\t\t\t\t\tevent.keyCode === HOME ||\n\t\t\t\t\tevent.keyCode === END );\n\n\t\t\t// Handle clicking on a block when no blocks are selected, and return early.\n\t\t\tif (\n\t\t\t\t! isKeyPress &&\n\t\t\t\t! hasSelectedBlock() &&\n\t\t\t\t! hasMultiSelection()\n\t\t\t) {\n\t\t\t\tselectBlock( clientId, null );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectedBlocks = getSelectedBlockClientIds();\n\t\t\tconst clientIdWithParents = [\n\t\t\t\t...getBlockParents( clientId ),\n\t\t\t\tclientId,\n\t\t\t];\n\n\t\t\tif (\n\t\t\t\tisKeyPress &&\n\t\t\t\t! selectedBlocks.some( ( blockId ) =>\n\t\t\t\t\tclientIdWithParents.includes( blockId )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// Ensure that shift-selecting blocks via the keyboard only\n\t\t\t\t// expands the current selection if focusing over already\n\t\t\t\t// selected blocks. Otherwise, clear the selection so that\n\t\t\t\t// a user can create a new selection entirely by keyboard.\n\t\t\t\tawait clearSelectedBlock();\n\t\t\t}\n\n\t\t\tlet startTarget = getBlockSelectionStart();\n\t\t\tlet endTarget = clientId;\n\n\t\t\t// Handle keyboard behavior for selecting multiple blocks.\n\t\t\tif ( isKeyPress ) {\n\t\t\t\tif ( ! hasSelectedBlock() && ! hasMultiSelection() ) {\n\t\t\t\t\t// Set the starting point of the selection to the currently\n\t\t\t\t\t// focused block, if there are no blocks currently selected.\n\t\t\t\t\t// This ensures that as the selection is expanded or contracted,\n\t\t\t\t\t// the starting point of the selection is anchored to that block.\n\t\t\t\t\tstartTarget = clientId;\n\t\t\t\t}\n\t\t\t\tif ( destinationClientId ) {\n\t\t\t\t\t// If the user presses UP or DOWN, we want to ensure that the block they're\n\t\t\t\t\t// moving to is the target for selection, and not the currently focused one.\n\t\t\t\t\tendTarget = destinationClientId;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst startParents = getBlockParents( startTarget );\n\t\t\tconst endParents = getBlockParents( endTarget );\n\n\t\t\tconst { start, end } = getCommonDepthClientIds(\n\t\t\t\tstartTarget,\n\t\t\t\tendTarget,\n\t\t\t\tstartParents,\n\t\t\t\tendParents\n\t\t\t);\n\t\t\tawait multiSelect( start, end, null );\n\n\t\t\t// Announce deselected block, or number of deselected blocks if\n\t\t\t// the total number of blocks deselected is greater than one.\n\t\t\tconst updatedSelectedBlocks = getSelectedBlockClientIds();\n\n\t\t\t// If the selection is greater than 1 and the Home or End keys\n\t\t\t// were used to generate the selection, then skip announcing the\n\t\t\t// deselected blocks.\n\t\t\tif (\n\t\t\t\t( event.keyCode === HOME || event.keyCode === END ) &&\n\t\t\t\tupdatedSelectedBlocks.length > 1\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectionDiff = selectedBlocks.filter(\n\t\t\t\t( blockId ) => ! updatedSelectedBlocks.includes( blockId )\n\t\t\t);\n\n\t\t\tlet label;\n\t\t\tif ( selectionDiff.length === 1 ) {\n\t\t\t\tconst title = getBlockType(\n\t\t\t\t\tgetBlockName( selectionDiff[ 0 ] )\n\t\t\t\t)?.title;\n\t\t\t\tif ( title ) {\n\t\t\t\t\tlabel = sprintf(\n\t\t\t\t\t\t/* translators: %s: block name */\n\t\t\t\t\t\t__( '%s deselected.' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if ( selectionDiff.length > 1 ) {\n\t\t\t\tlabel = sprintf(\n\t\t\t\t\t/* translators: %s: number of deselected blocks */\n\t\t\t\t\t__( '%s blocks deselected.' ),\n\t\t\t\t\tselectionDiff.length\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( label ) {\n\t\t\t\tspeak( label, 'assertive' );\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tclearSelectedBlock,\n\t\t\tgetBlockName,\n\t\t\tgetBlockType,\n\t\t\tgetBlockParents,\n\t\t\tgetBlockSelectionStart,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\thasMultiSelection,\n\t\t\thasSelectedBlock,\n\t\t\tmultiSelect,\n\t\t\tselectBlock,\n\t\t]\n\t);\n\n\treturn {\n\t\tupdateBlockSelection,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,iBAAiB;AACvC,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,EAAE,EAAEC,IAAI,EAAEC,IAAI,EAAEC,GAAG,QAAQ,qBAAqB;AACzD,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,aAAa;AACvD,SAASC,uBAAuB,QAAQ,SAAS;AAEjD,eAAe,SAASC,iBAAiBA,CAAA,EAAG;EAC3C,M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AAE,gBAAiB,CAAC,EACtBkD,KACD,CAAC;MACF;IACD,CAAC,MAAM,IAAKH,aAAa,CAACD,MAAM,GAAG,CAAC,EAAG;MACtCG,KAAK,GAAGhD,OAAO,EACd;MACAD,EAAE,CAAE,uBAAwB,CAAC,EAC7B+C,aAAa,CAACD,MACf,CAAC;IACF;IAEA,IAAKG,KAAK,EAAG;MACZlD,KAAK,CAAEkD,KAAK,EAAE,WAAY,CAAC;IAC5B;EACD,CAAC,EACD,CACCnC,kBAAkB,EAClBG,YAAY,EACZM,YAAY,EACZL,eAAe,EACfC,sBAAsB,EACtBC,yBAAyB,EACzBC,iBAAiB,EACjBC,gBAAgB,EAChBP,WAAW,EACXC,WAAW,CAEb,CAAC;EAED,OAAO;IACNQ;EACD,CAAC;AACF"}
1
+ {"version":3,"names":["speak","__","sprintf","useDispatch","useSelect","useCallback","UP","DOWN","HOME","END","ESCAPE","store","blocksStore","blockEditorStore","getCommonDepthClientIds","useBlockSelection","clearSelectedBlock","multiSelect","selectBlock","getBlockName","getBlockParents","getBlockSelectionStart","getSelectedBlockClientIds","hasMultiSelection","hasSelectedBlock","getBlockType","updateBlockSelection","event","clientId","destinationClientId","focusPosition","shiftKey","keyCode","preventDefault","isOnlyDeselection","type","isKeyPress","selectedBlocks","clientIdWithParents","some","blockId","includes","startTarget","endTarget","startParents","endParents","start","end","updatedSelectedBlocks","length","selectionDiff","filter","label","title"],"sources":["@wordpress/block-editor/src/components/list-view/use-block-selection.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\nimport { UP, DOWN, HOME, END, ESCAPE } from '@wordpress/keycodes';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getCommonDepthClientIds } from './utils';\n\nexport default function useBlockSelection() {\n\tconst { clearSelectedBlock, multiSelect, selectBlock } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlockName,\n\t\tgetBlockParents,\n\t\tgetBlockSelectionStart,\n\t\tgetSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\thasSelectedBlock,\n\t} = useSelect( blockEditorStore );\n\n\tconst { getBlockType } = useSelect( blocksStore );\n\n\tconst updateBlockSelection = useCallback(\n\t\tasync ( event, clientId, destinationClientId, focusPosition ) => {\n\t\t\tif ( ! event?.shiftKey && event?.keyCode !== ESCAPE ) {\n\t\t\t\tselectBlock( clientId, focusPosition );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// To handle multiple block selection via the `SHIFT` key, prevent\n\t\t\t// the browser default behavior of opening the link in a new window.\n\t\t\tevent.preventDefault();\n\n\t\t\tconst isOnlyDeselection =\n\t\t\t\tevent.type === 'keydown' && event.keyCode === ESCAPE;\n\t\t\tconst isKeyPress =\n\t\t\t\tevent.type === 'keydown' &&\n\t\t\t\t( event.keyCode === UP ||\n\t\t\t\t\tevent.keyCode === DOWN ||\n\t\t\t\t\tevent.keyCode === HOME ||\n\t\t\t\t\tevent.keyCode === END );\n\n\t\t\t// Handle clicking on a block when no blocks are selected, and return early.\n\t\t\tif (\n\t\t\t\t! isKeyPress &&\n\t\t\t\t! hasSelectedBlock() &&\n\t\t\t\t! hasMultiSelection()\n\t\t\t) {\n\t\t\t\tselectBlock( clientId, null );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectedBlocks = getSelectedBlockClientIds();\n\t\t\tconst clientIdWithParents = [\n\t\t\t\t...getBlockParents( clientId ),\n\t\t\t\tclientId,\n\t\t\t];\n\n\t\t\tif (\n\t\t\t\tisOnlyDeselection ||\n\t\t\t\t( isKeyPress &&\n\t\t\t\t\t! selectedBlocks.some( ( blockId ) =>\n\t\t\t\t\t\tclientIdWithParents.includes( blockId )\n\t\t\t\t\t) )\n\t\t\t) {\n\t\t\t\t// Ensure that shift-selecting blocks via the keyboard only\n\t\t\t\t// expands the current selection if focusing over already\n\t\t\t\t// selected blocks. Otherwise, clear the selection so that\n\t\t\t\t// a user can create a new selection entirely by keyboard.\n\t\t\t\tawait clearSelectedBlock();\n\t\t\t}\n\n\t\t\t// Update selection, if not only clearing the selection.\n\t\t\tif ( ! isOnlyDeselection ) {\n\t\t\t\tlet startTarget = getBlockSelectionStart();\n\t\t\t\tlet endTarget = clientId;\n\n\t\t\t\t// Handle keyboard behavior for selecting multiple blocks.\n\t\t\t\tif ( isKeyPress ) {\n\t\t\t\t\tif ( ! hasSelectedBlock() && ! hasMultiSelection() ) {\n\t\t\t\t\t\t// Set the starting point of the selection to the currently\n\t\t\t\t\t\t// focused block, if there are no blocks currently selected.\n\t\t\t\t\t\t// This ensures that as the selection is expanded or contracted,\n\t\t\t\t\t\t// the starting point of the selection is anchored to that block.\n\t\t\t\t\t\tstartTarget = clientId;\n\t\t\t\t\t}\n\t\t\t\t\tif ( destinationClientId ) {\n\t\t\t\t\t\t// If the user presses UP or DOWN, we want to ensure that the block they're\n\t\t\t\t\t\t// moving to is the target for selection, and not the currently focused one.\n\t\t\t\t\t\tendTarget = destinationClientId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst startParents = getBlockParents( startTarget );\n\t\t\t\tconst endParents = getBlockParents( endTarget );\n\n\t\t\t\tconst { start, end } = getCommonDepthClientIds(\n\t\t\t\t\tstartTarget,\n\t\t\t\t\tendTarget,\n\t\t\t\t\tstartParents,\n\t\t\t\t\tendParents\n\t\t\t\t);\n\t\t\t\tawait multiSelect( start, end, null );\n\t\t\t}\n\n\t\t\t// Announce deselected block, or number of deselected blocks if\n\t\t\t// the total number of blocks deselected is greater than one.\n\t\t\tconst updatedSelectedBlocks = getSelectedBlockClientIds();\n\n\t\t\t// If the selection is greater than 1 and the Home or End keys\n\t\t\t// were used to generate the selection, then skip announcing the\n\t\t\t// deselected blocks.\n\t\t\tif (\n\t\t\t\t( event.keyCode === HOME || event.keyCode === END ) &&\n\t\t\t\tupdatedSelectedBlocks.length > 1\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectionDiff = selectedBlocks.filter(\n\t\t\t\t( blockId ) => ! updatedSelectedBlocks.includes( blockId )\n\t\t\t);\n\n\t\t\tlet label;\n\t\t\tif ( selectionDiff.length === 1 ) {\n\t\t\t\tconst title = getBlockType(\n\t\t\t\t\tgetBlockName( selectionDiff[ 0 ] )\n\t\t\t\t)?.title;\n\t\t\t\tif ( title ) {\n\t\t\t\t\tlabel = sprintf(\n\t\t\t\t\t\t/* translators: %s: block name */\n\t\t\t\t\t\t__( '%s deselected.' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if ( selectionDiff.length > 1 ) {\n\t\t\t\tlabel = sprintf(\n\t\t\t\t\t/* translators: %s: number of deselected blocks */\n\t\t\t\t\t__( '%s blocks deselected.' ),\n\t\t\t\t\tselectionDiff.length\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( label ) {\n\t\t\t\tspeak( label, 'assertive' );\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tclearSelectedBlock,\n\t\t\tgetBlockName,\n\t\t\tgetBlockType,\n\t\t\tgetBlockParents,\n\t\t\tgetBlockSelectionStart,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\thasMultiSelection,\n\t\t\thasSelectedBlock,\n\t\t\tmultiSelect,\n\t\t\tselectBlock,\n\t\t]\n\t);\n\n\treturn {\n\t\tupdateBlockSelection,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,iBAAiB;AACvC,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,EAAE,EAAEC,IAAI,EAAEC,IAAI,EAAEC,GAAG,EAAEC,MAAM,QAAQ,q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AqB,CAACC,MAAM,GAAG,CAAC,EAC/B;MACD;IACD;IAEA,MAAMC,aAAa,GAAGb,cAAc,CAACc,MAAM,CACxCX,OAAO,IAAM,CAAEQ,qBAAqB,CAACP,QAAQ,CAAED,OAAQ,CAC1D,CAAC;IAED,IAAIY,KAAK;IACT,IAAKF,aAAa,CAACD,MAAM,KAAK,CAAC,EAAG;MACjC,MAAMI,KAAK,GAAG5B,YAAY,CACzBN,YAAY,CAAE+B,aAAa,CAAE,CAAC,CAAG,CAClC,CAAC,EAAEG,KAAK;MACR,IAAKA,KAAK,EAAG;QACZD,KAAK,GAAGlD,OAAO,EACd;QACAD,EAAE,CAAE,gBAAiB,CAAC,EACtBoD,KACD,CAAC;MACF;IACD,CAAC,MAAM,IAAKH,aAAa,CAACD,MAAM,GAAG,CAAC,EAAG;MACtCG,KAAK,GAAGlD,OAAO,EACd;MACAD,EAAE,CAAE,uBAAwB,CAAC,EAC7BiD,aAAa,CAACD,MACf,CAAC;IACF;IAEA,IAAKG,KAAK,EAAG;MACZpD,KAAK,CAAEoD,KAAK,EAAE,WAAY,CAAC;IAC5B;EACD,CAAC,EACD,CACCpC,kBAAkB,EAClBG,YAAY,EACZM,YAAY,EACZL,eAAe,EACfC,sBAAsB,EACtBC,yBAAyB,EACzBC,iBAAiB,EACjBC,gBAAgB,EAChBP,WAAW,EACXC,WAAW,CAEb,CAAC;EAED,OAAO;IACNQ;EACD,CAAC;AACF"}
@@ -360,7 +360,7 @@ export function MediaPlaceholder({
360
360
  return createElement(Fragment, null, renderDropZone(), createElement(FormFileUpload, {
361
361
  onChange: onUpload,
362
362
  accept: accept,
363
- multiple: multiple,
363
+ multiple: !!multiple,
364
364
  render: ({
365
365
  openFileDialog
366
366
  }) => {
@@ -379,7 +379,7 @@ export function MediaPlaceholder({
379
379
  className: classnames('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button'),
380
380
  onChange: onUpload,
381
381
  accept: accept,
382
- multiple: multiple
382
+ multiple: !!multiple
383
383
  }, __('Upload')), uploadMediaLibraryButton, renderUrlSelectionUI(), renderFeaturedImageToggle(), renderCancelLink());
384
384
  return renderPlaceholder(content);
385
385
  }