@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":["_blocks","require","_components","_i18n","_blockStyles","_interopRequireDefault","_defaultStylePicker","_inspectorControls","StylesTab","blockName","clientId","hasBlockStyles","_element","createElement","Fragment","PanelBody","title","__","default","hasBlockSupport","Slot","group","label","className","_default","exports"],"sources":["@wordpress/block-editor/src/components/inspector-controls-tabs/styles-tab.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockStyles from '../block-styles';\nimport DefaultStylePicker from '../default-style-picker';\nimport InspectorControls from '../inspector-controls';\n\nconst StylesTab = ( { blockName, clientId, hasBlockStyles } ) => {\n\treturn (\n\t\t<>\n\t\t\t{ hasBlockStyles && (\n\t\t\t\t<div>\n\t\t\t\t\t<PanelBody title={ __( 'Styles' ) }>\n\t\t\t\t\t\t<BlockStyles clientId={ clientId } />\n\t\t\t\t\t\t{ hasBlockSupport(\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\t'defaultStylePicker',\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t) && <DefaultStylePicker blockName={ blockName } /> }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"color\"\n\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"filter\" />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"typography\"\n\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"border\" label={ __( 'Border' ) } />\n\t\t\t<InspectorControls.Slot group=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N,kBAAA,CAAAW,OAAiB,CAACE,IAAI;IACtBC,KAAK,EAAC,YAAY;IAClBC,KAAK,EAAG,IAAAL,QAAE,EAAE,YAAa;EAAG,CAC5B,CAAC,EACF,IAAAL,QAAA,CAAAC,aAAA,EAACN,kBAAA,CAAAW,OAAiB,CAACE,IAAI;IACtBC,KAAK,EAAC,YAAY;IAClBC,KAAK,EAAG,IAAAL,QAAE,EAAE,YAAa;EAAG,CAC5B,CAAC,EACF,IAAAL,QAAA,CAAAC,aAAA,EAACN,kBAAA,CAAAW,OAAiB,CAACE,IAAI;IAACC,KAAK,EAAC,QAAQ;IAACC,KAAK,EAAG,IAAAL,QAAE,EAAE,QAAS;EAAG,CAAE,CAAC,EAClE,IAAAL,QAAA,CAAAC,aAAA,EAACN,kBAAA,CAAAW,OAAiB,CAACE,IAAI;IAACC,KAAK,EAAC;EAAQ,CAAE,CACvC,CAAC;AAEL,CAAC;AAAC,IAAAG,QAAA,GAEahB,SAAS;AAAAiB,OAAA,CAAAP,OAAA,GAAAM,QAAA"}
1
+ {"version":3,"names":["_blocks","require","_components","_i18n","_blockStyles","_interopRequireDefault","_defaultStylePicker","_inspectorControls","StylesTab","blockName","clientId","hasBlockStyles","_element","createElement","Fragment","PanelBody","title","__","default","hasBlockSupport","Slot","group","label","className","_default","exports"],"sources":["@wordpress/block-editor/src/components/inspector-controls-tabs/styles-tab.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockStyles from '../block-styles';\nimport DefaultStylePicker from '../default-style-picker';\nimport InspectorControls from '../inspector-controls';\n\nconst StylesTab = ( { blockName, clientId, hasBlockStyles } ) => {\n\treturn (\n\t\t<>\n\t\t\t{ hasBlockStyles && (\n\t\t\t\t<div>\n\t\t\t\t\t<PanelBody title={ __( 'Styles' ) }>\n\t\t\t\t\t\t<BlockStyles clientId={ clientId } />\n\t\t\t\t\t\t{ hasBlockSupport(\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\t'defaultStylePicker',\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t) && <DefaultStylePicker blockName={ blockName } /> }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"color\"\n\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"background\"\n\t\t\t\tlabel={ __( 'Background' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"filter\" />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"typography\"\n\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"border\" label={ __( 'Border' ) } />\n\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t</>\n\t);\n};\n\nexport default StylesTab;\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,YAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,kBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AAZA;AACA;AACA;;AAKA;AACA;AACA;;AAKA,MAAMO,SAAS,GAAGA,CAAE;EAAEC,SAAS;EAAEC,QAAQ;EAAEC;AAAe,CAAC,KAAM;EAChE,OACC,IAAAC,QAAA,CAAAC,aAAA,EAAAD,QAAA,CAAAE,QAAA,QACGH,cAAc,IACf,IAA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ACE,IAAI;IAACC,KAAK,EAAC,QAAQ;IAACC,KAAK,EAAG,IAAAL,QAAE,EAAE,QAAS;EAAG,CAAE,CAAC,EAClE,IAAAL,QAAA,CAAAC,aAAA,EAACN,kBAAA,CAAAW,OAAiB,CAACE,IAAI;IAACC,KAAK,EAAC;EAAQ,CAAE,CACvC,CAAC;AAEL,CAAC;AAAC,IAAAG,QAAA,GAEahB,SAAS;AAAAiB,OAAA,CAAAP,OAAA,GAAAM,QAAA"}
@@ -14,6 +14,7 @@ var _keycodes = require("@wordpress/keycodes");
14
14
  var _isShallowEqual = require("@wordpress/is-shallow-equal");
15
15
  var _data = require("@wordpress/data");
16
16
  var _preferences = require("@wordpress/preferences");
17
+ var _icons = require("@wordpress/icons");
17
18
  var _settingsDrawer = _interopRequireDefault(require("./settings-drawer"));
18
19
  var _searchInput = _interopRequireDefault(require("./search-input"));
19
20
  var _linkPreview = _interopRequireDefault(require("./link-preview"));
@@ -308,7 +309,8 @@ function LinkControl({
308
309
  }, (0, _element.createElement)(_components.Spinner, null), " ", (0, _i18n.__)('Creating'), "\u2026"), isEditing && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
309
310
  className: (0, _classnames.default)({
310
311
  'block-editor-link-control__search-input-wrapper': true,
311
- 'has-text-control': showTextControl
312
+ 'has-text-control': showTextControl,
313
+ 'has-actions': showActions
312
314
  })
313
315
  }, showTextControl && (0, _element.createElement)(_components.TextControl, {
314
316
  __nextHasNoMarginBottom: true,
@@ -335,7 +337,15 @@ function LinkControl({
335
337
  withURLSuggestion: !noURLSuggestion,
336
338
  createSuggestionButtonText: createSuggestionButtonText,
337
339
  hideLabelFromVision: !showTextControl
338
- })), errorMessage && (0, _element.createElement)(_components.Notice, {
340
+ }), !showActions && (0, _element.createElement)("div", {
341
+ className: "block-editor-link-control__search-enter"
342
+ }, (0, _element.createElement)(_components.Button, {
343
+ onClick: isDisabled ? noop : handleSubmit,
344
+ label: (0, _i18n.__)('Submit'),
345
+ icon: _icons.keyboardReturn,
346
+ className: "block-editor-link-control__search-submit",
347
+ "aria-disabled": isDisabled
348
+ }))), errorMessage && (0, _element.createElement)(_components.Notice, {
339
349
  className: "block-editor-link-control__search-error",
340
350
  status: "error",
341
351
  isDismissible: false
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_components","_i18n","_dom","_keycodes","_isShallowEqual","_data","_preferences","_settingsDrawer","_searchInput","_linkPreview","_settings","_useCreatePage","_useInternalValue","_viewerSlot","_constants","noop","PREFERENCE_SCOPE","PREFERENCE_KEY","LinkControl","searchInputPlaceholder","value","settings","DEFAULT_LINK_SETTINGS","onChange","onRemove","onCancel","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","settingsOpen","setSettingsOpen","useState","advancedSettingsPreference","useSelect","select","_prefsStore$get","prefsStore","preferencesStore","get","set","setPreference","useDispatch","setSettingsOpenWithPreference","prefVal","isSettingsOpen","isMounting","useRef","wrapperNode","textInputRef","isEndingEditWithFocus","settingsKeys","map","id","internalControlValue","setInternalControlValue","setInternalURLInputValue","setInternalTextInputValue","createSetInternalSettingValueHandler","useInternalValue","valueHasChanges","isShallowEqualObjects","isEditingLink","setIsEditingLink","url","createPage","isCreatingPage","errorMessage","useCreatePage","useEffect","current","nextFocusTarget","focus","focusable","find","hasLinkValue","trim","length","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","nonSettingsChanges","Object","keys","reduce","acc","key","includes","title","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","ENTER","currentInputIsEmpty","preventDefault","resetInternalValues","handleCancel","stopPropagation","shownUnlinkControl","showActions","showTextControl","isEditing","isDisabled","showSettings","createElement","tabIndex","ref","className","Spinner","__","Fragment","classnames","TextControl","__nextHasNoMarginBottom","label","onKeyDown","size","default","currentLink","placeholder","onCreateSuggestion","onSelect","allowDirectEntry","withURLSuggestion","hideLabelFromVision","Notice","status","isDismissible","onEditClick","hasUnlinkControl","additionalControls","setting","filter","Button","variant","onClick","ViewerFill","_default","exports"],"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":";;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAPA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AAKA,IAAAU,eAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,YAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,YAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,SAAA,GAAAX,sBAAA,CAAAF,OAAA;AACA,IAAAc,cAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,iBAAA,GAAAb,sBAAA,CAAAF,OAAA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CACyB,CAExB,CACL,EAECqD,WAAW,IACZ,IAAAvH,QAAA,CAAA4H,aAAA;IAAKG,SAAS,EAAC;EAA2C,GACzD,IAAA/H,QAAA,CAAA4H,aAAA,EAACxH,WAAA,CAAAqJ,MAAM;IACNC,OAAO,EAAC,SAAS;IACjBC,OAAO,EAAGjC,UAAU,GAAGvG,IAAI,GAAGwF,YAAc;IAC5CoB,SAAS,EAAC,0CAA0C;IACpD,iBAAgBL;EAAY,GAE1B,IAAAO,QAAE,EAAE,MAAO,CACN,CAAC,EACT,IAAAjI,QAAA,CAAA4H,aAAA,EAACxH,WAAA,CAAAqJ,MAAM;IAACC,OAAO,EAAC,UAAU;IAACC,OAAO,EAAGvC;EAAc,GAChD,IAAAa,QAAE,EAAE,QAAS,CACR,CACJ,CACL,EAECtF,mBAAmB,IAAIA,mBAAmB,CAAC,CACzC,CAAC;AAER;AAEArB,WAAW,CAACsI,UAAU,GAAGA,sBAAU;AACnCtI,WAAW,CAACI,qBAAqB,GAAGA,gCAAqB;AAAC,IAAAmI,QAAA,GAE3CvI,WAAW;AAAAwI,OAAA,CAAArB,OAAA,GAAAoB,QAAA"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_components","_i18n","_dom","_keycodes","_isShallowEqual","_data","_preferences","_icons","_settingsDrawer","_searchInput","_linkPreview","_settings","_useCreatePage","_useInternalValue","_viewerSlot","_constants","noop","PREFERENCE_SCOPE","PREFERENCE_KEY","LinkControl","searchInputPlaceholder","value","settings","DEFAULT_LINK_SETTINGS","onChange","onRemove","onCancel","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","settingsOpen","setSettingsOpen","useState","advancedSettingsPreference","useSelect","select","_prefsStore$get","prefsStore","preferencesStore","get","set","setPreference","useDispatch","setSettingsOpenWithPreference","prefVal","isSettingsOpen","isMounting","useRef","wrapperNode","textInputRef","isEndingEditWithFocus","settingsKeys","map","id","internalControlValue","setInternalControlValue","setInternalURLInputValue","setInternalTextInputValue","createSetInternalSettingValueHandler","useInternalValue","valueHasChanges","isShallowEqualObjects","isEditingLink","setIsEditingLink","url","createPage","isCreatingPage","errorMessage","useCreatePage","useEffect","current","nextFocusTarget","focus","focusable","find","hasLinkValue","trim","length","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","nonSettingsChanges","Object","keys","reduce","acc","key","includes","title","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","ENTER","currentInputIsEmpty","preventDefault","resetInternalValues","handleCancel","stopPropagation","shownUnlinkControl","showActions","showTextControl","isEditing","isDisabled","showSettings","createElement","tabIndex","ref","className","Spinner","__","Fragment","classnames","TextControl","__nextHasNoMarginBottom","label","onKeyDown","size","default","currentLink","placeholder","onCreateSuggestion","onSelect","allowDirectEntry","withURLSuggestion","hideLabelFromVision","Button","onClick","icon","keyboardReturn","Notice","status","isDismissible","onEditClick","hasUnlinkControl","additionalControls","setting","filter","variant","ViewerFill","_default","exports"],"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":";;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAPA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAKA,IAAAW,eAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,YAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,YAAA,GAAAX,sBAAA,CAAAF,OAAA;AACA,IAAAc,SAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,cAAA,GAAAb,sBAAA,CAAAF,OAAA;AACA,IAAAgB,iBAAA,GAAAd,sBAAA,CAAAF,OAAA;AACA,IAAAiB,WAAA,GAAAjB,OAAA;AACA,IAAAkB,UAAA,GAAAlB,OAAA;AA5BA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;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D,IAAA3D,QAAA,CAAA6H,aAAA,EAAC9G,SAAA,CAAA2H,OAAY;IACZjH,KAAK,EAAG6C,oBAAsB;IAC9B5C,QAAQ,EAAGA,QAAU;IACrBE,QAAQ,EAAG8C,oCAAoC,CAC9CP,YACD;EAAG,CACH,CACyB,CAExB,CACL,EAECqD,WAAW,IACZ,IAAAxH,QAAA,CAAA6H,aAAA;IAAKG,SAAS,EAAC;EAA2C,GACzD,IAAAhI,QAAA,CAAA6H,aAAA,EAACzH,WAAA,CAAA8I,MAAM;IACNY,OAAO,EAAC,SAAS;IACjBX,OAAO,EAAGxB,UAAU,GAAGvG,IAAI,GAAGwF,YAAc;IAC5CoB,SAAS,EAAC,0CAA0C;IACpD,iBAAgBL;EAAY,GAE1B,IAAAO,QAAE,EAAE,MAAO,CACN,CAAC,EACT,IAAAlI,QAAA,CAAA6H,aAAA,EAACzH,WAAA,CAAA8I,MAAM;IAACY,OAAO,EAAC,UAAU;IAACX,OAAO,EAAG9B;EAAc,GAChD,IAAAa,QAAE,EAAE,QAAS,CACR,CACJ,CACL,EAECtF,mBAAmB,IAAIA,mBAAmB,CAAC,CACzC,CAAC;AAER;AAEArB,WAAW,CAACwI,UAAU,GAAGA,sBAAU;AACnCxI,WAAW,CAACI,qBAAqB,GAAGA,gCAAqB;AAAC,IAAAqI,QAAA,GAE3CzI,WAAW;AAAA0I,OAAA,CAAAvB,OAAA,GAAAsB,QAAA"}
@@ -197,11 +197,9 @@ function ListViewBlockSelectButton({
197
197
  ellipsizeMode: "auto"
198
198
  }, blockInformation.anchor)), positionLabel && isSticky && (0, _element.createElement)(_components.Tooltip, {
199
199
  text: positionLabel
200
- }, (0, _element.createElement)("span", {
201
- className: "block-editor-list-view-block-select-button__sticky"
202
200
  }, (0, _element.createElement)(_icons.Icon, {
203
201
  icon: _icons.pinSmall
204
- }))), images.length ? (0, _element.createElement)("span", {
202
+ })), images.length ? (0, _element.createElement)("span", {
205
203
  className: "block-editor-list-view-block-select-button__images",
206
204
  "aria-hidden": true
207
205
  }, images.map((image, index) => (0, _element.createElement)("span", {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_blocks","_components","_icons","_keycodes","_data","_keyboardShortcuts","_i18n","_blockIcon","_useBlockDisplayInformation","_useBlockDisplayTitle","_expander","_blockLock","_store","_useListViewImages","ListViewBlockSelectButton","className","block","clientId","onClick","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaLabel","ariaDescribedBy","updateFocusAndSelection","ref","blockInformation","useBlockDisplayInformation","blockTitle","useBlockDisplayTitle","context","isLocked","useBlockLock","canInsertBlockType","getSelectedBlockClientIds","getPreviousBlockClientId","getBlockRootClientId","getBlockOrder","getBlocksByClientId","canRemoveBlocks","useSelect","blockEditorStore","duplicateBlocks","removeBlocks","useDispatch","isMatch","useShortcutEventMatch","isSticky","positionType","images","useListViewImages","positionLabel","sprintf","__","onDragStartHandler","event","dataTransfer","clearData","getBlocksToUpdate","selectedBlockClientIds","isUpdatingSelectedBlocks","includes","firstBlockClientId","firstBlockRootClientId","blocksToUpdate","onKeyDownHandler","keyCode","ENTER","SPACE","BACKSPACE","DELETE","_getPreviousBlockClie","blocksToDelete","blockToFocus","shouldUpdateSelection","length","defaultPrevented","preventDefault","canDuplicate","every","hasBlockSupport","name","updatedBlocks","createElement","Fragment","Button","classnames","onKeyDown","href","default","icon","showColors","__experimentalHStack","alignment","justify","spacing","__experimentalTruncate","ellipsizeMode","anchor","Tooltip","text","Icon","pinSmall","map","image","index","key","style","backgroundImage","url","zIndex","lock","_default","forwardRef","exports"],"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":";;;;;;;AAeA,IAAAA,QAAA,GAAAC,OAAA;AAZA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAOA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,G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ACjE,IAAAnB,QAAA,CAAA2F,aAAA,EAACrF,MAAA,CAAAuG,IAAI;IAACX,IAAI,EAAGqB;EAAM,CAAE,CAChB,CAEA,CACD,CACP,CAAC;AAEL;AAAC,IAAAC,QAAA,GAEc,IAAAC,mBAAU,EAAEvG,yBAA0B,CAAC;AAAAwG,OAAA,CAAAzB,OAAA,GAAAuB,QAAA"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_blocks","_components","_icons","_keycodes","_data","_keyboardShortcuts","_i18n","_blockIcon","_useBlockDisplayInformation","_useBlockDisplayTitle","_expander","_blockLock","_store","_useListViewImages","ListViewBlockSelectButton","className","block","clientId","onClick","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaLabel","ariaDescribedBy","updateFocusAndSelection","ref","blockInformation","useBlockDisplayInformation","blockTitle","useBlockDisplayTitle","context","isLocked","useBlockLock","canInsertBlockType","getSelectedBlockClientIds","getPreviousBlockClientId","getBlockRootClientId","getBlockOrder","getBlocksByClientId","canRemoveBlocks","useSelect","blockEditorStore","duplicateBlocks","removeBlocks","useDispatch","isMatch","useShortcutEventMatch","isSticky","positionType","images","useListViewImages","positionLabel","sprintf","__","onDragStartHandler","event","dataTransfer","clearData","getBlocksToUpdate","selectedBlockClientIds","isUpdatingSelectedBlocks","includes","firstBlockClientId","firstBlockRootClientId","blocksToUpdate","onKeyDownHandler","keyCode","ENTER","SPACE","BACKSPACE","DELETE","_getPreviousBlockClie","blocksToDelete","blockToFocus","shouldUpdateSelection","length","defaultPrevented","preventDefault","canDuplicate","every","hasBlockSupport","name","updatedBlocks","createElement","Fragment","Button","classnames","onKeyDown","href","default","icon","showColors","__experimentalHStack","alignment","justify","spacing","__experimentalTruncate","ellipsizeMode","anchor","Tooltip","text","Icon","pinSmall","map","image","index","key","style","backgroundImage","url","zIndex","lock","_default","forwardRef","exports"],"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 );\n"],"mappings":";;;;;;;AAeA,IAAAA,QAAA,GAAAC,OAAA;AAZA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,OAAA,G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IAAMxE,SAAS,EAAC;EAAkD,GACjE,IAAAnB,QAAA,CAAA2F,aAAA,EAACrF,MAAA,CAAAuG,IAAI;IAACX,IAAI,EAAGqB;EAAM,CAAE,CAChB,CAEA,CACD,CACP,CAAC;AAEL;AAAC,IAAAC,QAAA,GAEc,IAAAC,mBAAU,EAAEvG,yBAA0B,CAAC;AAAAwG,OAAA,CAAAzB,OAAA,GAAAuB,QAAA"}
@@ -14,6 +14,7 @@ var _icons = require("@wordpress/icons");
14
14
  var _data = require("@wordpress/data");
15
15
  var _i18n = require("@wordpress/i18n");
16
16
  var _dom = require("@wordpress/dom");
17
+ var _keycodes = require("@wordpress/keycodes");
17
18
  var _leaf = _interopRequireDefault(require("./leaf"));
18
19
  var _useListViewScrollIntoView = _interopRequireDefault(require("./use-list-view-scroll-into-view"));
19
20
  var _button = require("../block-mover/button");
@@ -67,7 +68,7 @@ function ListViewBlock({
67
68
  toggleBlockHighlight
68
69
  } = (0, _data.useDispatch)(_store.store);
69
70
  const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
70
- const blockTitle = blockInformation?.title || (0, _i18n.__)('Untitled');
71
+ const blockTitle = blockInformation?.name || blockInformation?.title || (0, _i18n.__)('Untitled');
71
72
  const block = (0, _data.useSelect)(select => select(_store.store).getBlock(clientId), [clientId]);
72
73
  const blockName = (0, _data.useSelect)(select => select(_store.store).getBlockName(clientId), [clientId]);
73
74
  const blockEditingMode = (0, _data.useSelect)(select => select(_store.store).getBlockEditingMode(clientId), [clientId]);
@@ -114,6 +115,16 @@ function ListViewBlock({
114
115
  cellRef.current.focus();
115
116
  }
116
117
  }, []);
118
+
119
+ // If multiple blocks are selected, deselect all blocks when the user
120
+ // presses the escape key.
121
+ const onKeyDown = event => {
122
+ if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented && selectedClientIds.length > 0) {
123
+ event.stopPropagation();
124
+ event.preventDefault();
125
+ selectBlock(event, undefined);
126
+ }
127
+ };
117
128
  const onMouseEnter = (0, _element.useCallback)(() => {
118
129
  setIsHovered(true);
119
130
  toggleBlockHighlight(clientId, true);
@@ -198,6 +209,7 @@ function ListViewBlock({
198
209
  const currentlyEditingBlockInCanvas = isSelected && selectedClientIds.length === 1;
199
210
  return (0, _element.createElement)(_leaf.default, {
200
211
  className: classes,
212
+ onKeyDown: onKeyDown,
201
213
  onMouseEnter: onMouseEnter,
202
214
  onMouseLeave: onMouseLeave,
203
215
  onFocus: onMouseEnter,
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_blocks","_components","_compose","_icons","_data","_i18n","_dom","_leaf","_useListViewScrollIntoView","_button","_blockContents","_context","_utils","_store","_useBlockDisplayInformation","_blockLock","_ariaReferencedText","ListViewBlock","block","clientId","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","isSyncedBranch","cellRef","useRef","rowRef","isHovered","setIsHovered","useState","isLocked","canEdit","useBlockLock","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","useDispatch","blockEditorStore","blockInformation","useBlockDisplayInformation","blockTitle","title","__","useSelect","select","getBlock","blockName","getBlockName","blockEditingMode","getBlockEditingMode","showBlockActions","hasBlockSupport","instanceId","useInstanceId","descriptionId","blockPositionDescription","getBlockPositionDescription","blockAriaLabel","sprintf","settingsAriaLabel","isTreeGridMounted","expand","collapse","BlockSettingsMenu","listViewInstanceId","expandedState","setInsertedBlock","treeGridElementRef","useListViewContext","hasSiblings","hasRenderedMovers","moverCellClassName","classnames","listViewBlockSettingsClassName","useEffect","current","focus","onMouseEnter","useCallback","onMouseLeave","selectEditorBlock","event","preventDefault","updateFocusAndSelection","focusClientId","shouldSelectBlock","undefined","getFocusElement","row","querySelector","focusable","find","focusElement","window","requestAnimationFrame","toggleExpanded","stopPropagation","colSpan","classes","isSynced","dropdownClientIds","includes","useListViewScrollIntoView","rowItemRef","currentlyEditingBlockInCanvas","createElement","default","className","onFocus","onBlur","id","ref","__experimentalTreeGridCell","tabIndex","onClick","onToggleExpanded","ariaLabel","ariaDescribedBy","Fragment","withoutGridItem","__experimentalTreeGridItem","BlockMoverUpButton","orientation","clientIds","BlockMoverDownButton","icon","moreVertical","label","toggleProps","disableOpenOnArrowDown","__experimentalSelectBlock","_default","memo","exports"],"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":";;;;;;;AAeA,IAAAA,QAAA,GAAAC,OAAA;AAZA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAIA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAQA,IAAAO,KAAA,GAAAP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,WAAW,EAAG;MACbjB,GAAG;MACHJ,SAAS,EAAE,oCAAoC;MAC/CM,QAAQ;MACRL;IACD,CAAG;IACHqB,sBAAsB;IACtBpE,MAAM,EAAGA,MAAQ;IACjBI,aAAa,EAAGA,aAAe;IAC/BC,gBAAgB,EAAGA,gBAAkB;IACrCgE,yBAAyB,EACxB/C;EACA,CACD,CAEW,CAEF,CAAC;AAEjB;AAAC,IAAAgD,QAAA,GAEc,IAAAC,aAAI,EAAE7H,aAAc,CAAC;AAAA8H,OAAA,CAAA3B,OAAA,GAAAyB,QAAA"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_blocks","_components","_compose","_icons","_data","_i18n","_dom","_keycodes","_leaf","_useListViewScrollIntoView","_button","_blockContents","_context","_utils","_store","_useBlockDisplayInformation","_blockLock","_ariaReferencedText","ListViewBlock","block","clientId","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","isSyncedBranch","cellRef","useRef","rowRef","isHovered","setIsHovered","useState","isLocked","canEdit","useBlockLock","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","useDispatch","blockEditorStore","blockInformation","useBlockDisplayInformation","blockTitle","name","title","__","useSelect","select","getBlock","blockName","getBlockName","blockEditingMode","getBlockEditingMode","showBlockActions","hasBlockSupport","instanceId","useInstanceId","descriptionId","blockPositionDescription","getBlockPositionDescription","blockAriaLabel","sprintf","settingsAriaLabel","isTreeGridMounted","expand","collapse","BlockSettingsMenu","listViewInstanceId","expandedState","setInsertedBlock","treeGridElementRef","useListViewContext","hasSiblings","hasRenderedMovers","moverCellClassName","classnames","listViewBlockSettingsClassName","useEffect","current","focus","onKeyDown","event","keyCode","ESCAPE","defaultPrevented","stopPropagation","preventDefault","undefined","onMouseEnter","useCallback","onMouseLeave","selectEditorBlock","updateFocusAndSelection","focusClientId","shouldSelectBlock","getFocusElement","row","querySelector","focusable","find","focusElement","window","requestAnimationFrame","toggleExpanded","colSpan","classes","isSynced","dropdownClientIds","includes","useListViewScrollIntoView","rowItemRef","currentlyEditingBlockInCanvas","createElement","default","className","onFocus","onBlur","id","ref","__experimentalTreeGridCell","tabIndex","onClick","onToggleExpanded","ariaLabel","ariaDescribedBy","Fragment","withoutGridItem","__experimentalTreeGridItem","BlockMoverUpButton","orientation","clientIds","BlockMoverDownButton","icon","moreVertical","label","toggleProps","disableOpenOnArrowDown","__experimentalSelectBlock","_default","memo","exports"],"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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BlockType
39
39
  } = (0, _data.useSelect)(_blocks.store);
40
40
  const updateBlockSelection = (0, _element.useCallback)(async (event, clientId, destinationClientId, focusPosition) => {
41
- if (!event?.shiftKey) {
41
+ if (!event?.shiftKey && event?.keyCode !== _keycodes.ESCAPE) {
42
42
  selectBlock(clientId, focusPosition);
43
43
  return;
44
44
  }
@@ -46,6 +46,7 @@ function useBlockSelection() {
46
46
  // To handle multiple block selection via the `SHIFT` key, prevent
47
47
  // the browser default behavior of opening the link in a new window.
48
48
  event.preventDefault();
49
+ const isOnlyDeselection = event.type === 'keydown' && event.keyCode === _keycodes.ESCAPE;
49
50
  const isKeyPress = event.type === 'keydown' && (event.keyCode === _keycodes.UP || event.keyCode === _keycodes.DOWN || event.keyCode === _keycodes.HOME || event.keyCode === _keycodes.END);
50
51
 
51
52
  // Handle clicking on a block when no blocks are selected, and return early.
@@ -55,38 +56,42 @@ function useBlockSelection() {
55
56
  }
56
57
  const selectedBlocks = getSelectedBlockClientIds();
57
58
  const clientIdWithParents = [...getBlockParents(clientId), clientId];
58
- if (isKeyPress && !selectedBlocks.some(blockId => clientIdWithParents.includes(blockId))) {
59
+ if (isOnlyDeselection || isKeyPress && !selectedBlocks.some(blockId => clientIdWithParents.includes(blockId))) {
59
60
  // Ensure that shift-selecting blocks via the keyboard only
60
61
  // expands the current selection if focusing over already
61
62
  // selected blocks. Otherwise, clear the selection so that
62
63
  // a user can create a new selection entirely by keyboard.
63
64
  await clearSelectedBlock();
64
65
  }
65
- let startTarget = getBlockSelectionStart();
66
- let endTarget = clientId;
67
66
 
68
- // Handle keyboard behavior for selecting multiple blocks.
69
- if (isKeyPress) {
70
- if (!hasSelectedBlock() && !hasMultiSelection()) {
71
- // Set the starting point of the selection to the currently
72
- // focused block, if there are no blocks currently selected.
73
- // This ensures that as the selection is expanded or contracted,
74
- // the starting point of the selection is anchored to that block.
75
- startTarget = clientId;
76
- }
77
- if (destinationClientId) {
78
- // If the user presses UP or DOWN, we want to ensure that the block they're
79
- // moving to is the target for selection, and not the currently focused one.
80
- endTarget = destinationClientId;
67
+ // Update selection, if not only clearing the selection.
68
+ if (!isOnlyDeselection) {
69
+ let startTarget = getBlockSelectionStart();
70
+ let endTarget = clientId;
71
+
72
+ // Handle keyboard behavior for selecting multiple blocks.
73
+ if (isKeyPress) {
74
+ if (!hasSelectedBlock() && !hasMultiSelection()) {
75
+ // Set the starting point of the selection to the currently
76
+ // focused block, if there are no blocks currently selected.
77
+ // This ensures that as the selection is expanded or contracted,
78
+ // the starting point of the selection is anchored to that block.
79
+ startTarget = clientId;
80
+ }
81
+ if (destinationClientId) {
82
+ // If the user presses UP or DOWN, we want to ensure that the block they're
83
+ // moving to is the target for selection, and not the currently focused one.
84
+ endTarget = destinationClientId;
85
+ }
81
86
  }
87
+ const startParents = getBlockParents(startTarget);
88
+ const endParents = getBlockParents(endTarget);
89
+ const {
90
+ start,
91
+ end
92
+ } = (0, _utils.getCommonDepthClientIds)(startTarget, endTarget, startParents, endParents);
93
+ await multiSelect(start, end, null);
82
94
  }
83
- const startParents = getBlockParents(startTarget);
84
- const endParents = getBlockParents(endTarget);
85
- const {
86
- start,
87
- end
88
- } = (0, _utils.getCommonDepthClientIds)(startTarget, endTarget, startParents, endParents);
89
- await multiSelect(start, end, null);
90
95
 
91
96
  // Announce deselected block, or number of deselected blocks if
92
97
  // the total number of blocks deselected is greater than one.