@wordpress/block-editor 12.9.0 → 12.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (463) 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 +19 -4
  8. package/build/components/block-patterns-list/index.js.map +1 -1
  9. package/build/components/block-patterns-paging/index.js +66 -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 +57 -23
  61. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  62. package/build/components/inserter/block-patterns-explorer/sidebar.js +24 -9
  63. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  64. package/build/components/inserter/block-patterns-source-filter.js +54 -0
  65. package/build/components/inserter/block-patterns-source-filter.js.map +1 -0
  66. package/build/components/inserter/block-patterns-sync-filter.js +46 -0
  67. package/build/components/inserter/block-patterns-sync-filter.js.map +1 -0
  68. package/build/components/inserter/block-patterns-tab.js +91 -45
  69. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  70. package/build/components/inserter/hooks/use-patterns-paging.js +57 -0
  71. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  72. package/build/components/inserter/hooks/use-patterns-state.js +21 -10
  73. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  74. package/build/components/inserter/menu.js +13 -11
  75. package/build/components/inserter/menu.js.map +1 -1
  76. package/build/components/inserter/search-results.js +4 -3
  77. package/build/components/inserter/search-results.js.map +1 -1
  78. package/build/components/inserter/tabs.js +1 -12
  79. package/build/components/inserter/tabs.js.map +1 -1
  80. package/build/components/inspector-controls/block-support-slot-container.js +12 -1
  81. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
  82. package/build/components/inspector-controls/fill.js +24 -13
  83. package/build/components/inspector-controls/fill.js.map +1 -1
  84. package/build/components/inspector-controls/groups.js +5 -3
  85. package/build/components/inspector-controls/groups.js.map +1 -1
  86. package/build/components/inspector-controls/slot.js +13 -0
  87. package/build/components/inspector-controls/slot.js.map +1 -1
  88. package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
  89. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  90. package/build/components/link-control/index.js +13 -2
  91. package/build/components/link-control/index.js.map +1 -1
  92. package/build/components/link-control/settings.js +2 -1
  93. package/build/components/link-control/settings.js.map +1 -1
  94. package/build/components/list-view/block-select-button.js +1 -3
  95. package/build/components/list-view/block-select-button.js.map +1 -1
  96. package/build/components/list-view/block.js +13 -1
  97. package/build/components/list-view/block.js.map +1 -1
  98. package/build/components/list-view/use-block-selection.js +29 -24
  99. package/build/components/list-view/use-block-selection.js.map +1 -1
  100. package/build/components/media-placeholder/index.js +2 -2
  101. package/build/components/media-placeholder/index.js.map +1 -1
  102. package/build/components/media-placeholder/index.native.js +11 -11
  103. package/build/components/media-placeholder/index.native.js.map +1 -1
  104. package/build/components/media-replace-flow/index.js +2 -3
  105. package/build/components/media-replace-flow/index.js.map +1 -1
  106. package/build/components/media-upload/constants.js +30 -0
  107. package/build/components/media-upload/constants.js.map +1 -0
  108. package/build/components/media-upload/index.native.js +63 -53
  109. package/build/components/media-upload/index.native.js.map +1 -1
  110. package/build/components/preview-options/index.js +1 -1
  111. package/build/components/preview-options/index.js.map +1 -1
  112. package/build/components/rich-text/index.js +34 -35
  113. package/build/components/rich-text/index.js.map +1 -1
  114. package/build/components/rich-text/index.native.js +14 -32
  115. package/build/components/rich-text/index.native.js.map +1 -1
  116. package/build/components/rich-text/multiline.js +95 -0
  117. package/build/components/rich-text/multiline.js.map +1 -0
  118. package/build/components/rich-text/split-value.js +10 -16
  119. package/build/components/rich-text/split-value.js.map +1 -1
  120. package/build/components/rich-text/use-enter.js +31 -40
  121. package/build/components/rich-text/use-enter.js.map +1 -1
  122. package/build/components/rich-text/use-paste-handler.js +18 -33
  123. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  124. package/build/components/spacing-sizes-control/utils.js +1 -1
  125. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  126. package/build/components/use-block-commands/index.js +30 -18
  127. package/build/components/use-block-commands/index.js.map +1 -1
  128. package/build/components/use-block-display-information/index.js +5 -2
  129. package/build/components/use-block-display-information/index.js.map +1 -1
  130. package/build/hooks/background.js +258 -0
  131. package/build/hooks/background.js.map +1 -0
  132. package/build/hooks/block-hooks.js +188 -0
  133. package/build/hooks/block-hooks.js.map +1 -0
  134. package/build/hooks/block-rename-ui.js +160 -0
  135. package/build/hooks/block-rename-ui.js.map +1 -0
  136. package/build/hooks/duotone.js +29 -42
  137. package/build/hooks/duotone.js.map +1 -1
  138. package/build/hooks/index.js +2 -2
  139. package/build/hooks/index.js.map +1 -1
  140. package/build/hooks/layout.js +31 -14
  141. package/build/hooks/layout.js.map +1 -1
  142. package/build/hooks/position.js +4 -2
  143. package/build/hooks/position.js.map +1 -1
  144. package/build/hooks/style.js +74 -25
  145. package/build/hooks/style.js.map +1 -1
  146. package/build/hooks/utils.js +4 -0
  147. package/build/hooks/utils.js.map +1 -1
  148. package/build/private-apis.js +2 -0
  149. package/build/private-apis.js.map +1 -1
  150. package/build/store/actions.js +33 -10
  151. package/build/store/actions.js.map +1 -1
  152. package/build/store/private-actions.js +42 -8
  153. package/build/store/private-actions.js.map +1 -1
  154. package/build/store/private-selectors.js +23 -0
  155. package/build/store/private-selectors.js.map +1 -1
  156. package/build/store/reducer.js +43 -1
  157. package/build/store/reducer.js.map +1 -1
  158. package/build/store/selectors.js +84 -23
  159. package/build/store/selectors.js.map +1 -1
  160. package/build/store/utils.js +0 -4
  161. package/build/store/utils.js.map +1 -1
  162. package/build-module/components/block-canvas/index.js +97 -0
  163. package/build-module/components/block-canvas/index.js.map +1 -0
  164. package/build-module/components/block-inspector/index.js +4 -1
  165. package/build-module/components/block-inspector/index.js.map +1 -1
  166. package/build-module/components/block-patterns-list/index.js +20 -5
  167. package/build-module/components/block-patterns-list/index.js.map +1 -1
  168. package/build-module/components/block-patterns-paging/index.js +59 -0
  169. package/build-module/components/block-patterns-paging/index.js.map +1 -0
  170. package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -0
  171. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  172. package/build-module/components/block-settings-menu-controls/index.js +4 -7
  173. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  174. package/build-module/components/block-styles/index.js +1 -0
  175. package/build-module/components/block-styles/index.js.map +1 -1
  176. package/build-module/components/block-toolbar/block-toolbar-menu.native.js +3 -7
  177. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  178. package/build-module/components/block-tools/block-contextual-toolbar.js +18 -7
  179. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  180. package/build-module/components/block-tools/block-selection-button.js +5 -1
  181. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  182. package/build-module/components/border-radius-control/input-controls.js +1 -1
  183. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  184. package/build-module/components/border-radius-control/linked-button.js +2 -4
  185. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  186. package/build-module/components/colors/with-colors.js.map +1 -1
  187. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
  188. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  189. package/build-module/components/default-block-appender/index.native.js +20 -1
  190. package/build-module/components/default-block-appender/index.native.js.map +1 -1
  191. package/build-module/components/duotone/utils.js +65 -0
  192. package/build-module/components/duotone/utils.js.map +1 -1
  193. package/build-module/components/editor-styles/index.js +28 -9
  194. package/build-module/components/editor-styles/index.js.map +1 -1
  195. package/build-module/components/global-styles/hooks.js +3 -100
  196. package/build-module/components/global-styles/hooks.js.map +1 -1
  197. package/build-module/components/global-styles/image-settings-panel.js +53 -0
  198. package/build-module/components/global-styles/image-settings-panel.js.map +1 -0
  199. package/build-module/components/global-styles/index.js +2 -2
  200. package/build-module/components/global-styles/index.js.map +1 -1
  201. package/build-module/components/global-styles/use-global-styles-output.js +18 -16
  202. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  203. package/build-module/components/global-styles/utils.js +1 -1
  204. package/build-module/components/global-styles/utils.js.map +1 -1
  205. package/build-module/components/iframe/index.js +66 -33
  206. package/build-module/components/iframe/index.js.map +1 -1
  207. package/build-module/components/image-editor/use-save-image.js +2 -5
  208. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  209. package/build-module/components/image-editor/use-transform-image.js +9 -9
  210. package/build-module/components/image-editor/use-transform-image.js.map +1 -1
  211. package/build-module/components/index.js +1 -1
  212. package/build-module/components/index.js.map +1 -1
  213. package/build-module/components/index.native.js +2 -1
  214. package/build-module/components/index.native.js.map +1 -1
  215. package/build-module/components/inner-blocks/use-nested-settings-update.js +14 -8
  216. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  217. package/build-module/components/inserter/block-patterns-explorer/explorer.js +12 -6
  218. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  219. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +59 -25
  220. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  221. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +23 -9
  222. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  223. package/build-module/components/inserter/block-patterns-source-filter.js +44 -0
  224. package/build-module/components/inserter/block-patterns-source-filter.js.map +1 -0
  225. package/build-module/components/inserter/block-patterns-sync-filter.js +38 -0
  226. package/build-module/components/inserter/block-patterns-sync-filter.js.map +1 -0
  227. package/build-module/components/inserter/block-patterns-tab.js +87 -46
  228. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  229. package/build-module/components/inserter/hooks/use-patterns-paging.js +50 -0
  230. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  231. package/build-module/components/inserter/hooks/use-patterns-state.js +22 -10
  232. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  233. package/build-module/components/inserter/menu.js +13 -11
  234. package/build-module/components/inserter/menu.js.map +1 -1
  235. package/build-module/components/inserter/search-results.js +4 -3
  236. package/build-module/components/inserter/search-results.js.map +1 -1
  237. package/build-module/components/inserter/tabs.js +1 -12
  238. package/build-module/components/inserter/tabs.js.map +1 -1
  239. package/build-module/components/inspector-controls/block-support-slot-container.js +13 -2
  240. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
  241. package/build-module/components/inspector-controls/fill.js +25 -14
  242. package/build-module/components/inspector-controls/fill.js.map +1 -1
  243. package/build-module/components/inspector-controls/groups.js +5 -3
  244. package/build-module/components/inspector-controls/groups.js.map +1 -1
  245. package/build-module/components/inspector-controls/slot.js +15 -1
  246. package/build-module/components/inspector-controls/slot.js.map +1 -1
  247. package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
  248. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  249. package/build-module/components/link-control/index.js +13 -2
  250. package/build-module/components/link-control/index.js.map +1 -1
  251. package/build-module/components/link-control/settings.js +2 -1
  252. package/build-module/components/link-control/settings.js.map +1 -1
  253. package/build-module/components/list-view/block-select-button.js +1 -3
  254. package/build-module/components/list-view/block-select-button.js.map +1 -1
  255. package/build-module/components/list-view/block.js +13 -1
  256. package/build-module/components/list-view/block.js.map +1 -1
  257. package/build-module/components/list-view/use-block-selection.js +30 -25
  258. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  259. package/build-module/components/media-placeholder/index.js +2 -2
  260. package/build-module/components/media-placeholder/index.js.map +1 -1
  261. package/build-module/components/media-placeholder/index.native.js +7 -7
  262. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  263. package/build-module/components/media-replace-flow/index.js +2 -3
  264. package/build-module/components/media-replace-flow/index.js.map +1 -1
  265. package/build-module/components/media-upload/constants.js +14 -0
  266. package/build-module/components/media-upload/constants.js.map +1 -0
  267. package/build-module/components/media-upload/index.native.js +53 -34
  268. package/build-module/components/media-upload/index.native.js.map +1 -1
  269. package/build-module/components/preview-options/index.js +1 -1
  270. package/build-module/components/preview-options/index.js.map +1 -1
  271. package/build-module/components/rich-text/index.js +35 -37
  272. package/build-module/components/rich-text/index.js.map +1 -1
  273. package/build-module/components/rich-text/index.native.js +15 -33
  274. package/build-module/components/rich-text/index.native.js.map +1 -1
  275. package/build-module/components/rich-text/multiline.js +87 -0
  276. package/build-module/components/rich-text/multiline.js.map +1 -0
  277. package/build-module/components/rich-text/split-value.js +10 -16
  278. package/build-module/components/rich-text/split-value.js.map +1 -1
  279. package/build-module/components/rich-text/use-enter.js +33 -42
  280. package/build-module/components/rich-text/use-enter.js.map +1 -1
  281. package/build-module/components/rich-text/use-paste-handler.js +19 -34
  282. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  283. package/build-module/components/spacing-sizes-control/utils.js +2 -2
  284. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  285. package/build-module/components/use-block-commands/index.js +28 -16
  286. package/build-module/components/use-block-commands/index.js.map +1 -1
  287. package/build-module/components/use-block-display-information/index.js +5 -2
  288. package/build-module/components/use-block-display-information/index.js.map +1 -1
  289. package/build-module/hooks/background.js +244 -0
  290. package/build-module/hooks/background.js.map +1 -0
  291. package/build-module/hooks/block-hooks.js +181 -0
  292. package/build-module/hooks/block-hooks.js.map +1 -0
  293. package/build-module/hooks/block-rename-ui.js +153 -0
  294. package/build-module/hooks/block-rename-ui.js.map +1 -0
  295. package/build-module/hooks/duotone.js +26 -39
  296. package/build-module/hooks/duotone.js.map +1 -1
  297. package/build-module/hooks/index.js +2 -2
  298. package/build-module/hooks/index.js.map +1 -1
  299. package/build-module/hooks/layout.js +33 -16
  300. package/build-module/hooks/layout.js.map +1 -1
  301. package/build-module/hooks/position.js +4 -2
  302. package/build-module/hooks/position.js.map +1 -1
  303. package/build-module/hooks/style.js +73 -24
  304. package/build-module/hooks/style.js.map +1 -1
  305. package/build-module/hooks/utils.js +4 -0
  306. package/build-module/hooks/utils.js.map +1 -1
  307. package/build-module/private-apis.js +2 -0
  308. package/build-module/private-apis.js.map +1 -1
  309. package/build-module/store/actions.js +33 -10
  310. package/build-module/store/actions.js.map +1 -1
  311. package/build-module/store/private-actions.js +39 -8
  312. package/build-module/store/private-actions.js.map +1 -1
  313. package/build-module/store/private-selectors.js +21 -0
  314. package/build-module/store/private-selectors.js.map +1 -1
  315. package/build-module/store/reducer.js +41 -1
  316. package/build-module/store/reducer.js.map +1 -1
  317. package/build-module/store/selectors.js +78 -22
  318. package/build-module/store/selectors.js.map +1 -1
  319. package/build-module/store/utils.js +0 -4
  320. package/build-module/store/utils.js.map +1 -1
  321. package/build-style/content-rtl.css +0 -1
  322. package/build-style/content.css +0 -1
  323. package/build-style/style-rtl.css +174 -131
  324. package/build-style/style.css +174 -131
  325. package/package.json +32 -32
  326. package/src/components/block-canvas/index.js +108 -0
  327. package/src/components/block-inspector/index.js +5 -1
  328. package/src/components/block-list/content.scss +0 -1
  329. package/src/components/block-patterns-list/index.js +32 -7
  330. package/src/components/block-patterns-list/style.scss +26 -9
  331. package/src/components/block-patterns-paging/index.js +92 -0
  332. package/src/components/block-patterns-paging/style.scss +42 -0
  333. package/src/components/block-settings-menu/block-settings-dropdown.js +44 -0
  334. package/src/components/block-settings-menu-controls/index.js +4 -9
  335. package/src/components/block-styles/index.js +1 -0
  336. package/src/components/block-styles/style.scss +3 -3
  337. package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -6
  338. package/src/components/block-tools/block-contextual-toolbar.js +16 -5
  339. package/src/components/block-tools/block-selection-button.js +9 -1
  340. package/src/components/block-tools/style.scss +0 -98
  341. package/src/components/border-radius-control/input-controls.js +1 -1
  342. package/src/components/border-radius-control/linked-button.js +8 -11
  343. package/src/components/color-palette/test/__snapshots__/control.js.snap +34 -21
  344. package/src/components/colors/with-colors.js +3 -2
  345. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -35
  346. package/src/components/default-block-appender/index.native.js +26 -3
  347. package/src/components/duotone/utils.js +65 -0
  348. package/src/components/editor-styles/index.js +32 -23
  349. package/src/components/global-styles/hooks.js +4 -112
  350. package/src/components/global-styles/image-settings-panel.js +71 -0
  351. package/src/components/global-styles/index.js +4 -3
  352. package/src/components/global-styles/use-global-styles-output.js +25 -16
  353. package/src/components/global-styles/utils.js +1 -2
  354. package/src/components/iframe/index.js +72 -33
  355. package/src/components/image-editor/use-save-image.js +2 -9
  356. package/src/components/image-editor/use-transform-image.js +9 -9
  357. package/src/components/index.js +1 -1
  358. package/src/components/index.native.js +2 -2
  359. package/src/components/inner-blocks/use-nested-settings-update.js +15 -10
  360. package/src/components/inserter/block-patterns-explorer/explorer.js +17 -5
  361. package/src/components/inserter/block-patterns-explorer/patterns-list.js +109 -40
  362. package/src/components/inserter/block-patterns-explorer/sidebar.js +23 -8
  363. package/src/components/inserter/block-patterns-source-filter.js +40 -0
  364. package/src/components/inserter/block-patterns-sync-filter.js +35 -0
  365. package/src/components/inserter/block-patterns-tab.js +168 -57
  366. package/src/components/inserter/hooks/use-patterns-paging.js +65 -0
  367. package/src/components/inserter/hooks/use-patterns-state.js +27 -16
  368. package/src/components/inserter/menu.js +15 -17
  369. package/src/components/inserter/search-results.js +6 -4
  370. package/src/components/inserter/style.scss +23 -2
  371. package/src/components/inserter/tabs.js +2 -12
  372. package/src/components/inserter/test/index.native.js +8 -12
  373. package/src/components/inspector-controls/block-support-slot-container.js +19 -3
  374. package/src/components/inspector-controls/fill.js +28 -14
  375. package/src/components/inspector-controls/groups.js +6 -2
  376. package/src/components/inspector-controls/slot.js +28 -3
  377. package/src/components/inspector-controls-tabs/styles-tab.js +4 -0
  378. package/src/components/link-control/index.js +14 -0
  379. package/src/components/link-control/settings.js +1 -0
  380. package/src/components/link-control/style.scss +28 -7
  381. package/src/components/link-control/test/index.js +88 -6
  382. package/src/components/list-view/block-select-button.js +1 -3
  383. package/src/components/list-view/block.js +19 -1
  384. package/src/components/list-view/style.scss +1 -2
  385. package/src/components/list-view/use-block-selection.js +38 -32
  386. package/src/components/media-placeholder/README.md +2 -2
  387. package/src/components/media-placeholder/index.js +2 -2
  388. package/src/components/media-placeholder/index.native.js +11 -12
  389. package/src/components/media-replace-flow/index.js +2 -2
  390. package/src/components/media-replace-flow/test/index.js +5 -23
  391. package/src/components/media-upload/README.md +3 -2
  392. package/src/components/media-upload/constants.js +15 -0
  393. package/src/components/media-upload/index.native.js +66 -40
  394. package/src/components/media-upload/style.native.scss +4 -0
  395. package/src/components/media-upload/test/index.native.js +2 -2
  396. package/src/components/preview-options/README.md +7 -0
  397. package/src/components/preview-options/index.js +1 -1
  398. package/src/components/rich-text/index.js +48 -44
  399. package/src/components/rich-text/index.native.js +14 -42
  400. package/src/components/rich-text/multiline.js +121 -0
  401. package/src/components/rich-text/split-value.js +10 -35
  402. package/src/components/rich-text/use-enter.js +32 -42
  403. package/src/components/rich-text/use-paste-handler.js +16 -40
  404. package/src/components/spacing-sizes-control/style.scss +5 -7
  405. package/src/components/spacing-sizes-control/utils.js +1 -2
  406. package/src/components/use-block-commands/index.js +28 -20
  407. package/src/components/use-block-display-information/index.js +3 -0
  408. package/src/hooks/background.js +288 -0
  409. package/src/hooks/background.scss +57 -0
  410. package/src/hooks/block-hooks.js +257 -0
  411. package/src/hooks/block-hooks.scss +16 -0
  412. package/src/hooks/block-rename-ui.js +230 -0
  413. package/src/hooks/block-rename-ui.scss +3 -0
  414. package/src/hooks/duotone.js +42 -43
  415. package/src/hooks/index.js +2 -2
  416. package/src/hooks/layout.js +31 -33
  417. package/src/hooks/position.js +4 -3
  418. package/src/hooks/style.js +96 -37
  419. package/src/hooks/test/align.native.js +4 -3
  420. package/src/hooks/utils.js +4 -0
  421. package/src/private-apis.js +2 -0
  422. package/src/store/actions.js +52 -10
  423. package/src/store/private-actions.js +37 -6
  424. package/src/store/private-selectors.js +21 -0
  425. package/src/store/reducer.js +38 -0
  426. package/src/store/selectors.js +107 -26
  427. package/src/store/test/actions.js +19 -8
  428. package/src/store/test/private-actions.js +17 -0
  429. package/src/store/test/reducer.js +25 -0
  430. package/src/store/test/selectors.js +130 -123
  431. package/src/store/utils.js +3 -10
  432. package/src/style.scss +4 -0
  433. package/build/components/duotone/components.js +0 -135
  434. package/build/components/duotone/components.js.map +0 -1
  435. package/build/components/duotone/index.js +0 -38
  436. package/build/components/duotone/index.js.map +0 -1
  437. package/build/components/global-styles/behaviors-panel.js +0 -64
  438. package/build/components/global-styles/behaviors-panel.js.map +0 -1
  439. package/build/components/inserter/reusable-blocks-tab.js +0 -85
  440. package/build/components/inserter/reusable-blocks-tab.js.map +0 -1
  441. package/build/hooks/auto-inserting-blocks.js +0 -174
  442. package/build/hooks/auto-inserting-blocks.js.map +0 -1
  443. package/build/hooks/behaviors.js +0 -173
  444. package/build/hooks/behaviors.js.map +0 -1
  445. package/build-module/components/duotone/components.js +0 -126
  446. package/build-module/components/duotone/components.js.map +0 -1
  447. package/build-module/components/duotone/index.js +0 -3
  448. package/build-module/components/duotone/index.js.map +0 -1
  449. package/build-module/components/global-styles/behaviors-panel.js +0 -57
  450. package/build-module/components/global-styles/behaviors-panel.js.map +0 -1
  451. package/build-module/components/inserter/reusable-blocks-tab.js +0 -76
  452. package/build-module/components/inserter/reusable-blocks-tab.js.map +0 -1
  453. package/build-module/hooks/auto-inserting-blocks.js +0 -167
  454. package/build-module/hooks/auto-inserting-blocks.js.map +0 -1
  455. package/build-module/hooks/behaviors.js +0 -166
  456. package/build-module/hooks/behaviors.js.map +0 -1
  457. package/src/components/duotone/components.js +0 -133
  458. package/src/components/duotone/index.js +0 -7
  459. package/src/components/global-styles/behaviors-panel.js +0 -71
  460. package/src/components/inserter/reusable-blocks-tab.js +0 -84
  461. package/src/components/inserter/test/reusable-blocks-tab.js +0 -73
  462. package/src/hooks/auto-inserting-blocks.js +0 -232
  463. package/src/hooks/behaviors.js +0 -206
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { symbol as reusableBlockIcon } from '@wordpress/icons';
5
4
  import { useMemo } from '@wordpress/element';
6
5
  import { TabPanel } from '@wordpress/components';
7
6
  import { __ } from '@wordpress/i18n';
@@ -16,12 +15,7 @@ const patternsTab = {
16
15
  /* translators: Theme and Directory Patterns tab title in the block inserter. */
17
16
  title: __( 'Patterns' ),
18
17
  };
19
- const reusableBlocksTab = {
20
- name: 'reusable',
21
- /* translators: Locally created Patterns tab title in the block inserter. */
22
- title: __( 'Synced patterns' ),
23
- icon: reusableBlockIcon,
24
- };
18
+
25
19
  const mediaTab = {
26
20
  name: 'media',
27
21
  /* translators: Media tab title in the block inserter. */
@@ -31,7 +25,6 @@ const mediaTab = {
31
25
  function InserterTabs( {
32
26
  children,
33
27
  showPatterns = false,
34
- showReusableBlocks = false,
35
28
  showMedia = false,
36
29
  onSelect,
37
30
  prioritizePatterns,
@@ -48,11 +41,8 @@ function InserterTabs( {
48
41
  if ( showMedia ) {
49
42
  tempTabs.push( mediaTab );
50
43
  }
51
- if ( showReusableBlocks ) {
52
- tempTabs.push( reusableBlocksTab );
53
- }
54
44
  return tempTabs;
55
- }, [ prioritizePatterns, showPatterns, showReusableBlocks, showMedia ] );
45
+ }, [ prioritizePatterns, showPatterns, showMedia ] );
56
46
 
57
47
  return (
58
48
  <TabPanel
@@ -67,9 +67,8 @@ describe( 'Inserter', () => {
67
67
  fireEvent( addBlockButton, 'onLongPress' );
68
68
 
69
69
  // Get Add To Beginning option
70
- const addBlockToBeginningButton = await getByLabelText(
71
- 'Add To Beginning'
72
- );
70
+ const addBlockToBeginningButton =
71
+ await getByLabelText( 'Add To Beginning' );
73
72
  expect( addBlockToBeginningButton ).toBeVisible();
74
73
  fireEvent.press( addBlockToBeginningButton );
75
74
 
@@ -97,9 +96,8 @@ describe( 'Inserter', () => {
97
96
  fireEvent( addBlockButton, 'onLongPress' );
98
97
 
99
98
  // Get Add Block Before option
100
- const addBlockBeforeButton = await getByLabelText(
101
- 'Add Block Before'
102
- );
99
+ const addBlockBeforeButton =
100
+ await getByLabelText( 'Add Block Before' );
103
101
  expect( addBlockBeforeButton ).toBeVisible();
104
102
  fireEvent.press( addBlockBeforeButton );
105
103
 
@@ -135,9 +133,8 @@ describe( 'Inserter', () => {
135
133
  fireEvent( addBlockButton, 'onLongPress' );
136
134
 
137
135
  // Get Add Block After option
138
- const addBlockAfterButton = await getByLabelText(
139
- 'Add Block After'
140
- );
136
+ const addBlockAfterButton =
137
+ await getByLabelText( 'Add Block After' );
141
138
  expect( addBlockAfterButton ).toBeVisible();
142
139
  fireEvent.press( addBlockAfterButton );
143
140
 
@@ -233,9 +230,8 @@ describe( 'Inserter', () => {
233
230
  await addBlock( screen, 'Heading' );
234
231
 
235
232
  // Select the title
236
- const titleInputElement = await getAllByLabelText(
237
- 'Post title. test'
238
- )[ 0 ];
233
+ const titleInputElement =
234
+ await getAllByLabelText( 'Post title. test' )[ 0 ];
239
235
  expect( titleInputElement ).toBeVisible();
240
236
  fireEvent.press( titleInputElement );
241
237
 
@@ -2,11 +2,27 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __experimentalToolsPanelContext as ToolsPanelContext } from '@wordpress/components';
5
- import { useContext } from '@wordpress/element';
5
+ import { useContext, useMemo } from '@wordpress/element';
6
6
 
7
- export default function BlockSupportSlotContainer( { Slot, ...props } ) {
7
+ export default function BlockSupportSlotContainer( {
8
+ Slot,
9
+ fillProps,
10
+ ...props
11
+ } ) {
12
+ // Add the toolspanel context provider and value to existing fill props
8
13
  const toolsPanelContext = useContext( ToolsPanelContext );
14
+ const computedFillProps = useMemo(
15
+ () => ( {
16
+ ...( fillProps ?? {} ),
17
+ forwardedContext: [
18
+ ...( fillProps?.forwardedContext ?? [] ),
19
+ [ ToolsPanelContext.Provider, { value: toolsPanelContext } ],
20
+ ],
21
+ } ),
22
+ [ toolsPanelContext, fillProps ]
23
+ );
24
+
9
25
  return (
10
- <Slot { ...props } fillProps={ toolsPanelContext } bubblesVirtually />
26
+ <Slot { ...props } fillProps={ computedFillProps } bubblesVirtually />
11
27
  );
12
28
  }
@@ -7,7 +7,7 @@ import {
7
7
  } from '@wordpress/components';
8
8
  import warning from '@wordpress/warning';
9
9
  import deprecated from '@wordpress/deprecated';
10
- import { useEffect } from '@wordpress/element';
10
+ import { useEffect, useContext } from '@wordpress/element';
11
11
 
12
12
  /**
13
13
  * Internal dependencies
@@ -60,28 +60,42 @@ export default function InspectorControlsFill( {
60
60
  );
61
61
  }
62
62
 
63
- function ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) {
64
- const { registerResetAllFilter, deregisterResetAllFilter } = fillProps;
63
+ function RegisterResetAll( { resetAllFilter, children } ) {
64
+ const { registerResetAllFilter, deregisterResetAllFilter } =
65
+ useContext( ToolsPanelContext );
65
66
  useEffect( () => {
66
- if ( resetAllFilter && registerResetAllFilter ) {
67
+ if (
68
+ resetAllFilter &&
69
+ registerResetAllFilter &&
70
+ deregisterResetAllFilter
71
+ ) {
67
72
  registerResetAllFilter( resetAllFilter );
68
- }
69
- return () => {
70
- if ( resetAllFilter && deregisterResetAllFilter ) {
73
+ return () => {
71
74
  deregisterResetAllFilter( resetAllFilter );
72
- }
73
- };
75
+ };
76
+ }
74
77
  }, [ resetAllFilter, registerResetAllFilter, deregisterResetAllFilter ] );
78
+ return children;
79
+ }
80
+
81
+ function ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) {
82
+ // `fillProps.forwardedContext` is an array of context provider entries, provided by slot,
83
+ // that should wrap the fill markup.
84
+ const { forwardedContext = [] } = fillProps;
75
85
 
76
86
  // Children passed to InspectorControlsFill will not have
77
87
  // access to any React Context whose Provider is part of
78
88
  // the InspectorControlsSlot tree. So we re-create the
79
89
  // Provider in this subtree.
80
- const value =
81
- fillProps && Object.keys( fillProps ).length > 0 ? fillProps : null;
82
- return (
83
- <ToolsPanelContext.Provider value={ value }>
90
+ const innerMarkup = (
91
+ <RegisterResetAll resetAllFilter={ resetAllFilter }>
84
92
  { children }
85
- </ToolsPanelContext.Provider>
93
+ </RegisterResetAll>
94
+ );
95
+ return forwardedContext.reduce(
96
+ ( inner, [ Provider, props ] ) => (
97
+ <Provider { ...props }>{ inner }</Provider>
98
+ ),
99
+ innerMarkup
86
100
  );
87
101
  }
@@ -5,6 +5,9 @@ import { createSlotFill } from '@wordpress/components';
5
5
 
6
6
  const InspectorControlsDefault = createSlotFill( 'InspectorControls' );
7
7
  const InspectorControlsAdvanced = createSlotFill( 'InspectorAdvancedControls' );
8
+ const InspectorControlsBackground = createSlotFill(
9
+ 'InspectorControlsBackground'
10
+ );
8
11
  const InspectorControlsBorder = createSlotFill( 'InspectorControlsBorder' );
9
12
  const InspectorControlsColor = createSlotFill( 'InspectorControlsColor' );
10
13
  const InspectorControlsFilter = createSlotFill( 'InspectorControlsFilter' );
@@ -21,15 +24,16 @@ const InspectorControlsStyles = createSlotFill( 'InspectorControlsStyles' );
21
24
  const groups = {
22
25
  default: InspectorControlsDefault,
23
26
  advanced: InspectorControlsAdvanced,
27
+ background: InspectorControlsBackground,
24
28
  border: InspectorControlsBorder,
25
29
  color: InspectorControlsColor,
26
- filter: InspectorControlsFilter,
27
30
  dimensions: InspectorControlsDimensions,
31
+ filter: InspectorControlsFilter,
28
32
  list: InspectorControlsListView,
33
+ position: InspectorControlsPosition,
29
34
  settings: InspectorControlsDefault, // Alias for default.
30
35
  styles: InspectorControlsStyles,
31
36
  typography: InspectorControlsTypography,
32
- position: InspectorControlsPosition,
33
37
  };
34
38
 
35
39
  export default groups;
@@ -1,7 +1,11 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';
4
+ import {
5
+ __experimentalUseSlotFills as useSlotFills,
6
+ __unstableMotionContext as MotionContext,
7
+ } from '@wordpress/components';
8
+ import { useContext, useMemo } from '@wordpress/element';
5
9
  import warning from '@wordpress/warning';
6
10
  import deprecated from '@wordpress/deprecated';
7
11
 
@@ -16,6 +20,7 @@ export default function InspectorControlsSlot( {
16
20
  __experimentalGroup,
17
21
  group = 'default',
18
22
  label,
23
+ fillProps,
19
24
  ...props
20
25
  } ) {
21
26
  if ( __experimentalGroup ) {
@@ -31,6 +36,20 @@ export default function InspectorControlsSlot( {
31
36
  }
32
37
  const Slot = groups[ group ]?.Slot;
33
38
  const fills = useSlotFills( Slot?.__unstableName );
39
+
40
+ const motionContextValue = useContext( MotionContext );
41
+
42
+ const computedFillProps = useMemo(
43
+ () => ( {
44
+ ...( fillProps ?? {} ),
45
+ forwardedContext: [
46
+ ...( fillProps?.forwardedContext ?? [] ),
47
+ [ MotionContext.Provider, { value: motionContextValue } ],
48
+ ],
49
+ } ),
50
+ [ motionContextValue, fillProps ]
51
+ );
52
+
34
53
  if ( ! Slot ) {
35
54
  warning( `Unknown InspectorControls group "${ group }" provided.` );
36
55
  return null;
@@ -43,10 +62,16 @@ export default function InspectorControlsSlot( {
43
62
  if ( label ) {
44
63
  return (
45
64
  <BlockSupportToolsPanel group={ group } label={ label }>
46
- <BlockSupportSlotContainer { ...props } Slot={ Slot } />
65
+ <BlockSupportSlotContainer
66
+ { ...props }
67
+ fillProps={ computedFillProps }
68
+ Slot={ Slot }
69
+ />
47
70
  </BlockSupportToolsPanel>
48
71
  );
49
72
  }
50
73
 
51
- return <Slot { ...props } bubblesVirtually />;
74
+ return (
75
+ <Slot { ...props } fillProps={ computedFillProps } bubblesVirtually />
76
+ );
52
77
  }
@@ -32,6 +32,10 @@ const StylesTab = ( { blockName, clientId, hasBlockStyles } ) => {
32
32
  label={ __( 'Color' ) }
33
33
  className="color-block-support-panel__inner-wrapper"
34
34
  />
35
+ <InspectorControls.Slot
36
+ group="background"
37
+ label={ __( 'Background image' ) }
38
+ />
35
39
  <InspectorControls.Slot group="filter" />
36
40
  <InspectorControls.Slot
37
41
  group="typography"
@@ -14,6 +14,7 @@ import { ENTER } from '@wordpress/keycodes';
14
14
  import { isShallowEqualObjects } from '@wordpress/is-shallow-equal';
15
15
  import { useSelect, useDispatch } from '@wordpress/data';
16
16
  import { store as preferencesStore } from '@wordpress/preferences';
17
+ import { keyboardReturn } from '@wordpress/icons';
17
18
 
18
19
  /**
19
20
  * Internal dependencies
@@ -355,6 +356,7 @@ function LinkControl( {
355
356
  className={ classnames( {
356
357
  'block-editor-link-control__search-input-wrapper': true,
357
358
  'has-text-control': showTextControl,
359
+ 'has-actions': showActions,
358
360
  } ) }
359
361
  >
360
362
  { showTextControl && (
@@ -388,6 +390,17 @@ function LinkControl( {
388
390
  }
389
391
  hideLabelFromVision={ ! showTextControl }
390
392
  />
393
+ { ! showActions && (
394
+ <div className="block-editor-link-control__search-enter">
395
+ <Button
396
+ onClick={ isDisabled ? noop : handleSubmit }
397
+ label={ __( 'Submit' ) }
398
+ icon={ keyboardReturn }
399
+ className="block-editor-link-control__search-submit"
400
+ aria-disabled={ isDisabled }
401
+ />
402
+ </div>
403
+ ) }
391
404
  </div>
392
405
  { errorMessage && (
393
406
  <Notice
@@ -475,5 +488,6 @@ function LinkControl( {
475
488
  }
476
489
 
477
490
  LinkControl.ViewerFill = ViewerFill;
491
+ LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;
478
492
 
479
493
  export default LinkControl;
@@ -26,6 +26,7 @@ const LinkControlSettings = ( { value, onChange = noop, settings } ) => {
26
26
  label={ setting.title }
27
27
  onChange={ handleSettingChange( setting ) }
28
28
  checked={ value ? !! value[ setting.id ] : false }
29
+ help={ setting?.help }
29
30
  />
30
31
  ) );
31
32
 
@@ -46,7 +46,8 @@ $preview-image-height: 140px;
46
46
  }
47
47
 
48
48
  // Provides positioning context for search actions
49
- .block-editor-link-control__search-input-container {
49
+ .block-editor-link-control__search-input-container,
50
+ .block-editor-link-control__search-input-wrapper {
50
51
  position: relative;
51
52
  }
52
53
 
@@ -79,6 +80,17 @@ $preview-image-height: 140px;
79
80
  margin: -$grid-unit-20 * 0.5 $grid-unit-20 $grid-unit-20; // negative margin to bring the error a bit closer to the button
80
81
  }
81
82
 
83
+ .block-editor-link-control__search-enter {
84
+ position: absolute;
85
+ right: 19px; // specific to place the button properly.
86
+ top: 3px;
87
+
88
+ svg {
89
+ position: relative;
90
+ top: -2px; // the icon itself is not centered within the bounds; this centers it.
91
+ }
92
+ }
93
+
82
94
  .block-editor-link-control__search-actions {
83
95
  display: flex;
84
96
  flex-direction: row-reverse; // put "Cancel" on the left but retain DOM order.
@@ -401,19 +413,19 @@ $preview-image-height: 140px;
401
413
  }
402
414
 
403
415
  .block-editor-link-control__setting {
404
- margin-bottom: $grid-unit-20;
416
+ margin-bottom: 0;
405
417
  flex: 1;
406
418
  padding: $grid-unit-10 0 $grid-unit-10 $grid-unit-30;
407
419
 
420
+ .components-base-control__field {
421
+ display: flex; // don't allow label to wrap under checkbox.
422
+ }
423
+
408
424
  // Cancel left margin inherited from WP Admin Forms CSS.
409
425
  input {
410
426
  margin-left: 0;
411
427
  }
412
428
 
413
- &.block-editor-link-control__setting:last-child {
414
- margin-bottom: 0;
415
- }
416
-
417
429
  .is-preview & {
418
430
  padding: 20px $grid-unit-10 $grid-unit-10 0;
419
431
  }
@@ -427,6 +439,10 @@ $preview-image-height: 140px;
427
439
  padding-left: 0;
428
440
  gap: 0;
429
441
 
442
+ &[aria-expanded="true"] {
443
+ color: $gray-900;
444
+ }
445
+
430
446
  // Point downwards when open (same as list view expander)
431
447
  &[aria-expanded="true"] svg {
432
448
  visibility: visible;
@@ -452,10 +468,15 @@ $preview-image-height: 140px;
452
468
  left: auto;
453
469
  bottom: auto;
454
470
  top: calc(50% - #{$spinner-size} / 2);
455
- right: $grid-unit-20;
471
+ right: $grid-unit-50;
456
472
  }
457
473
  }
458
474
 
475
+ .block-editor-link-control .block-editor-link-control__search-input-wrapper.has-actions .components-spinner {
476
+ top: calc(50% + #{$spinner-size} / 4); // Add top spacing because this input has a visual label.
477
+ right: $grid-unit-15;
478
+ }
479
+
459
480
  .block-editor-link-control__search-item-action {
460
481
  margin-left: auto; // push to far right hand side
461
482
  flex-shrink: 0;
@@ -766,9 +766,6 @@ describe( 'Manual link entry', () => {
766
766
  name: 'Save',
767
767
  } );
768
768
 
769
- // debug the UI state
770
- // screen.debug();
771
-
772
769
  // Verify the submission UI is disabled.
773
770
  expect( submitButton ).toBeVisible();
774
771
  expect( submitButton ).toHaveAttribute(
@@ -939,6 +936,92 @@ describe( 'Manual link entry', () => {
939
936
  } );
940
937
  } );
941
938
 
939
+ describe( 'Link submission', () => {
940
+ it( 'should show a submit button when creating a link', async () => {
941
+ const user = userEvent.setup();
942
+
943
+ const LinkControlConsumer = () => {
944
+ const [ link, setLink ] = useState( {} );
945
+
946
+ return <LinkControl value={ link } onChange={ setLink } />;
947
+ };
948
+
949
+ render( <LinkControlConsumer /> );
950
+
951
+ const searchInput = screen.getByRole( 'combobox', {
952
+ name: 'Link',
953
+ } );
954
+
955
+ const submitButton = screen.getByRole( 'button', {
956
+ name: 'Submit',
957
+ } );
958
+
959
+ expect( submitButton ).toBeVisible();
960
+ expect( submitButton ).toHaveAttribute( 'aria-disabled', 'true' );
961
+
962
+ // Click the button and check it's not possible to prematurely submit the link.
963
+ await user.click( submitButton );
964
+
965
+ expect( searchInput ).toBeVisible();
966
+ expect( submitButton ).toBeVisible();
967
+
968
+ await user.type( searchInput, 'https://wordpress.org' );
969
+
970
+ expect( submitButton ).toHaveAttribute( 'aria-disabled', 'false' );
971
+ } );
972
+
973
+ it( 'should show a submit button when editing a link', async () => {
974
+ const user = userEvent.setup();
975
+
976
+ const LinkControlConsumer = () => {
977
+ const [ link, setLink ] = useState( fauxEntitySuggestions[ 0 ] );
978
+
979
+ return (
980
+ <LinkControl
981
+ forceIsEditingLink
982
+ value={ link }
983
+ onChange={ setLink }
984
+ />
985
+ );
986
+ };
987
+
988
+ render( <LinkControlConsumer /> );
989
+
990
+ const searchInput = screen.getByRole( 'combobox', {
991
+ name: 'Link',
992
+ } );
993
+
994
+ const createSubmitButton = screen.queryByRole( 'button', {
995
+ name: 'Submit',
996
+ } );
997
+
998
+ // Check the submit button for "creation" of links is not displayed.
999
+ expect( createSubmitButton ).not.toBeInTheDocument();
1000
+
1001
+ const editSubmitButton = screen.getByRole( 'button', {
1002
+ name: 'Save',
1003
+ } );
1004
+
1005
+ expect( editSubmitButton ).toBeVisible();
1006
+ expect( editSubmitButton ).toHaveAttribute( 'aria-disabled', 'true' );
1007
+
1008
+ // Click the button and check it's not possible to prematurely submit the link.
1009
+ await user.click( editSubmitButton );
1010
+
1011
+ expect( searchInput ).toBeVisible();
1012
+ expect( editSubmitButton ).toBeVisible();
1013
+
1014
+ await user.type( searchInput, '#appendtolinktext' );
1015
+
1016
+ // As typing triggers the search handler, we need to wait for the
1017
+ // search results to be returned. We can use the presence of the
1018
+ // search results listbox as a proxy for this.
1019
+ expect( await screen.findByRole( 'listbox' ) ).toBeVisible();
1020
+
1021
+ expect( editSubmitButton ).toHaveAttribute( 'aria-disabled', 'false' );
1022
+ } );
1023
+ } );
1024
+
942
1025
  describe( 'Default search suggestions', () => {
943
1026
  it( 'should display a list of initial search suggestions when there is no search value or suggestions', async () => {
944
1027
  render( <LinkControl showInitialSuggestions /> );
@@ -1135,9 +1218,8 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
1135
1218
  // Resolve the `createSuggestion` promise.
1136
1219
  resolver();
1137
1220
 
1138
- const currentLink = await screen.findByLabelText(
1139
- 'Currently selected'
1140
- );
1221
+ const currentLink =
1222
+ await screen.findByLabelText( 'Currently selected' );
1141
1223
 
1142
1224
  expect( currentLink ).toHaveTextContent( entityNameText );
1143
1225
  expect( currentLink ).toHaveTextContent( '/?p=123' );
@@ -233,9 +233,7 @@ function ListViewBlockSelectButton(
233
233
  ) }
234
234
  { positionLabel && isSticky && (
235
235
  <Tooltip text={ positionLabel }>
236
- <span className="block-editor-list-view-block-select-button__sticky">
237
- <Icon icon={ pinSmall } />
238
- </span>
236
+ <Icon icon={ pinSmall } />
239
237
  </Tooltip>
240
238
  ) }
241
239
  { images.length ? (
@@ -23,6 +23,7 @@ import {
23
23
  import { useDispatch, useSelect } from '@wordpress/data';
24
24
  import { sprintf, __ } from '@wordpress/i18n';
25
25
  import { focus } from '@wordpress/dom';
26
+ import { ESCAPE } from '@wordpress/keycodes';
26
27
 
27
28
  /**
28
29
  * Internal dependencies
@@ -72,7 +73,9 @@ function ListViewBlock( {
72
73
  const { toggleBlockHighlight } = useDispatch( blockEditorStore );
73
74
 
74
75
  const blockInformation = useBlockDisplayInformation( clientId );
75
- const blockTitle = blockInformation?.title || __( 'Untitled' );
76
+ const blockTitle =
77
+ blockInformation?.name || blockInformation?.title || __( 'Untitled' );
78
+
76
79
  const block = useSelect(
77
80
  ( select ) => select( blockEditorStore ).getBlock( clientId ),
78
81
  [ clientId ]
@@ -148,6 +151,20 @@ function ListViewBlock( {
148
151
  }
149
152
  }, [] );
150
153
 
154
+ // If multiple blocks are selected, deselect all blocks when the user
155
+ // presses the escape key.
156
+ const onKeyDown = ( event ) => {
157
+ if (
158
+ event.keyCode === ESCAPE &&
159
+ ! event.defaultPrevented &&
160
+ selectedClientIds.length > 0
161
+ ) {
162
+ event.stopPropagation();
163
+ event.preventDefault();
164
+ selectBlock( event, undefined );
165
+ }
166
+ };
167
+
151
168
  const onMouseEnter = useCallback( () => {
152
169
  setIsHovered( true );
153
170
  toggleBlockHighlight( clientId, true );
@@ -255,6 +272,7 @@ function ListViewBlock( {
255
272
  return (
256
273
  <ListViewLeaf
257
274
  className={ classes }
275
+ onKeyDown={ onKeyDown }
258
276
  onMouseEnter={ onMouseEnter }
259
277
  onMouseLeave={ onMouseLeave }
260
278
  onFocus={ onMouseEnter }
@@ -335,8 +335,7 @@
335
335
  background: rgba($black, 0.3);
336
336
  }
337
337
 
338
- .block-editor-list-view-block-select-button__lock,
339
- .block-editor-list-view-block-select-button__sticky {
338
+ .block-editor-list-view-block-select-button__lock {
340
339
  line-height: 0;
341
340
  }
342
341