@wordpress/block-editor 12.4.0 → 12.5.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 (316) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +5 -0
  3. package/build/components/block-heading-level-dropdown/heading-level-icon.js +10 -2
  4. package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  5. package/build/components/block-heading-level-dropdown/index.native.js +4 -3
  6. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  7. package/build/components/block-lock/toolbar.js +25 -6
  8. package/build/components/block-lock/toolbar.js.map +1 -1
  9. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +3 -6
  10. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  11. package/build/components/block-parent-selector/index.js +8 -5
  12. package/build/components/block-parent-selector/index.js.map +1 -1
  13. package/build/components/block-removal-warning-modal/index.js +18 -25
  14. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  15. package/build/components/block-toolbar/index.js +8 -5
  16. package/build/components/block-toolbar/index.js.map +1 -1
  17. package/build/components/block-tools/block-contextual-toolbar.js +7 -11
  18. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  19. package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
  20. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  21. package/build/components/dimensions-tool/index.js +207 -0
  22. package/build/components/dimensions-tool/index.js.map +1 -0
  23. package/build/components/dimensions-tool/scale-tool.js +111 -0
  24. package/build/components/dimensions-tool/scale-tool.js.map +1 -0
  25. package/build/components/dimensions-tool/width-height-tool.js +125 -0
  26. package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
  27. package/build/components/global-styles/color-panel.js +1 -1
  28. package/build/components/global-styles/color-panel.js.map +1 -1
  29. package/build/components/global-styles/filters-panel.js +1 -1
  30. package/build/components/global-styles/filters-panel.js.map +1 -1
  31. package/build/components/global-styles/hooks.js +2 -2
  32. package/build/components/global-styles/hooks.js.map +1 -1
  33. package/build/components/global-styles/typography-panel.js +34 -2
  34. package/build/components/global-styles/typography-panel.js.map +1 -1
  35. package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
  36. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  37. package/build/components/image-editor/use-save-image.js +1 -2
  38. package/build/components/image-editor/use-save-image.js.map +1 -1
  39. package/build/components/image-size-control/index.js +6 -0
  40. package/build/components/image-size-control/index.js.map +1 -1
  41. package/build/components/index.js +19 -1
  42. package/build/components/index.js.map +1 -1
  43. package/build/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  44. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  45. package/build/components/inserter/block-patterns-tab.js +7 -35
  46. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  47. package/build/components/inserter/hooks/use-block-types-state.js +3 -4
  48. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  49. package/build/components/inserter/hooks/use-patterns-state.js +9 -3
  50. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  51. package/build/components/inserter/media-tab/hooks.js +2 -21
  52. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  53. package/build/components/inserter/reusable-block-rename-hint.js +62 -0
  54. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
  55. package/build/components/inserter/reusable-blocks-tab.js +6 -2
  56. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  57. package/build/components/inserter/reusable-blocks-tab.native.js +2 -2
  58. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  59. package/build/components/inserter/tabs.native.js +1 -1
  60. package/build/components/inserter/tabs.native.js.map +1 -1
  61. package/build/components/inserter-draggable-blocks/index.js +9 -1
  62. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  63. package/build/components/link-control/constants.js +1 -1
  64. package/build/components/link-control/constants.js.map +1 -1
  65. package/build/components/link-control/index.js +17 -15
  66. package/build/components/link-control/index.js.map +1 -1
  67. package/build/components/link-control/search-create-button.js +5 -21
  68. package/build/components/link-control/search-create-button.js.map +1 -1
  69. package/build/components/link-control/search-input.js +4 -4
  70. package/build/components/link-control/search-input.js.map +1 -1
  71. package/build/components/link-control/search-item.js +13 -30
  72. package/build/components/link-control/search-item.js.map +1 -1
  73. package/build/components/link-control/search-results.js +2 -2
  74. package/build/components/link-control/search-results.js.map +1 -1
  75. package/build/components/link-control/settings-drawer.js +2 -3
  76. package/build/components/link-control/settings-drawer.js.map +1 -1
  77. package/build/components/list-view/appender.js +2 -6
  78. package/build/components/list-view/appender.js.map +1 -1
  79. package/build/components/provider/index.js +5 -2
  80. package/build/components/provider/index.js.map +1 -1
  81. package/build/components/provider/use-block-sync.js +21 -0
  82. package/build/components/provider/use-block-sync.js.map +1 -1
  83. package/build/components/resolution-tool/index.js +55 -0
  84. package/build/components/resolution-tool/index.js.map +1 -0
  85. package/build/components/url-input/index.js +4 -2
  86. package/build/components/url-input/index.js.map +1 -1
  87. package/build/components/writing-flow/use-tab-nav.js +10 -27
  88. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  89. package/build/components/writing-mode-control/index.js +70 -0
  90. package/build/components/writing-mode-control/index.js.map +1 -0
  91. package/build/hooks/behaviors.js +25 -20
  92. package/build/hooks/behaviors.js.map +1 -1
  93. package/build/hooks/supports.js +7 -1
  94. package/build/hooks/supports.js.map +1 -1
  95. package/build/hooks/typography.js +2 -1
  96. package/build/hooks/typography.js.map +1 -1
  97. package/build/hooks/utils.js +4 -2
  98. package/build/hooks/utils.js.map +1 -1
  99. package/build/private-apis.js +10 -1
  100. package/build/private-apis.js.map +1 -1
  101. package/build/private-apis.native.js +3 -0
  102. package/build/private-apis.native.js.map +1 -1
  103. package/build/store/actions.js +195 -1
  104. package/build/store/actions.js.map +1 -1
  105. package/build/store/defaults.js +1 -0
  106. package/build/store/defaults.js.map +1 -1
  107. package/build/store/index.js +10 -1
  108. package/build/store/index.js.map +1 -1
  109. package/build/store/private-actions.js +46 -40
  110. package/build/store/private-actions.js.map +1 -1
  111. package/build/store/private-selectors.js +3 -3
  112. package/build/store/private-selectors.js.map +1 -1
  113. package/build/store/reducer.js +22 -8
  114. package/build/store/reducer.js.map +1 -1
  115. package/build/store/selectors.js +33 -15
  116. package/build/store/selectors.js.map +1 -1
  117. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +9 -2
  118. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  119. package/build-module/components/block-heading-level-dropdown/index.native.js +4 -3
  120. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  121. package/build-module/components/block-lock/toolbar.js +25 -7
  122. package/build-module/components/block-lock/toolbar.js.map +1 -1
  123. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +4 -6
  124. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  125. package/build-module/components/block-parent-selector/index.js +7 -5
  126. package/build-module/components/block-parent-selector/index.js.map +1 -1
  127. package/build-module/components/block-removal-warning-modal/index.js +20 -24
  128. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  129. package/build-module/components/block-toolbar/index.js +8 -5
  130. package/build-module/components/block-toolbar/index.js.map +1 -1
  131. package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
  132. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  133. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
  134. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  135. package/build-module/components/dimensions-tool/index.js +195 -0
  136. package/build-module/components/dimensions-tool/index.js.map +1 -0
  137. package/build-module/components/dimensions-tool/scale-tool.js +103 -0
  138. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
  139. package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
  140. package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
  141. package/build-module/components/global-styles/color-panel.js +1 -1
  142. package/build-module/components/global-styles/color-panel.js.map +1 -1
  143. package/build-module/components/global-styles/filters-panel.js +2 -2
  144. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  145. package/build-module/components/global-styles/hooks.js +2 -2
  146. package/build-module/components/global-styles/hooks.js.map +1 -1
  147. package/build-module/components/global-styles/typography-panel.js +33 -2
  148. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  149. package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
  150. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  151. package/build-module/components/image-editor/use-save-image.js +1 -2
  152. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  153. package/build-module/components/image-size-control/index.js +5 -0
  154. package/build-module/components/image-size-control/index.js.map +1 -1
  155. package/build-module/components/index.js +6 -0
  156. package/build-module/components/index.js.map +1 -1
  157. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  158. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  159. package/build-module/components/inserter/block-patterns-tab.js +7 -33
  160. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  161. package/build-module/components/inserter/hooks/use-block-types-state.js +3 -4
  162. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  163. package/build-module/components/inserter/hooks/use-patterns-state.js +9 -3
  164. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  165. package/build-module/components/inserter/media-tab/hooks.js +2 -21
  166. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  167. package/build-module/components/inserter/reusable-block-rename-hint.js +48 -0
  168. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
  169. package/build-module/components/inserter/reusable-blocks-tab.js +5 -2
  170. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  171. package/build-module/components/inserter/reusable-blocks-tab.native.js +2 -2
  172. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  173. package/build-module/components/inserter/tabs.native.js +1 -1
  174. package/build-module/components/inserter/tabs.native.js.map +1 -1
  175. package/build-module/components/inserter-draggable-blocks/index.js +9 -2
  176. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  177. package/build-module/components/link-control/constants.js +1 -1
  178. package/build-module/components/link-control/constants.js.map +1 -1
  179. package/build-module/components/link-control/index.js +17 -15
  180. package/build-module/components/link-control/index.js.map +1 -1
  181. package/build-module/components/link-control/search-create-button.js +7 -20
  182. package/build-module/components/link-control/search-create-button.js.map +1 -1
  183. package/build-module/components/link-control/search-input.js +4 -4
  184. package/build-module/components/link-control/search-input.js.map +1 -1
  185. package/build-module/components/link-control/search-item.js +14 -28
  186. package/build-module/components/link-control/search-item.js.map +1 -1
  187. package/build-module/components/link-control/search-results.js +3 -3
  188. package/build-module/components/link-control/search-results.js.map +1 -1
  189. package/build-module/components/link-control/settings-drawer.js +4 -5
  190. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  191. package/build-module/components/list-view/appender.js +2 -6
  192. package/build-module/components/list-view/appender.js.map +1 -1
  193. package/build-module/components/provider/index.js +5 -2
  194. package/build-module/components/provider/index.js.map +1 -1
  195. package/build-module/components/provider/use-block-sync.js +21 -0
  196. package/build-module/components/provider/use-block-sync.js.map +1 -1
  197. package/build-module/components/resolution-tool/index.js +45 -0
  198. package/build-module/components/resolution-tool/index.js.map +1 -0
  199. package/build-module/components/url-input/index.js +4 -2
  200. package/build-module/components/url-input/index.js.map +1 -1
  201. package/build-module/components/writing-flow/use-tab-nav.js +8 -26
  202. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  203. package/build-module/components/writing-mode-control/index.js +57 -0
  204. package/build-module/components/writing-mode-control/index.js.map +1 -0
  205. package/build-module/hooks/behaviors.js +26 -20
  206. package/build-module/hooks/behaviors.js.map +1 -1
  207. package/build-module/hooks/supports.js +7 -1
  208. package/build-module/hooks/supports.js.map +1 -1
  209. package/build-module/hooks/typography.js +2 -1
  210. package/build-module/hooks/typography.js.map +1 -1
  211. package/build-module/hooks/utils.js +4 -2
  212. package/build-module/hooks/utils.js.map +1 -1
  213. package/build-module/private-apis.js +7 -1
  214. package/build-module/private-apis.js.map +1 -1
  215. package/build-module/private-apis.native.js +2 -0
  216. package/build-module/private-apis.native.js.map +1 -1
  217. package/build-module/store/actions.js +191 -1
  218. package/build-module/store/actions.js.map +1 -1
  219. package/build-module/store/defaults.js +1 -0
  220. package/build-module/store/defaults.js.map +1 -1
  221. package/build-module/store/index.js +10 -1
  222. package/build-module/store/index.js.map +1 -1
  223. package/build-module/store/private-actions.js +45 -36
  224. package/build-module/store/private-actions.js.map +1 -1
  225. package/build-module/store/private-selectors.js +2 -2
  226. package/build-module/store/private-selectors.js.map +1 -1
  227. package/build-module/store/reducer.js +22 -8
  228. package/build-module/store/reducer.js.map +1 -1
  229. package/build-module/store/selectors.js +33 -15
  230. package/build-module/store/selectors.js.map +1 -1
  231. package/build-style/content-rtl.css +3 -0
  232. package/build-style/content.css +3 -0
  233. package/build-style/style-rtl.css +131 -129
  234. package/build-style/style.css +131 -129
  235. package/package.json +32 -31
  236. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
  237. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
  238. package/src/components/block-draggable/style.scss +1 -0
  239. package/src/components/block-heading-level-dropdown/heading-level-icon.js +6 -1
  240. package/src/components/block-heading-level-dropdown/index.native.js +8 -4
  241. package/src/components/block-inspector/style.scss +2 -1
  242. package/src/components/block-lock/toolbar.js +34 -6
  243. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +4 -8
  244. package/src/components/block-parent-selector/index.js +13 -8
  245. package/src/components/block-removal-warning-modal/index.js +20 -33
  246. package/src/components/block-toolbar/index.js +9 -6
  247. package/src/components/block-tools/block-contextual-toolbar.js +5 -11
  248. package/src/components/block-tools/style.scss +73 -26
  249. package/src/components/default-block-appender/content.scss +11 -0
  250. package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
  251. package/src/components/dimensions-tool/index.js +212 -0
  252. package/src/components/dimensions-tool/scale-tool.js +124 -0
  253. package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
  254. package/src/components/dimensions-tool/stories/index.js +54 -0
  255. package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
  256. package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
  257. package/src/components/dimensions-tool/test/index.js +641 -0
  258. package/src/components/dimensions-tool/width-height-tool.js +113 -0
  259. package/src/components/font-family/README.md +71 -0
  260. package/src/components/global-styles/color-panel.js +1 -1
  261. package/src/components/global-styles/filters-panel.js +2 -2
  262. package/src/components/global-styles/hooks.js +2 -0
  263. package/src/components/global-styles/typography-panel.js +40 -0
  264. package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
  265. package/src/components/image-editor/use-save-image.js +0 -1
  266. package/src/components/image-size-control/index.js +6 -0
  267. package/src/components/index.js +6 -0
  268. package/src/components/inserter/block-patterns-explorer/patterns-list.js +8 -2
  269. package/src/components/inserter/block-patterns-tab.js +8 -56
  270. package/src/components/inserter/hooks/use-block-types-state.js +3 -4
  271. package/src/components/inserter/hooks/use-patterns-state.js +35 -19
  272. package/src/components/inserter/media-tab/hooks.js +2 -22
  273. package/src/components/inserter/reusable-block-rename-hint.js +52 -0
  274. package/src/components/inserter/reusable-blocks-tab.js +5 -1
  275. package/src/components/inserter/reusable-blocks-tab.native.js +2 -2
  276. package/src/components/inserter/style.scss +28 -0
  277. package/src/components/inserter/tabs.native.js +5 -1
  278. package/src/components/inserter-draggable-blocks/index.js +13 -2
  279. package/src/components/link-control/constants.js +1 -1
  280. package/src/components/link-control/index.js +32 -28
  281. package/src/components/link-control/search-create-button.js +8 -26
  282. package/src/components/link-control/search-input.js +4 -3
  283. package/src/components/link-control/search-item.js +21 -43
  284. package/src/components/link-control/search-results.js +48 -46
  285. package/src/components/link-control/settings-drawer.js +6 -5
  286. package/src/components/link-control/style.scss +51 -123
  287. package/src/components/link-control/test/index.js +135 -123
  288. package/src/components/list-view/appender.js +5 -6
  289. package/src/components/list-view/style.scss +1 -2
  290. package/src/components/media-replace-flow/test/index.js +1 -1
  291. package/src/components/panel-color-settings/README.md +98 -0
  292. package/src/components/provider/index.js +9 -2
  293. package/src/components/provider/test/use-block-sync.js +21 -6
  294. package/src/components/provider/use-block-sync.js +19 -0
  295. package/src/components/recursion-provider/README.md +101 -0
  296. package/src/components/resolution-tool/index.js +56 -0
  297. package/src/components/resolution-tool/stories/index.js +48 -0
  298. package/src/components/url-input/index.js +2 -0
  299. package/src/components/writing-flow/use-tab-nav.js +10 -33
  300. package/src/components/writing-mode-control/index.js +68 -0
  301. package/src/components/writing-mode-control/style.scss +18 -0
  302. package/src/hooks/behaviors.js +25 -16
  303. package/src/hooks/supports.js +7 -0
  304. package/src/hooks/typography.js +2 -0
  305. package/src/hooks/utils.js +3 -0
  306. package/src/private-apis.js +6 -0
  307. package/src/private-apis.native.js +2 -0
  308. package/src/store/actions.js +194 -1
  309. package/src/store/defaults.js +1 -0
  310. package/src/store/index.js +10 -0
  311. package/src/store/private-actions.js +39 -39
  312. package/src/store/private-selectors.js +2 -2
  313. package/src/store/reducer.js +22 -8
  314. package/src/store/selectors.js +54 -20
  315. package/src/store/test/actions.js +111 -0
  316. package/src/store/test/private-actions.js +56 -0
@@ -0,0 +1,52 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { Button } from '@wordpress/components';
5
+ import { useDispatch, useSelect } from '@wordpress/data';
6
+ import { focus } from '@wordpress/dom';
7
+ import { useRef } from '@wordpress/element';
8
+ import { __ } from '@wordpress/i18n';
9
+ import { close } from '@wordpress/icons';
10
+ import { store as preferencesStore } from '@wordpress/preferences';
11
+
12
+ const PREFERENCE_NAME = 'isResuableBlocksrRenameHintVisible';
13
+
14
+ export default function ReusableBlocksRenameHint() {
15
+ const isReusableBlocksRenameHint = useSelect(
16
+ ( select ) =>
17
+ select( preferencesStore ).get( 'core', PREFERENCE_NAME ) ?? true,
18
+ []
19
+ );
20
+
21
+ const ref = useRef();
22
+
23
+ const { set: setPreference } = useDispatch( preferencesStore );
24
+ if ( ! isReusableBlocksRenameHint ) {
25
+ return null;
26
+ }
27
+
28
+ return (
29
+ <div ref={ ref } className="reusable-blocks-menu-items__rename-hint">
30
+ <div className="reusable-blocks-menu-items__rename-hint-content">
31
+ { __(
32
+ 'Reusable blocks are now called patterns. A synced pattern will behave in exactly the same way as a reusable block.'
33
+ ) }
34
+ </div>
35
+ <Button
36
+ className="reusable-blocks-menu-items__rename-hint-dismiss"
37
+ icon={ close }
38
+ iconSize="16"
39
+ label={ __( 'Dismiss hint' ) }
40
+ onClick={ () => {
41
+ // Retain focus when dismissing the element.
42
+ const previousElement = focus.tabbable.findPrevious(
43
+ ref.current
44
+ );
45
+ previousElement?.focus();
46
+ setPreference( 'core', PREFERENCE_NAME, false );
47
+ } }
48
+ showTooltip={ false }
49
+ />
50
+ </div>
51
+ );
52
+ }
@@ -13,6 +13,7 @@ import BlockTypesList from '../block-types-list';
13
13
  import InserterPanel from './panel';
14
14
  import InserterNoResults from './no-results';
15
15
  import useBlockTypesState from './hooks/use-block-types-state';
16
+ import ReusableBlocksRenameHint from './reusable-block-rename-hint';
16
17
 
17
18
  function ReusableBlocksList( { onHover, onInsert, rootClientId } ) {
18
19
  const [ items, , , onSelectItem ] = useBlockTypesState(
@@ -54,6 +55,9 @@ function ReusableBlocksList( { onHover, onInsert, rootClientId } ) {
54
55
  export function ReusableBlocksTab( { rootClientId, onInsert, onHover } ) {
55
56
  return (
56
57
  <>
58
+ <div className="block-editor-inserter__hint">
59
+ <ReusableBlocksRenameHint />
60
+ </div>
57
61
  <ReusableBlocksList
58
62
  onHover={ onHover }
59
63
  onInsert={ onInsert }
@@ -67,7 +71,7 @@ export function ReusableBlocksTab( { rootClientId, onInsert, onHover } ) {
67
71
  post_type: 'wp_block',
68
72
  } ) }
69
73
  >
70
- { __( 'Manage custom patterns' ) }
74
+ { __( 'Manage my patterns' ) }
71
75
  </Button>
72
76
  </div>
73
77
  </>
@@ -28,11 +28,11 @@ function ReusableBlocksTab( { onSelect, rootClientId, listProps } ) {
28
28
 
29
29
  return (
30
30
  <BlockTypesList
31
- name="ReusableBlocks"
31
+ name="SyncedPatterns"
32
32
  sections={ sections }
33
33
  onSelect={ onSelect }
34
34
  listProps={ listProps }
35
- label={ __( 'Reusable blocks' ) }
35
+ label={ __( 'Synced patterns' ) }
36
36
  />
37
37
  );
38
38
  }
@@ -711,3 +711,31 @@ $block-inserter-tabs-height: 44px;
711
711
  margin: 0;
712
712
  }
713
713
  }
714
+
715
+ .block-editor-inserter__hint {
716
+ margin: $grid-unit-20 $grid-unit-20 0;
717
+ }
718
+
719
+ .reusable-blocks-menu-items__rename-hint {
720
+ align-items: top;
721
+ background: $gray-100;
722
+ border-radius: $radius-block-ui;
723
+ color: $gray-900;
724
+ display: flex;
725
+ flex-direction: row;
726
+ max-width: 380px;
727
+ }
728
+
729
+ .reusable-blocks-menu-items__rename-hint-content {
730
+ margin: $grid-unit-15 0 $grid-unit-15 $grid-unit-15;
731
+ }
732
+
733
+ .reusable-blocks-menu-items__rename-hint-dismiss {
734
+ // The dismiss button has a lot of empty space through its padding.
735
+ // Apply margin to visually align the icon with the top of the text to its left.
736
+ margin: $grid-unit-05 $grid-unit-05 $grid-unit-05 0;
737
+ }
738
+
739
+ .components-menu-group .reusable-blocks-menu-items__rename-hint {
740
+ margin: 0;
741
+ }
@@ -142,7 +142,11 @@ InserterTabs.Control = TabsControl;
142
142
 
143
143
  InserterTabs.getTabs = () => [
144
144
  { name: 'blocks', title: __( 'Blocks' ), component: BlockTypesTab },
145
- { name: 'reusable', title: __( 'Reusable' ), component: ReusableBlocksTab },
145
+ {
146
+ name: 'reusable',
147
+ title: __( 'Synced patterns' ),
148
+ component: ReusableBlocksTab,
149
+ },
146
150
  ];
147
151
 
148
152
  export default InserterTabs;
@@ -2,7 +2,8 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { Draggable } from '@wordpress/components';
5
- import { serialize } from '@wordpress/blocks';
5
+ import { serialize, store as blocksStore } from '@wordpress/blocks';
6
+ import { useSelect } from '@wordpress/data';
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
@@ -20,6 +21,16 @@ const InserterDraggableBlocks = ( {
20
21
  blocks,
21
22
  };
22
23
 
24
+ const blockTypeIcon = useSelect(
25
+ ( select ) => {
26
+ const { getBlockType } = select( blocksStore );
27
+ return (
28
+ blocks.length === 1 && getBlockType( blocks[ 0 ].name )?.icon
29
+ );
30
+ },
31
+ [ blocks ]
32
+ );
33
+
23
34
  return (
24
35
  <Draggable
25
36
  __experimentalTransferDataType="wp-blocks"
@@ -30,7 +41,7 @@ const InserterDraggableBlocks = ( {
30
41
  __experimentalDragComponent={
31
42
  <BlockDraggableChip
32
43
  count={ blocks.length }
33
- icon={ icon }
44
+ icon={ icon || ( ! isPattern && blockTypeIcon ) }
34
45
  isPattern={ isPattern }
35
46
  />
36
47
  }
@@ -8,7 +8,7 @@ import { __ } from '@wordpress/i18n';
8
8
  // order to handle it as a unique case.
9
9
  export const CREATE_TYPE = '__CREATE__';
10
10
  export const TEL_TYPE = 'tel';
11
- export const URL_TYPE = 'URL';
11
+ export const URL_TYPE = 'link';
12
12
  export const MAILTO_TYPE = 'mailto';
13
13
  export const INTERNAL_TYPE = 'internal';
14
14
 
@@ -292,7 +292,8 @@ function LinkControl( {
292
292
  const shownUnlinkControl =
293
293
  onRemove && value && ! isEditingLink && ! isCreatingPage;
294
294
 
295
- const showSettings = !! settings?.length;
295
+ const showSettings = !! settings?.length && isEditingLink && hasLinkValue;
296
+ const showActions = isEditingLink && hasLinkValue;
296
297
 
297
298
  // Only show text control once a URL value has been committed
298
299
  // and it isn't just empty whitespace.
@@ -322,6 +323,18 @@ function LinkControl( {
322
323
  'has-text-control': showTextControl,
323
324
  } ) }
324
325
  >
326
+ { showTextControl && (
327
+ <TextControl
328
+ __nextHasNoMarginBottom
329
+ ref={ textInputRef }
330
+ className="block-editor-link-control__field block-editor-link-control__text-content"
331
+ label={ __( 'Text' ) }
332
+ value={ internalControlValue?.title }
333
+ onChange={ setInternalTextInputValue }
334
+ onKeyDown={ handleSubmitWithEnter }
335
+ size="__unstable-large"
336
+ />
337
+ ) }
325
338
  <LinkControlSearchInput
326
339
  currentLink={ value }
327
340
  className="block-editor-link-control__field block-editor-link-control__search-input"
@@ -339,19 +352,8 @@ function LinkControl( {
339
352
  createSuggestionButtonText={
340
353
  createSuggestionButtonText
341
354
  }
342
- useLabel={ showTextControl }
355
+ hideLabelFromVision={ ! showTextControl }
343
356
  />
344
- { showTextControl && (
345
- <TextControl
346
- __nextHasNoMarginBottom
347
- ref={ textInputRef }
348
- className="block-editor-link-control__field block-editor-link-control__text-content"
349
- label={ __( 'Text' ) }
350
- value={ internalControlValue?.title }
351
- onChange={ setInternalTextInputValue }
352
- onKeyDown={ handleSubmitWithEnter }
353
- />
354
- ) }
355
357
  </div>
356
358
  { errorMessage && (
357
359
  <Notice
@@ -376,9 +378,9 @@ function LinkControl( {
376
378
  />
377
379
  ) }
378
380
 
379
- { isEditing && (
381
+ { showSettings && (
380
382
  <div className="block-editor-link-control__tools">
381
- { showSettings && (
383
+ { ! currentInputIsEmpty && (
382
384
  <LinkControlSettingsDrawer
383
385
  settingsOpen={ settingsOpen }
384
386
  setSettingsOpen={ setSettingsOpen }
@@ -392,20 +394,22 @@ function LinkControl( {
392
394
  />
393
395
  </LinkControlSettingsDrawer>
394
396
  ) }
397
+ </div>
398
+ ) }
395
399
 
396
- <div className="block-editor-link-control__search-actions">
397
- <Button
398
- variant="primary"
399
- onClick={ isDisabled ? noop : handleSubmit }
400
- className="block-editor-link-control__search-submit"
401
- aria-disabled={ isDisabled }
402
- >
403
- { __( 'Save' ) }
404
- </Button>
405
- <Button variant="tertiary" onClick={ handleCancel }>
406
- { __( 'Cancel' ) }
407
- </Button>
408
- </div>
400
+ { showActions && (
401
+ <div className="block-editor-link-control__search-actions">
402
+ <Button
403
+ variant="primary"
404
+ onClick={ isDisabled ? noop : handleSubmit }
405
+ className="block-editor-link-control__search-submit"
406
+ aria-disabled={ isDisabled }
407
+ >
408
+ { __( 'Save' ) }
409
+ </Button>
410
+ <Button variant="tertiary" onClick={ handleCancel }>
411
+ { __( 'Cancel' ) }
412
+ </Button>
409
413
  </div>
410
414
  ) }
411
415
 
@@ -1,21 +1,15 @@
1
- /**
2
- * External dependencies
3
- */
4
- import classnames from 'classnames';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
9
4
  import { __, sprintf } from '@wordpress/i18n';
10
- import { Button } from '@wordpress/components';
5
+ import { MenuItem } from '@wordpress/components';
11
6
  import { createInterpolateElement } from '@wordpress/element';
12
- import { Icon, plus } from '@wordpress/icons';
7
+ import { plus } from '@wordpress/icons';
13
8
 
14
9
  export const LinkControlSearchCreate = ( {
15
10
  searchTerm,
16
11
  onClick,
17
12
  itemProps,
18
- isSelected,
19
13
  buttonText,
20
14
  } ) => {
21
15
  if ( ! searchTerm ) {
@@ -40,27 +34,15 @@ export const LinkControlSearchCreate = ( {
40
34
  }
41
35
 
42
36
  return (
43
- <Button
37
+ <MenuItem
44
38
  { ...itemProps }
45
- className={ classnames(
46
- 'block-editor-link-control__search-create block-editor-link-control__search-item',
47
- {
48
- 'is-selected': isSelected,
49
- }
50
- ) }
39
+ iconPosition="left"
40
+ icon={ plus }
41
+ className="block-editor-link-control__search-item"
51
42
  onClick={ onClick }
52
43
  >
53
- <Icon
54
- className="block-editor-link-control__search-item-icon"
55
- icon={ plus }
56
- />
57
-
58
- <span className="block-editor-link-control__search-item-header">
59
- <span className="block-editor-link-control__search-item-title">
60
- { text }
61
- </span>
62
- </span>
63
- </Button>
44
+ { text }
45
+ </MenuItem>
64
46
  );
65
47
  };
66
48
 
@@ -46,7 +46,7 @@ const LinkControlSearchInput = forwardRef(
46
46
  suggestionsQuery = {},
47
47
  withURLSuggestion = true,
48
48
  createSuggestionButtonText,
49
- useLabel = false,
49
+ hideLabelFromVision = false,
50
50
  },
51
51
  ref
52
52
  ) => {
@@ -120,7 +120,7 @@ const LinkControlSearchInput = forwardRef(
120
120
  };
121
121
 
122
122
  const inputClasses = classnames( className, {
123
- 'has-no-label': ! useLabel,
123
+ // 'has-no-label': ! hideLabelFromVision,
124
124
  } );
125
125
 
126
126
  return (
@@ -128,7 +128,8 @@ const LinkControlSearchInput = forwardRef(
128
128
  <URLInput
129
129
  disableSuggestions={ currentLink?.url === value }
130
130
  __nextHasNoMarginBottom
131
- label={ useLabel ? 'URL' : undefined }
131
+ label={ __( 'Link' ) }
132
+ hideLabelFromVision={ hideLabelFromVision }
132
133
  className={ inputClasses }
133
134
  value={ value }
134
135
  onChange={ onInputChange }
@@ -1,14 +1,8 @@
1
- /**
2
- * External dependencies
3
- */
4
- import classnames from 'classnames';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
9
- import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';
10
4
  import { __ } from '@wordpress/i18n';
11
- import { Button, TextHighlight } from '@wordpress/components';
5
+ import { MenuItem, TextHighlight } from '@wordpress/components';
12
6
  import {
13
7
  Icon,
14
8
  globe,
@@ -19,6 +13,7 @@ import {
19
13
  file,
20
14
  } from '@wordpress/icons';
21
15
  import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
16
+ import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';
22
17
 
23
18
  const ICONS_MAP = {
24
19
  post: postList,
@@ -52,50 +47,33 @@ function SearchItemIcon( { isURL, suggestion } ) {
52
47
  export const LinkControlSearchItem = ( {
53
48
  itemProps,
54
49
  suggestion,
55
- isSelected = false,
50
+ searchTerm,
56
51
  onClick,
57
52
  isURL = false,
58
- searchTerm = '',
59
53
  shouldShowType = false,
60
54
  } ) => {
55
+ const info = isURL
56
+ ? __( 'Press ENTER to add this link' )
57
+ : filterURLForDisplay( safeDecodeURI( suggestion?.url ) );
58
+
61
59
  return (
62
- <Button
60
+ <MenuItem
63
61
  { ...itemProps }
62
+ info={ info }
63
+ iconPosition="left"
64
+ icon={
65
+ <SearchItemIcon suggestion={ suggestion } isURL={ isURL } />
66
+ }
64
67
  onClick={ onClick }
65
- className={ classnames( 'block-editor-link-control__search-item', {
66
- 'is-selected': isSelected,
67
- 'is-url': isURL,
68
- 'is-entity': ! isURL,
69
- } ) }
68
+ shortcut={ shouldShowType && getVisualTypeName( suggestion ) }
69
+ className="block-editor-link-control__search-item"
70
70
  >
71
- <SearchItemIcon suggestion={ suggestion } isURL={ isURL } />
72
-
73
- <span className="block-editor-link-control__search-item-header">
74
- <span className="block-editor-link-control__search-item-title">
75
- <TextHighlight
76
- // The component expects a plain text string.
77
- text={ stripHTML( suggestion.title ) }
78
- highlight={ searchTerm }
79
- />
80
- </span>
81
- <span
82
- aria-hidden={ ! isURL }
83
- className="block-editor-link-control__search-item-info"
84
- >
85
- { ! isURL &&
86
- ( filterURLForDisplay(
87
- safeDecodeURI( suggestion.url )
88
- ) ||
89
- '' ) }
90
- { isURL && __( 'Press ENTER to add this link' ) }
91
- </span>
92
- </span>
93
- { shouldShowType && suggestion.type && (
94
- <span className="block-editor-link-control__search-item-type">
95
- { getVisualTypeName( suggestion ) }
96
- </span>
97
- ) }
98
- </Button>
71
+ <TextHighlight
72
+ // The component expects a plain text string.
73
+ text={ stripHTML( suggestion.title ) }
74
+ highlight={ searchTerm }
75
+ />
76
+ </MenuItem>
99
77
  );
100
78
  };
101
79
 
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __, sprintf } from '@wordpress/i18n';
5
- import { VisuallyHidden } from '@wordpress/components';
5
+ import { VisuallyHidden, MenuGroup } from '@wordpress/components';
6
6
 
7
7
  /**
8
8
  * External dependencies
@@ -72,59 +72,61 @@ export default function LinkControlSearchResults( {
72
72
  className={ resultsListClasses }
73
73
  aria-labelledby={ searchResultsLabelId }
74
74
  >
75
- { suggestions.map( ( suggestion, index ) => {
76
- if (
77
- shouldShowCreateSuggestion &&
78
- CREATE_TYPE === suggestion.type
79
- ) {
75
+ <MenuGroup>
76
+ { suggestions.map( ( suggestion, index ) => {
77
+ if (
78
+ shouldShowCreateSuggestion &&
79
+ CREATE_TYPE === suggestion.type
80
+ ) {
81
+ return (
82
+ <LinkControlSearchCreate
83
+ searchTerm={ currentInputValue }
84
+ buttonText={ createSuggestionButtonText }
85
+ onClick={ () =>
86
+ handleSuggestionClick( suggestion )
87
+ }
88
+ // Intentionally only using `type` here as
89
+ // the constant is enough to uniquely
90
+ // identify the single "CREATE" suggestion.
91
+ key={ suggestion.type }
92
+ itemProps={ buildSuggestionItemProps(
93
+ suggestion,
94
+ index
95
+ ) }
96
+ isSelected={ index === selectedSuggestion }
97
+ />
98
+ );
99
+ }
100
+
101
+ // If we're not handling "Create" suggestions above then
102
+ // we don't want them in the main results so exit early.
103
+ if ( CREATE_TYPE === suggestion.type ) {
104
+ return null;
105
+ }
106
+
80
107
  return (
81
- <LinkControlSearchCreate
82
- searchTerm={ currentInputValue }
83
- buttonText={ createSuggestionButtonText }
84
- onClick={ () =>
85
- handleSuggestionClick( suggestion )
86
- }
87
- // Intentionally only using `type` here as
88
- // the constant is enough to uniquely
89
- // identify the single "CREATE" suggestion.
90
- key={ suggestion.type }
108
+ <LinkControlSearchItem
109
+ key={ `${ suggestion.id }-${ suggestion.type }` }
91
110
  itemProps={ buildSuggestionItemProps(
92
111
  suggestion,
93
112
  index
94
113
  ) }
114
+ suggestion={ suggestion }
115
+ index={ index }
116
+ onClick={ () => {
117
+ handleSuggestionClick( suggestion );
118
+ } }
95
119
  isSelected={ index === selectedSuggestion }
120
+ isURL={ LINK_ENTRY_TYPES.includes(
121
+ suggestion.type
122
+ ) }
123
+ searchTerm={ currentInputValue }
124
+ shouldShowType={ shouldShowSuggestionsTypes }
125
+ isFrontPage={ suggestion?.isFrontPage }
96
126
  />
97
127
  );
98
- }
99
-
100
- // If we're not handling "Create" suggestions above then
101
- // we don't want them in the main results so exit early.
102
- if ( CREATE_TYPE === suggestion.type ) {
103
- return null;
104
- }
105
-
106
- return (
107
- <LinkControlSearchItem
108
- key={ `${ suggestion.id }-${ suggestion.type }` }
109
- itemProps={ buildSuggestionItemProps(
110
- suggestion,
111
- index
112
- ) }
113
- suggestion={ suggestion }
114
- index={ index }
115
- onClick={ () => {
116
- handleSuggestionClick( suggestion );
117
- } }
118
- isSelected={ index === selectedSuggestion }
119
- isURL={ LINK_ENTRY_TYPES.includes(
120
- suggestion.type
121
- ) }
122
- searchTerm={ currentInputValue }
123
- shouldShowType={ shouldShowSuggestionsTypes }
124
- isFrontPage={ suggestion?.isFrontPage }
125
- />
126
- );
127
- } ) }
128
+ } ) }
129
+ </MenuGroup>
128
130
  </div>
129
131
  </div>
130
132
  );
@@ -6,9 +6,9 @@ import {
6
6
  __unstableMotion as motion,
7
7
  __unstableAnimatePresence as AnimatePresence,
8
8
  } from '@wordpress/components';
9
- import { settings as settingsIcon } from '@wordpress/icons';
9
+ import { chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';
10
10
  import { useReducedMotion, useInstanceId } from '@wordpress/compose';
11
- import { __ } from '@wordpress/i18n';
11
+ import { _x, isRTL } from '@wordpress/i18n';
12
12
  import { Fragment } from '@wordpress/element';
13
13
 
14
14
  function LinkSettingsDrawer( { children, settingsOpen, setSettingsOpen } ) {
@@ -28,10 +28,11 @@ function LinkSettingsDrawer( { children, settingsOpen, setSettingsOpen } ) {
28
28
  className="block-editor-link-control__drawer-toggle"
29
29
  aria-expanded={ settingsOpen }
30
30
  onClick={ () => setSettingsOpen( ! settingsOpen ) }
31
- icon={ settingsIcon }
32
- label={ __( 'Link Settings' ) }
31
+ icon={ isRTL() ? chevronLeftSmall : chevronRightSmall }
33
32
  aria-controls={ settingsDrawerId }
34
- />
33
+ >
34
+ { _x( 'Advanced', 'Additional link settings' ) }
35
+ </Button>
35
36
  <MaybeAnimatePresence>
36
37
  { settingsOpen && (
37
38
  <MaybeMotionDiv