@wordpress/block-editor 7.0.2 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (801) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +45 -1
  3. package/build/components/autocomplete/index.js +1 -1
  4. package/build/components/autocomplete/index.js.map +1 -1
  5. package/build/components/block-actions/index.js +8 -4
  6. package/build/components/block-actions/index.js.map +1 -1
  7. package/build/components/block-alignment-control/ui.js +61 -14
  8. package/build/components/block-alignment-control/ui.js.map +1 -1
  9. package/build/components/block-alignment-control/use-available-alignments.js +25 -3
  10. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  11. package/build/components/block-controls/fill.js +2 -2
  12. package/build/components/block-controls/fill.js.map +1 -1
  13. package/build/components/block-controls/hook.js +3 -3
  14. package/build/components/block-controls/hook.js.map +1 -1
  15. package/build/components/block-icon/index.js +5 -1
  16. package/build/components/block-icon/index.js.map +1 -1
  17. package/build/components/block-icon/index.native.js +9 -11
  18. package/build/components/block-icon/index.native.js.map +1 -1
  19. package/build/components/block-inspector/index.js +8 -0
  20. package/build/components/block-inspector/index.js.map +1 -1
  21. package/build/components/block-list/block-html.js +5 -0
  22. package/build/components/block-list/block-html.js.map +1 -1
  23. package/build/components/block-list/block.js +12 -5
  24. package/build/components/block-list/block.js.map +1 -1
  25. package/build/components/block-list/block.native.js +4 -3
  26. package/build/components/block-list/block.native.js.map +1 -1
  27. package/build/components/block-list/index.native.js +1 -1
  28. package/build/components/block-list/index.native.js.map +1 -1
  29. package/build/components/block-list/use-block-props/use-multi-selection.js +21 -8
  30. package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  31. package/build/components/block-list-appender/index.js +9 -1
  32. package/build/components/block-list-appender/index.js.map +1 -1
  33. package/build/components/block-mover/index.js +4 -4
  34. package/build/components/block-mover/index.js.map +1 -1
  35. package/build/components/block-mover/index.native.js +4 -4
  36. package/build/components/block-mover/index.native.js.map +1 -1
  37. package/build/components/block-navigation/dropdown.js +0 -1
  38. package/build/components/block-navigation/dropdown.js.map +1 -1
  39. package/build/components/block-patterns-list/index.js +1 -8
  40. package/build/components/block-patterns-list/index.js.map +1 -1
  41. package/build/components/block-preview/auto.js +1 -1
  42. package/build/components/block-preview/auto.js.map +1 -1
  43. package/build/components/block-settings/container.native.js +5 -2
  44. package/build/components/block-settings/container.native.js.map +1 -1
  45. package/build/components/block-settings-menu/block-settings-dropdown.js +26 -5
  46. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  47. package/build/components/block-settings-menu-controls/index.js +10 -3
  48. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  49. package/build/components/block-styles/preview.native.js +2 -2
  50. package/build/components/block-styles/preview.native.js.map +1 -1
  51. package/build/components/block-switcher/block-styles-menu.js +1 -1
  52. package/build/components/block-switcher/block-styles-menu.js.map +1 -1
  53. package/build/components/block-switcher/index.js +10 -3
  54. package/build/components/block-switcher/index.js.map +1 -1
  55. package/build/components/block-title/index.js +3 -2
  56. package/build/components/block-title/index.js.map +1 -1
  57. package/build/components/block-tools/block-popover.js +2 -4
  58. package/build/components/block-tools/block-popover.js.map +1 -1
  59. package/build/components/block-tools/index.js +4 -1
  60. package/build/components/block-tools/index.js.map +1 -1
  61. package/build/components/block-tools/insertion-point.js +96 -7
  62. package/build/components/block-tools/insertion-point.js.map +1 -1
  63. package/build/components/border-radius-control/index.js.map +1 -1
  64. package/build/components/border-radius-control/utils.js +17 -8
  65. package/build/components/border-radius-control/utils.js.map +1 -1
  66. package/build/components/colors/utils.js +11 -3
  67. package/build/components/colors/utils.js.map +1 -1
  68. package/build/components/colors-gradients/control.js +22 -57
  69. package/build/components/colors-gradients/control.js.map +1 -1
  70. package/build/components/colors-gradients/panel-color-gradient-settings.js +83 -7
  71. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  72. package/build/components/contrast-checker/index.js +18 -12
  73. package/build/components/contrast-checker/index.js.map +1 -1
  74. package/build/components/copy-handler/index.js +9 -3
  75. package/build/components/copy-handler/index.js.map +1 -1
  76. package/build/components/default-block-appender/index.js +2 -2
  77. package/build/components/default-block-appender/index.js.map +1 -1
  78. package/build/components/duotone-control/index.js +41 -39
  79. package/build/components/duotone-control/index.js.map +1 -1
  80. package/build/components/editor-styles/index.js +9 -3
  81. package/build/components/editor-styles/index.js.map +1 -1
  82. package/build/components/font-appearance-control/index.js +32 -21
  83. package/build/components/font-appearance-control/index.js.map +1 -1
  84. package/build/components/iframe/index.js +6 -4
  85. package/build/components/iframe/index.js.map +1 -1
  86. package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
  87. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  88. package/build/components/image-editor/constants.js +16 -0
  89. package/build/components/image-editor/constants.js.map +1 -0
  90. package/build/components/image-editor/context.js +59 -0
  91. package/build/components/image-editor/context.js.map +1 -0
  92. package/build/components/image-editor/cropper.js +83 -0
  93. package/build/components/image-editor/cropper.js.map +1 -0
  94. package/build/components/image-editor/form-controls.js +36 -0
  95. package/build/components/image-editor/form-controls.js.map +1 -0
  96. package/build/components/image-editor/index.js +60 -0
  97. package/build/components/image-editor/index.js.map +1 -0
  98. package/build/components/image-editor/rotation-button.js +37 -0
  99. package/build/components/image-editor/rotation-button.js.map +1 -0
  100. package/build/components/image-editor/use-save-image.js +84 -0
  101. package/build/components/image-editor/use-save-image.js.map +1 -0
  102. package/build/components/image-editor/use-transform-image.js +135 -0
  103. package/build/components/image-editor/use-transform-image.js.map +1 -0
  104. package/build/components/image-editor/zoom-dropdown.js +55 -0
  105. package/build/components/image-editor/zoom-dropdown.js.map +1 -0
  106. package/build/components/image-size-control/use-dimension-handler.js +14 -3
  107. package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
  108. package/build/components/index.js +36 -20
  109. package/build/components/index.js.map +1 -1
  110. package/build/components/index.native.js +2 -2
  111. package/build/components/index.native.js.map +1 -1
  112. package/build/components/inner-blocks/button-block-appender.js +11 -1
  113. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  114. package/build/components/inner-blocks/index.js +8 -5
  115. package/build/components/inner-blocks/index.js.map +1 -1
  116. package/build/components/inner-blocks/index.native.js +4 -3
  117. package/build/components/inner-blocks/index.native.js.map +1 -1
  118. package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
  119. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  120. package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
  121. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  122. package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
  123. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  124. package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
  125. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  126. package/build/components/inserter/block-patterns-tab.js +74 -35
  127. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  128. package/build/components/inserter/block-types-tab.native.js +3 -11
  129. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  130. package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  131. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  132. package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  133. package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  134. package/build/components/inserter/index.js +12 -4
  135. package/build/components/inserter/index.js.map +1 -1
  136. package/build/components/inserter/index.native.js +1 -7
  137. package/build/components/inserter/index.native.js.map +1 -1
  138. package/build/components/inserter/library.js +2 -0
  139. package/build/components/inserter/library.js.map +1 -1
  140. package/build/components/inserter/menu.js +2 -1
  141. package/build/components/inserter/menu.js.map +1 -1
  142. package/build/components/inserter/menu.native.js +11 -15
  143. package/build/components/inserter/menu.native.js.map +1 -1
  144. package/build/components/inserter/pattern-panel.js +19 -10
  145. package/build/components/inserter/pattern-panel.js.map +1 -1
  146. package/build/components/inserter/preview-panel.js +1 -1
  147. package/build/components/inserter/preview-panel.js.map +1 -1
  148. package/build/components/inserter/quick-inserter.js +2 -1
  149. package/build/components/inserter/quick-inserter.js.map +1 -1
  150. package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
  151. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  152. package/build/components/inserter/search-results.native.js +6 -11
  153. package/build/components/inserter/search-results.native.js.map +1 -1
  154. package/build/components/inserter/utils.native.js +44 -0
  155. package/build/components/inserter/utils.native.js.map +1 -0
  156. package/build/components/inspector-controls/block-support-slot-container.js +28 -0
  157. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
  158. package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
  159. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  160. package/build/components/inspector-controls/fill.js +16 -1
  161. package/build/components/inspector-controls/fill.js.map +1 -1
  162. package/build/components/inspector-controls/groups.js +5 -1
  163. package/build/components/inspector-controls/groups.js.map +1 -1
  164. package/build/components/inspector-controls/slot.js +15 -0
  165. package/build/components/inspector-controls/slot.js.map +1 -1
  166. package/build/components/letter-spacing-control/index.js +9 -6
  167. package/build/components/letter-spacing-control/index.js.map +1 -1
  168. package/build/components/link-control/index.js +93 -34
  169. package/build/components/link-control/index.js.map +1 -1
  170. package/build/components/link-control/link-preview.js +45 -15
  171. package/build/components/link-control/link-preview.js.map +1 -1
  172. package/build/components/link-control/search-input.js +25 -7
  173. package/build/components/link-control/search-input.js.map +1 -1
  174. package/build/components/list-view/block-contents.js +1 -20
  175. package/build/components/list-view/block-contents.js.map +1 -1
  176. package/build/components/list-view/block.js +54 -69
  177. package/build/components/list-view/block.js.map +1 -1
  178. package/build/components/list-view/branch.js +102 -76
  179. package/build/components/list-view/branch.js.map +1 -1
  180. package/build/components/list-view/index.js +45 -20
  181. package/build/components/list-view/index.js.map +1 -1
  182. package/build/components/list-view/leaf.js +2 -2
  183. package/build/components/list-view/leaf.js.map +1 -1
  184. package/build/components/list-view/list-item.js +3 -2
  185. package/build/components/list-view/list-item.js.map +1 -1
  186. package/build/components/list-view/use-list-view-client-ids.js +13 -54
  187. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  188. package/build/components/media-placeholder/index.js +29 -20
  189. package/build/components/media-placeholder/index.js.map +1 -1
  190. package/build/components/media-replace-flow/index.js +5 -3
  191. package/build/components/media-replace-flow/index.js.map +1 -1
  192. package/build/components/navigable-toolbar/index.js +1 -4
  193. package/build/components/navigable-toolbar/index.js.map +1 -1
  194. package/build/components/observe-typing/index.js +1 -1
  195. package/build/components/observe-typing/index.js.map +1 -1
  196. package/build/components/plain-text/index.native.js +30 -1
  197. package/build/components/plain-text/index.native.js.map +1 -1
  198. package/build/components/rich-text/embed-handler-picker.native.js +66 -0
  199. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
  200. package/build/components/rich-text/format-edit.js +28 -2
  201. package/build/components/rich-text/format-edit.js.map +1 -1
  202. package/build/components/rich-text/format-toolbar/index.js +32 -11
  203. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  204. package/build/components/rich-text/index.js +5 -1
  205. package/build/components/rich-text/index.js.map +1 -1
  206. package/build/components/rich-text/index.native.js +41 -2
  207. package/build/components/rich-text/index.native.js.map +1 -1
  208. package/build/components/rich-text/use-paste-handler.js +28 -9
  209. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  210. package/build/components/rich-text/utils.js +22 -0
  211. package/build/components/rich-text/utils.js.map +1 -1
  212. package/build/components/typewriter/index.js +1 -1
  213. package/build/components/typewriter/index.js.map +1 -1
  214. package/build/components/url-input/index.js +25 -11
  215. package/build/components/url-input/index.js.map +1 -1
  216. package/build/components/use-moving-animation/index.js +13 -10
  217. package/build/components/use-moving-animation/index.js.map +1 -1
  218. package/build/components/use-on-block-drop/index.js +2 -1
  219. package/build/components/use-on-block-drop/index.js.map +1 -1
  220. package/build/components/use-setting/index.js +48 -9
  221. package/build/components/use-setting/index.js.map +1 -1
  222. package/build/components/writing-flow/use-multi-selection.js +6 -0
  223. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  224. package/build/components/writing-flow/use-tab-nav.js +10 -1
  225. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  226. package/build/hooks/align.js +13 -10
  227. package/build/hooks/align.js.map +1 -1
  228. package/build/hooks/anchor.js +1 -1
  229. package/build/hooks/anchor.js.map +1 -1
  230. package/build/hooks/border.js +5 -5
  231. package/build/hooks/border.js.map +1 -1
  232. package/build/hooks/color-panel.js +5 -2
  233. package/build/hooks/color-panel.js.map +1 -1
  234. package/build/hooks/color.js +1 -1
  235. package/build/hooks/color.js.map +1 -1
  236. package/build/hooks/dimensions.js +23 -27
  237. package/build/hooks/dimensions.js.map +1 -1
  238. package/build/hooks/duotone.js +60 -16
  239. package/build/hooks/duotone.js.map +1 -1
  240. package/build/hooks/font-appearance.js +49 -6
  241. package/build/hooks/font-appearance.js.map +1 -1
  242. package/build/hooks/font-family.js +123 -32
  243. package/build/hooks/font-family.js.map +1 -1
  244. package/build/hooks/font-size.js +51 -9
  245. package/build/hooks/font-size.js.map +1 -1
  246. package/build/hooks/gap.js +2 -1
  247. package/build/hooks/gap.js.map +1 -1
  248. package/build/hooks/index.js +10 -0
  249. package/build/hooks/index.js.map +1 -1
  250. package/build/hooks/index.native.js +8 -0
  251. package/build/hooks/index.native.js.map +1 -1
  252. package/build/hooks/letter-spacing.js +44 -7
  253. package/build/hooks/letter-spacing.js.map +1 -1
  254. package/build/hooks/line-height.js +45 -8
  255. package/build/hooks/line-height.js.map +1 -1
  256. package/build/hooks/lock.js +43 -0
  257. package/build/hooks/lock.js.map +1 -0
  258. package/build/hooks/margin.js +1 -1
  259. package/build/hooks/margin.js.map +1 -1
  260. package/build/hooks/padding.js +1 -1
  261. package/build/hooks/padding.js.map +1 -1
  262. package/build/hooks/style.js +7 -4
  263. package/build/hooks/style.js.map +1 -1
  264. package/build/hooks/text-decoration.js +42 -6
  265. package/build/hooks/text-decoration.js.map +1 -1
  266. package/build/hooks/text-transform.js +42 -6
  267. package/build/hooks/text-transform.js.map +1 -1
  268. package/build/hooks/typography.js +108 -8
  269. package/build/hooks/typography.js.map +1 -1
  270. package/build/hooks/use-cached-truthy.js +29 -0
  271. package/build/hooks/use-cached-truthy.js.map +1 -0
  272. package/build/index.js +7 -0
  273. package/build/index.js.map +1 -1
  274. package/build/layouts/flex.js +160 -34
  275. package/build/layouts/flex.js.map +1 -1
  276. package/build/layouts/flow.js +75 -8
  277. package/build/layouts/flow.js.map +1 -1
  278. package/build/store/actions.js +323 -265
  279. package/build/store/actions.js.map +1 -1
  280. package/build/store/defaults.native.js +13 -1
  281. package/build/store/defaults.native.js.map +1 -1
  282. package/build/store/index.js +1 -3
  283. package/build/store/index.js.map +1 -1
  284. package/build/store/reducer.js +33 -22
  285. package/build/store/reducer.js.map +1 -1
  286. package/build/store/selectors.js +172 -38
  287. package/build/store/selectors.js.map +1 -1
  288. package/build/utils/index.js +10 -1
  289. package/build/utils/index.js.map +1 -1
  290. package/build/utils/parse-css-unit-to-px.js +51 -1
  291. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  292. package/build/utils/transform-styles/transforms/wrap.js +16 -0
  293. package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
  294. package/build-module/components/autocomplete/index.js +2 -2
  295. package/build-module/components/autocomplete/index.js.map +1 -1
  296. package/build-module/components/block-actions/index.js +8 -4
  297. package/build-module/components/block-actions/index.js.map +1 -1
  298. package/build-module/components/block-alignment-control/ui.js +64 -17
  299. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  300. package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
  301. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  302. package/build-module/components/block-controls/fill.js +2 -2
  303. package/build-module/components/block-controls/fill.js.map +1 -1
  304. package/build-module/components/block-controls/hook.js +3 -3
  305. package/build-module/components/block-controls/hook.js.map +1 -1
  306. package/build-module/components/block-icon/index.js +5 -1
  307. package/build-module/components/block-icon/index.js.map +1 -1
  308. package/build-module/components/block-icon/index.native.js +10 -11
  309. package/build-module/components/block-icon/index.native.js.map +1 -1
  310. package/build-module/components/block-inspector/index.js +8 -0
  311. package/build-module/components/block-inspector/index.js.map +1 -1
  312. package/build-module/components/block-list/block-html.js +5 -0
  313. package/build-module/components/block-list/block-html.js.map +1 -1
  314. package/build-module/components/block-list/block.js +12 -5
  315. package/build-module/components/block-list/block.js.map +1 -1
  316. package/build-module/components/block-list/block.native.js +4 -3
  317. package/build-module/components/block-list/block.native.js.map +1 -1
  318. package/build-module/components/block-list/index.native.js +1 -1
  319. package/build-module/components/block-list/index.native.js.map +1 -1
  320. package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -8
  321. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  322. package/build-module/components/block-list-appender/index.js +9 -1
  323. package/build-module/components/block-list-appender/index.js.map +1 -1
  324. package/build-module/components/block-mover/index.js +4 -4
  325. package/build-module/components/block-mover/index.js.map +1 -1
  326. package/build-module/components/block-mover/index.native.js +4 -4
  327. package/build-module/components/block-mover/index.native.js.map +1 -1
  328. package/build-module/components/block-navigation/dropdown.js +0 -1
  329. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  330. package/build-module/components/block-patterns-list/index.js +1 -6
  331. package/build-module/components/block-patterns-list/index.js.map +1 -1
  332. package/build-module/components/block-preview/auto.js +1 -1
  333. package/build-module/components/block-preview/auto.js.map +1 -1
  334. package/build-module/components/block-settings/container.native.js +6 -3
  335. package/build-module/components/block-settings/container.native.js.map +1 -1
  336. package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -7
  337. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  338. package/build-module/components/block-settings-menu-controls/index.js +10 -3
  339. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  340. package/build-module/components/block-styles/preview.native.js +2 -2
  341. package/build-module/components/block-styles/preview.native.js.map +1 -1
  342. package/build-module/components/block-switcher/block-styles-menu.js +1 -1
  343. package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
  344. package/build-module/components/block-switcher/index.js +10 -3
  345. package/build-module/components/block-switcher/index.js.map +1 -1
  346. package/build-module/components/block-title/index.js +3 -2
  347. package/build-module/components/block-title/index.js.map +1 -1
  348. package/build-module/components/block-tools/block-popover.js +3 -5
  349. package/build-module/components/block-tools/block-popover.js.map +1 -1
  350. package/build-module/components/block-tools/index.js +4 -1
  351. package/build-module/components/block-tools/index.js.map +1 -1
  352. package/build-module/components/block-tools/insertion-point.js +96 -8
  353. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  354. package/build-module/components/border-radius-control/index.js.map +1 -1
  355. package/build-module/components/border-radius-control/utils.js +16 -9
  356. package/build-module/components/border-radius-control/utils.js.map +1 -1
  357. package/build-module/components/colors/utils.js +9 -3
  358. package/build-module/components/colors/utils.js.map +1 -1
  359. package/build-module/components/colors-gradients/control.js +26 -63
  360. package/build-module/components/colors-gradients/control.js.map +1 -1
  361. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +84 -7
  362. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  363. package/build-module/components/contrast-checker/index.js +13 -10
  364. package/build-module/components/contrast-checker/index.js.map +1 -1
  365. package/build-module/components/copy-handler/index.js +9 -3
  366. package/build-module/components/copy-handler/index.js.map +1 -1
  367. package/build-module/components/default-block-appender/index.js +2 -2
  368. package/build-module/components/default-block-appender/index.js.map +1 -1
  369. package/build-module/components/duotone-control/index.js +43 -39
  370. package/build-module/components/duotone-control/index.js.map +1 -1
  371. package/build-module/components/editor-styles/index.js +7 -3
  372. package/build-module/components/editor-styles/index.js.map +1 -1
  373. package/build-module/components/font-appearance-control/index.js +28 -21
  374. package/build-module/components/font-appearance-control/index.js.map +1 -1
  375. package/build-module/components/iframe/index.js +6 -4
  376. package/build-module/components/iframe/index.js.map +1 -1
  377. package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
  378. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  379. package/build-module/components/image-editor/constants.js +7 -0
  380. package/build-module/components/image-editor/constants.js.map +1 -0
  381. package/build-module/components/image-editor/context.js +44 -0
  382. package/build-module/components/image-editor/context.js.map +1 -0
  383. package/build-module/components/image-editor/cropper.js +69 -0
  384. package/build-module/components/image-editor/cropper.js.map +1 -0
  385. package/build-module/components/image-editor/form-controls.js +26 -0
  386. package/build-module/components/image-editor/form-controls.js.map +1 -0
  387. package/build-module/components/image-editor/index.js +37 -0
  388. package/build-module/components/image-editor/index.js.map +1 -0
  389. package/build-module/components/image-editor/rotation-button.js +26 -0
  390. package/build-module/components/image-editor/rotation-button.js.map +1 -0
  391. package/build-module/components/image-editor/use-save-image.js +70 -0
  392. package/build-module/components/image-editor/use-save-image.js.map +1 -0
  393. package/build-module/components/image-editor/use-transform-image.js +127 -0
  394. package/build-module/components/image-editor/use-transform-image.js.map +1 -0
  395. package/build-module/components/image-editor/zoom-dropdown.js +43 -0
  396. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
  397. package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
  398. package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
  399. package/build-module/components/index.js +4 -3
  400. package/build-module/components/index.js.map +1 -1
  401. package/build-module/components/index.native.js +1 -1
  402. package/build-module/components/index.native.js.map +1 -1
  403. package/build-module/components/inner-blocks/button-block-appender.js +10 -1
  404. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  405. package/build-module/components/inner-blocks/index.js +9 -6
  406. package/build-module/components/inner-blocks/index.js.map +1 -1
  407. package/build-module/components/inner-blocks/index.native.js +5 -4
  408. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  409. package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
  410. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  411. package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
  412. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  413. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
  414. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  415. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
  416. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  417. package/build-module/components/inserter/block-patterns-tab.js +75 -36
  418. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  419. package/build-module/components/inserter/block-types-tab.native.js +2 -10
  420. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  421. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  422. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  423. package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  424. package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  425. package/build-module/components/inserter/index.js +12 -4
  426. package/build-module/components/inserter/index.js.map +1 -1
  427. package/build-module/components/inserter/index.native.js +1 -7
  428. package/build-module/components/inserter/index.native.js.map +1 -1
  429. package/build-module/components/inserter/library.js +2 -0
  430. package/build-module/components/inserter/library.js.map +1 -1
  431. package/build-module/components/inserter/menu.js +2 -1
  432. package/build-module/components/inserter/menu.js.map +1 -1
  433. package/build-module/components/inserter/menu.native.js +10 -15
  434. package/build-module/components/inserter/menu.native.js.map +1 -1
  435. package/build-module/components/inserter/pattern-panel.js +21 -13
  436. package/build-module/components/inserter/pattern-panel.js.map +1 -1
  437. package/build-module/components/inserter/preview-panel.js +1 -1
  438. package/build-module/components/inserter/preview-panel.js.map +1 -1
  439. package/build-module/components/inserter/quick-inserter.js +2 -1
  440. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  441. package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
  442. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  443. package/build-module/components/inserter/search-results.native.js +5 -10
  444. package/build-module/components/inserter/search-results.native.js.map +1 -1
  445. package/build-module/components/inserter/utils.native.js +35 -0
  446. package/build-module/components/inserter/utils.native.js.map +1 -0
  447. package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
  448. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
  449. package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
  450. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  451. package/build-module/components/inspector-controls/fill.js +16 -2
  452. package/build-module/components/inspector-controls/fill.js.map +1 -1
  453. package/build-module/components/inspector-controls/groups.js +5 -1
  454. package/build-module/components/inspector-controls/groups.js.map +1 -1
  455. package/build-module/components/inspector-controls/slot.js +13 -0
  456. package/build-module/components/inspector-controls/slot.js.map +1 -1
  457. package/build-module/components/letter-spacing-control/index.js +9 -6
  458. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  459. package/build-module/components/link-control/index.js +93 -35
  460. package/build-module/components/link-control/index.js.map +1 -1
  461. package/build-module/components/link-control/link-preview.js +46 -17
  462. package/build-module/components/link-control/link-preview.js.map +1 -1
  463. package/build-module/components/link-control/search-input.js +24 -7
  464. package/build-module/components/link-control/search-input.js.map +1 -1
  465. package/build-module/components/list-view/block-contents.js +1 -18
  466. package/build-module/components/list-view/block-contents.js.map +1 -1
  467. package/build-module/components/list-view/block.js +56 -71
  468. package/build-module/components/list-view/block.js.map +1 -1
  469. package/build-module/components/list-view/branch.js +102 -78
  470. package/build-module/components/list-view/branch.js.map +1 -1
  471. package/build-module/components/list-view/index.js +48 -23
  472. package/build-module/components/list-view/index.js.map +1 -1
  473. package/build-module/components/list-view/leaf.js +2 -2
  474. package/build-module/components/list-view/leaf.js.map +1 -1
  475. package/build-module/components/list-view/list-item.js +3 -2
  476. package/build-module/components/list-view/list-item.js.map +1 -1
  477. package/build-module/components/list-view/use-list-view-client-ids.js +13 -54
  478. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  479. package/build-module/components/media-placeholder/index.js +29 -20
  480. package/build-module/components/media-placeholder/index.js.map +1 -1
  481. package/build-module/components/media-replace-flow/index.js +5 -3
  482. package/build-module/components/media-replace-flow/index.js.map +1 -1
  483. package/build-module/components/navigable-toolbar/index.js +1 -4
  484. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  485. package/build-module/components/observe-typing/index.js +1 -1
  486. package/build-module/components/observe-typing/index.js.map +1 -1
  487. package/build-module/components/plain-text/index.native.js +29 -2
  488. package/build-module/components/plain-text/index.native.js.map +1 -1
  489. package/build-module/components/rich-text/embed-handler-picker.native.js +54 -0
  490. package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
  491. package/build-module/components/rich-text/format-edit.js +28 -3
  492. package/build-module/components/rich-text/format-edit.js.map +1 -1
  493. package/build-module/components/rich-text/format-toolbar/index.js +29 -11
  494. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  495. package/build-module/components/rich-text/index.js +4 -1
  496. package/build-module/components/rich-text/index.js.map +1 -1
  497. package/build-module/components/rich-text/index.native.js +41 -3
  498. package/build-module/components/rich-text/index.native.js.map +1 -1
  499. package/build-module/components/rich-text/use-paste-handler.js +28 -9
  500. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  501. package/build-module/components/rich-text/utils.js +20 -0
  502. package/build-module/components/rich-text/utils.js.map +1 -1
  503. package/build-module/components/typewriter/index.js +1 -1
  504. package/build-module/components/typewriter/index.js.map +1 -1
  505. package/build-module/components/url-input/index.js +25 -11
  506. package/build-module/components/url-input/index.js.map +1 -1
  507. package/build-module/components/use-moving-animation/index.js +13 -10
  508. package/build-module/components/use-moving-animation/index.js.map +1 -1
  509. package/build-module/components/use-on-block-drop/index.js +3 -2
  510. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  511. package/build-module/components/use-setting/index.js +48 -9
  512. package/build-module/components/use-setting/index.js.map +1 -1
  513. package/build-module/components/writing-flow/use-multi-selection.js +6 -0
  514. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  515. package/build-module/components/writing-flow/use-tab-nav.js +10 -1
  516. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  517. package/build-module/hooks/align.js +13 -10
  518. package/build-module/hooks/align.js.map +1 -1
  519. package/build-module/hooks/anchor.js +1 -1
  520. package/build-module/hooks/anchor.js.map +1 -1
  521. package/build-module/hooks/border.js +5 -5
  522. package/build-module/hooks/border.js.map +1 -1
  523. package/build-module/hooks/color-panel.js +6 -3
  524. package/build-module/hooks/color-panel.js.map +1 -1
  525. package/build-module/hooks/color.js +1 -1
  526. package/build-module/hooks/color.js.map +1 -1
  527. package/build-module/hooks/dimensions.js +24 -27
  528. package/build-module/hooks/dimensions.js.map +1 -1
  529. package/build-module/hooks/duotone.js +59 -16
  530. package/build-module/hooks/duotone.js.map +1 -1
  531. package/build-module/hooks/font-appearance.js +45 -6
  532. package/build-module/hooks/font-appearance.js.map +1 -1
  533. package/build-module/hooks/font-family.js +117 -33
  534. package/build-module/hooks/font-family.js.map +1 -1
  535. package/build-module/hooks/font-size.js +47 -9
  536. package/build-module/hooks/font-size.js.map +1 -1
  537. package/build-module/hooks/gap.js +2 -1
  538. package/build-module/hooks/gap.js.map +1 -1
  539. package/build-module/hooks/index.js +2 -0
  540. package/build-module/hooks/index.js.map +1 -1
  541. package/build-module/hooks/index.native.js +1 -0
  542. package/build-module/hooks/index.native.js.map +1 -1
  543. package/build-module/hooks/letter-spacing.js +40 -7
  544. package/build-module/hooks/letter-spacing.js.map +1 -1
  545. package/build-module/hooks/line-height.js +41 -8
  546. package/build-module/hooks/line-height.js.map +1 -1
  547. package/build-module/hooks/lock.js +33 -0
  548. package/build-module/hooks/lock.js.map +1 -0
  549. package/build-module/hooks/margin.js +1 -1
  550. package/build-module/hooks/margin.js.map +1 -1
  551. package/build-module/hooks/padding.js +1 -1
  552. package/build-module/hooks/padding.js.map +1 -1
  553. package/build-module/hooks/style.js +7 -4
  554. package/build-module/hooks/style.js.map +1 -1
  555. package/build-module/hooks/text-decoration.js +38 -6
  556. package/build-module/hooks/text-decoration.js.map +1 -1
  557. package/build-module/hooks/text-transform.js +38 -6
  558. package/build-module/hooks/text-transform.js.map +1 -1
  559. package/build-module/hooks/typography.js +117 -17
  560. package/build-module/hooks/typography.js.map +1 -1
  561. package/build-module/hooks/use-cached-truthy.js +21 -0
  562. package/build-module/hooks/use-cached-truthy.js.map +1 -0
  563. package/build-module/index.js +1 -1
  564. package/build-module/index.js.map +1 -1
  565. package/build-module/layouts/flex.js +163 -38
  566. package/build-module/layouts/flex.js.map +1 -1
  567. package/build-module/layouts/flow.js +74 -8
  568. package/build-module/layouts/flow.js.map +1 -1
  569. package/build-module/store/actions.js +286 -241
  570. package/build-module/store/actions.js.map +1 -1
  571. package/build-module/store/defaults.native.js +12 -1
  572. package/build-module/store/defaults.native.js.map +1 -1
  573. package/build-module/store/index.js +1 -2
  574. package/build-module/store/index.js.map +1 -1
  575. package/build-module/store/reducer.js +33 -22
  576. package/build-module/store/reducer.js.map +1 -1
  577. package/build-module/store/selectors.js +160 -34
  578. package/build-module/store/selectors.js.map +1 -1
  579. package/build-module/utils/index.js +1 -0
  580. package/build-module/utils/index.js.map +1 -1
  581. package/build-module/utils/parse-css-unit-to-px.js +48 -1
  582. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  583. package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
  584. package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
  585. package/build-style/style-rtl.css +267 -144
  586. package/build-style/style.css +267 -144
  587. package/package.json +28 -27
  588. package/src/components/autocomplete/index.js +5 -2
  589. package/src/components/block-actions/index.js +9 -5
  590. package/src/components/block-alignment-control/style.scss +5 -0
  591. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
  592. package/src/components/block-alignment-control/test/index.native.js +37 -0
  593. package/src/components/block-alignment-control/ui.js +98 -27
  594. package/src/components/block-alignment-control/use-available-alignments.js +31 -10
  595. package/src/components/block-controls/fill.js +5 -2
  596. package/src/components/block-controls/hook.js +3 -3
  597. package/src/components/block-draggable/style.scss +19 -4
  598. package/src/components/block-icon/index.js +4 -1
  599. package/src/components/block-icon/index.native.js +10 -16
  600. package/src/components/block-inspector/index.js +10 -0
  601. package/src/components/block-list/block-html.js +5 -0
  602. package/src/components/block-list/block.js +11 -3
  603. package/src/components/block-list/block.native.js +5 -3
  604. package/src/components/block-list/index.native.js +1 -1
  605. package/src/components/block-list/style.scss +15 -0
  606. package/src/components/block-list/use-block-props/use-multi-selection.js +27 -7
  607. package/src/components/block-list-appender/index.js +8 -0
  608. package/src/components/block-mover/index.js +4 -4
  609. package/src/components/block-mover/index.native.js +4 -4
  610. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
  611. package/src/components/block-mover/test/index.native.js +26 -28
  612. package/src/components/block-navigation/dropdown.js +0 -1
  613. package/src/components/block-patterns-list/index.js +1 -8
  614. package/src/components/block-patterns-list/style.scss +22 -12
  615. package/src/components/block-preview/README.md +1 -1
  616. package/src/components/block-preview/auto.js +1 -1
  617. package/src/components/block-preview/style.scss +0 -17
  618. package/src/components/block-settings/container.native.js +7 -0
  619. package/src/components/block-settings-menu/block-settings-dropdown.js +26 -13
  620. package/src/components/block-settings-menu-controls/index.js +9 -6
  621. package/src/components/block-styles/preview.native.js +2 -2
  622. package/src/components/block-switcher/block-styles-menu.js +1 -1
  623. package/src/components/block-switcher/index.js +7 -3
  624. package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
  625. package/src/components/block-switcher/test/index.js +3 -0
  626. package/src/components/block-title/index.js +5 -2
  627. package/src/components/block-tools/block-popover.js +3 -5
  628. package/src/components/block-tools/index.js +5 -2
  629. package/src/components/block-tools/insertion-point.js +97 -9
  630. package/src/components/block-tools/style.scss +4 -35
  631. package/src/components/block-types-list/style.scss +0 -3
  632. package/src/components/border-radius-control/index.js +1 -0
  633. package/src/components/border-radius-control/test/utils.js +216 -0
  634. package/src/components/border-radius-control/utils.js +18 -10
  635. package/src/components/color-palette/test/__snapshots__/control.js.snap +128 -71
  636. package/src/components/colors/test/utils.js +41 -0
  637. package/src/components/colors/utils.js +9 -5
  638. package/src/components/colors-gradients/control.js +70 -110
  639. package/src/components/colors-gradients/panel-color-gradient-settings.js +79 -7
  640. package/src/components/colors-gradients/style.scss +10 -18
  641. package/src/components/colors-gradients/test/control.js +41 -66
  642. package/src/components/contrast-checker/index.js +14 -10
  643. package/src/components/copy-handler/index.js +6 -1
  644. package/src/components/default-block-appender/index.js +2 -2
  645. package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
  646. package/src/components/duotone-control/index.js +49 -41
  647. package/src/components/duotone-control/style.scss +27 -12
  648. package/src/components/editor-styles/index.js +7 -4
  649. package/src/components/font-appearance-control/index.js +41 -33
  650. package/src/components/font-appearance-control/style.scss +1 -1
  651. package/src/components/iframe/index.js +4 -4
  652. package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
  653. package/src/components/image-editor/constants.js +6 -0
  654. package/src/components/image-editor/context.js +56 -0
  655. package/src/components/image-editor/cropper.js +74 -0
  656. package/src/components/image-editor/form-controls.js +22 -0
  657. package/src/components/image-editor/index.js +52 -0
  658. package/src/components/image-editor/rotation-button.js +24 -0
  659. package/src/components/image-editor/use-save-image.js +97 -0
  660. package/src/components/image-editor/use-transform-image.js +162 -0
  661. package/src/components/image-editor/zoom-dropdown.js +40 -0
  662. package/src/components/image-size-control/use-dimension-handler.js +18 -1
  663. package/src/components/index.js +7 -6
  664. package/src/components/index.native.js +1 -4
  665. package/src/components/inner-blocks/button-block-appender.js +9 -0
  666. package/src/components/inner-blocks/index.js +8 -4
  667. package/src/components/inner-blocks/index.native.js +7 -4
  668. package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
  669. package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
  670. package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
  671. package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
  672. package/src/components/inserter/block-patterns-tab.js +107 -73
  673. package/src/components/inserter/block-types-tab.native.js +3 -15
  674. package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
  675. package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
  676. package/src/components/inserter/index.js +15 -3
  677. package/src/components/inserter/index.native.js +2 -19
  678. package/src/components/inserter/library.js +2 -0
  679. package/src/components/inserter/menu.js +4 -1
  680. package/src/components/inserter/menu.native.js +9 -14
  681. package/src/components/inserter/pattern-panel.js +33 -16
  682. package/src/components/inserter/preview-panel.js +1 -1
  683. package/src/components/inserter/quick-inserter.js +1 -1
  684. package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
  685. package/src/components/inserter/search-results.native.js +5 -15
  686. package/src/components/inserter/style.scss +80 -16
  687. package/src/components/inserter/test/block-types-tab.native.js +1 -1
  688. package/src/components/inserter/test/fixtures/index.native.js +12 -0
  689. package/src/components/inserter/utils.native.js +35 -0
  690. package/src/components/inserter-list-item/style.scss +4 -2
  691. package/src/components/inspector-controls/block-support-slot-container.js +10 -0
  692. package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
  693. package/src/components/inspector-controls/fill.js +23 -2
  694. package/src/components/inspector-controls/groups.js +8 -0
  695. package/src/components/inspector-controls/slot.js +15 -0
  696. package/src/components/letter-spacing-control/index.js +12 -6
  697. package/src/components/link-control/README.md +47 -14
  698. package/src/components/link-control/index.js +102 -31
  699. package/src/components/link-control/link-preview.js +53 -20
  700. package/src/components/link-control/search-input.js +21 -7
  701. package/src/components/link-control/style.scss +66 -19
  702. package/src/components/link-control/test/index.js +311 -4
  703. package/src/components/list-view/block-contents.js +17 -38
  704. package/src/components/list-view/block.js +73 -84
  705. package/src/components/list-view/branch.js +123 -94
  706. package/src/components/list-view/index.js +82 -30
  707. package/src/components/list-view/leaf.js +2 -2
  708. package/src/components/list-view/list-item.js +5 -4
  709. package/src/components/list-view/style.scss +70 -33
  710. package/src/components/list-view/use-list-view-client-ids.js +9 -68
  711. package/src/components/media-placeholder/index.js +26 -19
  712. package/src/components/media-replace-flow/README.md +7 -0
  713. package/src/components/media-replace-flow/index.js +4 -1
  714. package/src/components/media-upload/README.md +1 -1
  715. package/src/components/navigable-toolbar/index.js +1 -4
  716. package/src/components/observe-typing/index.js +3 -2
  717. package/src/components/plain-text/index.native.js +26 -4
  718. package/src/components/rich-text/embed-handler-picker.native.js +68 -0
  719. package/src/components/rich-text/format-edit.js +36 -2
  720. package/src/components/rich-text/format-toolbar/index.js +25 -6
  721. package/src/components/rich-text/index.js +12 -8
  722. package/src/components/rich-text/index.native.js +35 -1
  723. package/src/components/rich-text/use-paste-handler.js +30 -12
  724. package/src/components/rich-text/utils.js +16 -0
  725. package/src/components/skip-to-selected-block/README.md +39 -0
  726. package/src/components/typewriter/index.js +3 -2
  727. package/src/components/url-input/index.js +26 -10
  728. package/src/components/use-moving-animation/index.js +9 -8
  729. package/src/components/use-on-block-drop/index.js +5 -1
  730. package/src/components/use-setting/index.js +49 -11
  731. package/src/components/writing-flow/use-multi-selection.js +6 -0
  732. package/src/components/writing-flow/use-tab-nav.js +17 -3
  733. package/src/hooks/align.js +19 -10
  734. package/src/hooks/anchor.js +2 -2
  735. package/src/hooks/border.js +8 -11
  736. package/src/hooks/color-panel.js +4 -1
  737. package/src/hooks/color.js +7 -4
  738. package/src/hooks/dimensions.js +48 -59
  739. package/src/hooks/duotone.js +68 -19
  740. package/src/hooks/font-appearance.js +38 -7
  741. package/src/hooks/font-family.js +129 -33
  742. package/src/hooks/font-size.js +42 -6
  743. package/src/hooks/gap.js +2 -1
  744. package/src/hooks/index.js +2 -0
  745. package/src/hooks/index.native.js +1 -0
  746. package/src/hooks/layout.scss +8 -0
  747. package/src/hooks/letter-spacing.js +35 -7
  748. package/src/hooks/line-height.js +37 -9
  749. package/src/hooks/lock.js +34 -0
  750. package/src/hooks/margin.js +1 -1
  751. package/src/hooks/padding.js +1 -1
  752. package/src/hooks/style.js +15 -11
  753. package/src/hooks/text-decoration.js +34 -6
  754. package/src/hooks/text-transform.js +34 -6
  755. package/src/hooks/typography.js +165 -15
  756. package/src/hooks/typography.scss +16 -0
  757. package/src/hooks/use-cached-truthy.js +20 -0
  758. package/src/index.js +1 -0
  759. package/src/layouts/flex.js +179 -50
  760. package/src/layouts/flow.js +54 -8
  761. package/src/store/actions.js +239 -377
  762. package/src/store/defaults.native.js +12 -0
  763. package/src/store/index.js +1 -2
  764. package/src/store/reducer.js +54 -18
  765. package/src/store/selectors.js +173 -47
  766. package/src/store/test/actions.js +407 -705
  767. package/src/store/test/reducer.js +22 -54
  768. package/src/store/test/selectors.js +79 -21
  769. package/src/style.scss +2 -1
  770. package/src/utils/index.js +1 -0
  771. package/src/utils/parse-css-unit-to-px.js +43 -1
  772. package/src/utils/test/parse-css-unit-to-px.js +148 -165
  773. package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
  774. package/src/utils/transform-styles/transforms/wrap.js +16 -0
  775. package/tsconfig.tsbuildinfo +1 -1
  776. package/build/components/duotone-control/duotone-picker-popover.js +0 -44
  777. package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
  778. package/build/components/list-view/block-slot.js +0 -121
  779. package/build/components/list-view/block-slot.js.map +0 -1
  780. package/build/components/list-view/editor.js +0 -35
  781. package/build/components/list-view/editor.js.map +0 -1
  782. package/build/components/text-decoration-and-transform/index.js +0 -39
  783. package/build/components/text-decoration-and-transform/index.js.map +0 -1
  784. package/build/store/controls.js +0 -44
  785. package/build/store/controls.js.map +0 -1
  786. package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
  787. package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
  788. package/build-module/components/list-view/block-slot.js +0 -96
  789. package/build-module/components/list-view/block-slot.js.map +0 -1
  790. package/build-module/components/list-view/editor.js +0 -25
  791. package/build-module/components/list-view/editor.js.map +0 -1
  792. package/build-module/components/text-decoration-and-transform/index.js +0 -30
  793. package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
  794. package/build-module/store/controls.js +0 -32
  795. package/build-module/store/controls.js.map +0 -1
  796. package/src/components/duotone-control/duotone-picker-popover.js +0 -36
  797. package/src/components/list-view/block-slot.js +0 -120
  798. package/src/components/list-view/editor.js +0 -29
  799. package/src/components/text-decoration-and-transform/index.js +0 -36
  800. package/src/components/text-decoration-and-transform/style.scss +0 -3
  801. package/src/store/controls.js +0 -39
@@ -0,0 +1,35 @@
1
+ const REUSABLE_BLOCKS_CATEGORY = 'reusable';
2
+ const ALLOWED_EMBED_VARIATIONS = [
3
+ 'core/embed',
4
+ 'core/embed/youtube',
5
+ 'core/embed/twitter',
6
+ 'core/embed/wordpress',
7
+ 'core/embed/instagram',
8
+ 'core/embed/vimeo',
9
+ ];
10
+
11
+ export function blockAllowed( block, { onlyReusable, allowReusable } ) {
12
+ const { id, category } = block;
13
+ const isReusable = category === REUSABLE_BLOCKS_CATEGORY;
14
+
15
+ if ( onlyReusable ) {
16
+ return isReusable;
17
+ }
18
+
19
+ if ( isReusable ) {
20
+ return allowReusable;
21
+ }
22
+ // We don't want to show all possible embed variations
23
+ // as different blocks in the inserter. We'll only show a
24
+ // few popular ones.
25
+ return category !== 'embed' || ALLOWED_EMBED_VARIATIONS.includes( id );
26
+ }
27
+
28
+ export function filterInserterItems(
29
+ items,
30
+ { onlyReusable = false, allowReusable = false } = {}
31
+ ) {
32
+ return items.filter( ( block ) =>
33
+ blockAllowed( block, { onlyReusable, allowReusable } )
34
+ );
35
+ }
@@ -18,7 +18,6 @@
18
18
  background: transparent;
19
19
  word-break: break-word;
20
20
  border-radius: $radius-block-ui;
21
- border: $border-width solid transparent;
22
21
  transition: all 0.05s ease-in-out;
23
22
  @include reduce-motion("transition");
24
23
  position: relative;
@@ -31,10 +30,13 @@
31
30
 
32
31
  &:not(:disabled) {
33
32
  &:hover {
34
- border-color: var(--wp-admin-theme-color);
35
33
  color: var(--wp-admin-theme-color) !important;
36
34
  }
37
35
 
36
+ &:focus {
37
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
38
+ }
39
+
38
40
  &.is-active {
39
41
  color: $white;
40
42
  background: $gray-900;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __experimentalToolsPanelContext as ToolsPanelContext } from '@wordpress/components';
5
+ import { useContext } from '@wordpress/element';
6
+
7
+ export default function BlockSupportSlotContainer( { Slot, ...props } ) {
8
+ const toolsPanelContext = useContext( ToolsPanelContext );
9
+ return <Slot { ...props } fillProps={ toolsPanelContext } />;
10
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __experimentalToolsPanel as ToolsPanel } from '@wordpress/components';
5
+ import { useDispatch, useSelect } from '@wordpress/data';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { store as blockEditorStore } from '../../store';
11
+ import { cleanEmptyObject } from '../../hooks/utils';
12
+
13
+ export default function BlockSupportToolsPanel( { children, group, label } ) {
14
+ const { clientId, attributes } = useSelect( ( select ) => {
15
+ const { getBlockAttributes, getSelectedBlockClientId } = select(
16
+ blockEditorStore
17
+ );
18
+ const selectedBlockClientId = getSelectedBlockClientId();
19
+
20
+ return {
21
+ clientId: selectedBlockClientId,
22
+ attributes: getBlockAttributes( selectedBlockClientId ),
23
+ };
24
+ }, [] );
25
+ const { updateBlockAttributes } = useDispatch( blockEditorStore );
26
+
27
+ const resetAll = ( resetFilters = [] ) => {
28
+ const { style } = attributes;
29
+ let newAttributes = { style };
30
+
31
+ resetFilters.forEach( ( resetFilter ) => {
32
+ newAttributes = {
33
+ ...newAttributes,
34
+ ...resetFilter( newAttributes ),
35
+ };
36
+ } );
37
+
38
+ // Enforce a cleaned style object.
39
+ newAttributes = {
40
+ ...newAttributes,
41
+ style: cleanEmptyObject( newAttributes.style ),
42
+ };
43
+
44
+ updateBlockAttributes( clientId, newAttributes );
45
+ };
46
+
47
+ return (
48
+ <ToolsPanel
49
+ className={ `${ group }-block-support-panel` }
50
+ label={ label }
51
+ resetAll={ resetAll }
52
+ key={ clientId }
53
+ panelId={ clientId }
54
+ hasInnerWrapper={ true }
55
+ shouldRenderPlaceholderItems={ true } // Required to maintain fills ordering.
56
+ >
57
+ { children }
58
+ </ToolsPanel>
59
+ );
60
+ }
@@ -1,7 +1,15 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { isEmpty } from 'lodash';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
4
- import { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';
9
+ import {
10
+ __experimentalStyleProvider as StyleProvider,
11
+ __experimentalToolsPanelContext as ToolsPanelContext,
12
+ } from '@wordpress/components';
5
13
  import warning from '@wordpress/warning';
6
14
 
7
15
  /**
@@ -26,7 +34,20 @@ export default function InspectorControlsFill( {
26
34
 
27
35
  return (
28
36
  <StyleProvider document={ document }>
29
- <Fill>{ children }</Fill>
37
+ <Fill>
38
+ { ( fillProps ) => {
39
+ // Children passed to InspectorControlsFill will not have
40
+ // access to any React Context whose Provider is part of
41
+ // the InspectorControlsSlot tree. So we re-create the
42
+ // Provider in this subtree.
43
+ const value = ! isEmpty( fillProps ) ? fillProps : null;
44
+ return (
45
+ <ToolsPanelContext.Provider value={ value }>
46
+ { children }
47
+ </ToolsPanelContext.Provider>
48
+ );
49
+ } }
50
+ </Fill>
30
51
  </StyleProvider>
31
52
  );
32
53
  }
@@ -5,10 +5,18 @@ import { createSlotFill } from '@wordpress/components';
5
5
 
6
6
  const InspectorControlsDefault = createSlotFill( 'InspectorControls' );
7
7
  const InspectorControlsAdvanced = createSlotFill( 'InspectorAdvancedControls' );
8
+ const InspectorControlsDimensions = createSlotFill(
9
+ 'InspectorControlsDimensions'
10
+ );
11
+ const InspectorControlsTypography = createSlotFill(
12
+ 'InspectorControlsTypography'
13
+ );
8
14
 
9
15
  const groups = {
10
16
  default: InspectorControlsDefault,
11
17
  advanced: InspectorControlsAdvanced,
18
+ dimensions: InspectorControlsDimensions,
19
+ typography: InspectorControlsTypography,
12
20
  };
13
21
 
14
22
  export default groups;
@@ -7,11 +7,14 @@ import warning from '@wordpress/warning';
7
7
  /**
8
8
  * Internal dependencies
9
9
  */
10
+ import BlockSupportToolsPanel from './block-support-tools-panel';
11
+ import BlockSupportSlotContainer from './block-support-slot-container';
10
12
  import groups from './groups';
11
13
 
12
14
  export default function InspectorControlsSlot( {
13
15
  __experimentalGroup: group = 'default',
14
16
  bubblesVirtually = true,
17
+ label,
15
18
  ...props
16
19
  } ) {
17
20
  const Slot = groups[ group ]?.Slot;
@@ -26,5 +29,17 @@ export default function InspectorControlsSlot( {
26
29
  return null;
27
30
  }
28
31
 
32
+ if ( label ) {
33
+ return (
34
+ <BlockSupportToolsPanel group={ group } label={ label }>
35
+ <BlockSupportSlotContainer
36
+ { ...props }
37
+ bubblesVirtually={ bubblesVirtually }
38
+ Slot={ Slot }
39
+ />
40
+ </BlockSupportToolsPanel>
41
+ );
42
+ }
43
+
29
44
  return <Slot { ...props } bubblesVirtually={ bubblesVirtually } />;
30
45
  }
@@ -15,12 +15,18 @@ import useSetting from '../../components/use-setting';
15
15
  /**
16
16
  * Control for letter-spacing.
17
17
  *
18
- * @param {Object} props Component props.
19
- * @param {string} props.value Currently selected letter-spacing.
20
- * @param {Function} props.onChange Handles change in letter-spacing selection.
21
- * @return {WPElement} Letter-spacing control.
18
+ * @param {Object} props Component props.
19
+ * @param {string} props.value Currently selected letter-spacing.
20
+ * @param {Function} props.onChange Handles change in letter-spacing selection.
21
+ * @param {boolean} props.__unstableInputWidth Input width to pass through to inner UnitControl.
22
+ *
23
+ * @return {WPElement} Letter-spacing control.
22
24
  */
23
- export default function LetterSpacingControl( { value, onChange } ) {
25
+ export default function LetterSpacingControl( {
26
+ value,
27
+ onChange,
28
+ __unstableInputWidth = '60px',
29
+ } ) {
24
30
  const units = useCustomUnits( {
25
31
  availableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],
26
32
  defaultValues: { px: '2', em: '.2', rem: '.2' },
@@ -29,7 +35,7 @@ export default function LetterSpacingControl( { value, onChange } ) {
29
35
  <UnitControl
30
36
  label={ __( 'Letter-spacing' ) }
31
37
  value={ value }
32
- __unstableInputWidth="60px"
38
+ __unstableInputWidth={ __unstableInputWidth }
33
39
  units={ units }
34
40
  onChange={ onChange }
35
41
  />
@@ -2,17 +2,7 @@
2
2
 
3
3
  Renders a link control. A link control is a controlled input which maintains a value associated with a link (HTML anchor element) and relevant settings for how that link is expected to behave.
4
4
 
5
- It is designed to provide a standardized UI for the creation of a link throughout the Editor.
6
-
7
- ## History
8
-
9
- Much of the context for this component can be found in [the original Issue](https://github.com/WordPress/gutenberg/issues/17557).
10
-
11
- Previously iterations of a hyperlink UI existed within the Gutenberg interface but these tended to be highly tailored to their individual use cases and were not standardized, each having their own implementation.
12
-
13
- These older UIs tended to make use of two existing components: `URLInput` and `URLPopover`. When a requirement was raised to implement a new UI for hyperlink creation, an assessment of these existing components was undertaken and it was determined that they were too opinionated as to be easily refactored to accommodate the new use cases required by the new UI. Attempting to do so would also have meant unavoidable breaking changes to the interface of `URLInput` which would have (most probably) caused breaking changes to ripple across not only the Core codebase, but also that of 3rd party Plugins.
14
-
15
- As a result, it was agreed that a new component `LinkControl` would be created to realise the new hyperlink creation interface. This new UI would begin life as an experimental component which would consume `URLInput` internally. The API of `URLInput` would be enhanced as required with "experimental" features to facilitate the implementation of the new UI.
5
+ It is designed to provide a standardized UI for the creation of a link throughout the Editor, see History section at bottom for further background.
16
6
 
17
7
  ## Relationship to `<URLInput>`
18
8
 
@@ -29,7 +19,7 @@ The distinction between the two components is perhaps best summarized by the fol
29
19
 
30
20
  When creating links the `LinkControl` component will handle two kinds of input from users:
31
21
 
32
- 1. Entity searches - the user may input free-text based search queries for entities retrieved from remote data sources (in the context of WordPress these are `Pages`). For example, a user might search for a `Page` they have just created by name (eg: About) and the UI will return a matching result if found.
22
+ 1. Entity searches - the user may input free-text based search queries for entities retrieved from remote data sources (in the context of WordPress these are post-type entities). For example, a user might search for a `Page` they have just created by name (eg: About) and the UI will return a matching result if found.
33
23
  2. Direct entry - the user may also enter any arbitrary URL-like text. This includes full URLs (https://), URL fragements (eg: `#myinternallink`), `tel` protocol links (eg: `tel: 0800 1234`) and `mailto` protocol links (eg: `mailto: hello@wordpress.org`).
34
24
 
35
25
  In addition, `<LinkControl>` also allows for on the fly creation of links based on the **current content of the `<input>` element**. When enabled, a default "Create new" search suggestion is appended to all non-URL-like search results.
@@ -38,7 +28,9 @@ When this suggestion is selected it will call the `createSuggestion` prop afford
38
28
 
39
29
  ### Data sources
40
30
 
41
- By default `LinkControl` utilizes the `__experimentalFetchLinkSuggestions` API from `core/block-editor` in order to retrieve search suggestions for matching `Page` post-type entities.
31
+ By default `LinkControl` utilizes the `__experimentalFetchLinkSuggestions` API from `core/block-editor` in order to retrieve search suggestions for matching post-type entities.
32
+
33
+ By default this provides no functionality and so you must implement and provide this in your own Editor instance ([example](https://github.com/WordPress/gutenberg/blob/65c752816f46a9334b84f4801d80dea00ed76fba/packages/editor/src/components/provider/use-block-editor-settings.js#L114-L115)).
42
34
 
43
35
  ## Props
44
36
 
@@ -63,7 +55,7 @@ The resulting default properties of `value` include:
63
55
  - Required: No
64
56
  - Default:
65
57
 
66
- ```
58
+ ```js
67
59
  [
68
60
  {
69
61
  id: 'opensInNewTab',
@@ -74,6 +66,14 @@ The resulting default properties of `value` include:
74
66
 
75
67
  An array of settings objects associated with a link (for example: a setting to determine whether or not the link opens in a new tab). Each object will be used to render a `ToggleControl` for that setting.
76
68
 
69
+ To disable settings, pass in an empty array. for example:
70
+
71
+ ```jsx
72
+ <LinkControl
73
+ settings={ [] }
74
+ />
75
+ ```
76
+
77
77
  ### onChange
78
78
 
79
79
  - Type: `Function`
@@ -105,6 +105,22 @@ Whether to present suggestions when typing the URL.
105
105
 
106
106
  Whether to present initial suggestions immediately.
107
107
 
108
+ ### suggestionsQuery
109
+
110
+ - Type: `Object`
111
+ - Required: No
112
+
113
+ Controls the query parameters used to search for suggestions. For example, to limit a query to just `Page` types use:
114
+
115
+ ```jsx
116
+ <LinkControl
117
+ suggestionQuery={ {
118
+ type: 'post',
119
+ subtype: 'page',
120
+ } }
121
+ />
122
+ ```
123
+
108
124
  ### forceIsEditingLink
109
125
 
110
126
  - Type: `boolean`
@@ -176,6 +192,13 @@ A `suggestion` should have the following shape:
176
192
  )}
177
193
  />
178
194
  ```
195
+ ### renderControlBottom
196
+
197
+ - Type: `Function`
198
+ - Required: No
199
+ - Default: null
200
+
201
+ A render prop that can be used to pass optional controls to be rendered at the bottom of the component.
179
202
 
180
203
  # LinkControlSearchInput
181
204
 
@@ -527,3 +550,13 @@ If true, type of the suggestion is rendered (e.g. post, tag)
527
550
  The suggestion to render.
528
551
 
529
552
  See the [createSuggestion](#createSuggestion) section of this file to learn more about suggestions.
553
+
554
+ ## History
555
+
556
+ Much of the context for this component can be found in [the original Issue](https://github.com/WordPress/gutenberg/issues/17557).
557
+
558
+ Previously iterations of a hyperlink UI existed within the Gutenberg interface but these tended to be highly tailored to their individual use cases and were not standardized, each having their own implementation.
559
+
560
+ These older UIs tended to make use of two existing components: `URLInput` and `URLPopover`. When a requirement was raised to implement a new UI for hyperlink creation, an assessment of these existing components was undertaken and it was determined that they were too opinionated as to be easily refactored to accommodate the new use cases required by the new UI. Attempting to do so would also have meant unavoidable breaking changes to the interface of `URLInput` which would have (most probably) caused breaking changes to ripple across not only the Core codebase, but also that of 3rd party Plugins.
561
+
562
+ As a result, it was agreed that a new component `LinkControl` would be created to realise the new hyperlink creation interface. This new UI would begin life as an experimental component which would consume `URLInput` internally. The API of `URLInput` would be enhanced as required with "experimental" features to facilitate the implementation of the new UI.
@@ -2,11 +2,12 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { noop } from 'lodash';
5
+ import classnames from 'classnames';
5
6
 
6
7
  /**
7
8
  * WordPress dependencies
8
9
  */
9
- import { Button, Spinner, Notice } from '@wordpress/components';
10
+ import { Button, Spinner, Notice, TextControl } from '@wordpress/components';
10
11
  import { keyboardReturn } from '@wordpress/icons';
11
12
  import { __ } from '@wordpress/i18n';
12
13
  import { useRef, useState, useEffect } from '@wordpress/element';
@@ -93,6 +94,7 @@ import { DEFAULT_LINK_SETTINGS } from './constants';
93
94
  * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.
94
95
  * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.
95
96
  * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.
97
+ * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.
96
98
  */
97
99
 
98
100
  /**
@@ -119,6 +121,8 @@ function LinkControl( {
119
121
  noURLSuggestion = false,
120
122
  createSuggestionButtonText,
121
123
  hasRichPreviews = false,
124
+ hasTextControl = false,
125
+ renderControlBottom = null,
122
126
  } ) {
123
127
  if ( withCreateSuggestion === undefined && createSuggestion ) {
124
128
  withCreateSuggestion = true;
@@ -126,8 +130,13 @@ function LinkControl( {
126
130
 
127
131
  const isMounting = useRef( true );
128
132
  const wrapperNode = useRef();
133
+ const textInputRef = useRef();
134
+
129
135
  const [ internalInputValue, setInternalInputValue ] = useState(
130
- ( value && value.url ) || ''
136
+ value?.url || ''
137
+ );
138
+ const [ internalTextValue, setInternalTextValue ] = useState(
139
+ value?.title || ''
131
140
  );
132
141
  const currentInputValue = propInputValue || internalInputValue;
133
142
  const [ isEditingLink, setIsEditingLink ] = useState(
@@ -137,6 +146,8 @@ function LinkControl( {
137
146
  );
138
147
  const isEndingEditWithFocus = useRef( false );
139
148
 
149
+ const currentInputIsEmpty = ! currentInputValue?.trim()?.length;
150
+
140
151
  useEffect( () => {
141
152
  if (
142
153
  forceIsEditingLink !== undefined &&
@@ -147,22 +158,53 @@ function LinkControl( {
147
158
  }, [ forceIsEditingLink ] );
148
159
 
149
160
  useEffect( () => {
161
+ // We don't auto focus into the Link UI on mount
162
+ // because otherwise using the keyboard to select text
163
+ // *within* the link format is not possible.
150
164
  if ( isMounting.current ) {
151
165
  isMounting.current = false;
152
166
  return;
153
167
  }
168
+ // Unless we are mounting, we always want to focus either:
169
+ // - the URL input
170
+ // - the first focusable element in the Link UI.
171
+ // But in editing mode if there is a text input present then
172
+ // the URL input is at index 1. If not then it is at index 0.
173
+ const whichFocusTargetIndex = textInputRef?.current ? 1 : 0;
154
174
 
155
- // When switching between editable and non editable LinkControl
156
- // move focus to the first element to avoid focus loss.
175
+ // Scenario - when:
176
+ // - switching between editable and non editable LinkControl
177
+ // - clicking on a link
178
+ // ...then move focus to the *first* element to avoid focus loss
179
+ // and to ensure focus is *within* the Link UI.
157
180
  const nextFocusTarget =
158
- focus.focusable.find( wrapperNode.current )[ 0 ] ||
159
- wrapperNode.current;
181
+ focus.focusable.find( wrapperNode.current )[
182
+ whichFocusTargetIndex
183
+ ] || wrapperNode.current;
160
184
 
161
185
  nextFocusTarget.focus();
162
186
 
163
187
  isEndingEditWithFocus.current = false;
164
188
  }, [ isEditingLink ] );
165
189
 
190
+ useEffect( () => {
191
+ /**
192
+ * If the value's `text` property changes then sync this
193
+ * back up with state.
194
+ */
195
+ if ( value?.title && value.title !== internalTextValue ) {
196
+ setInternalTextValue( value.title );
197
+ }
198
+
199
+ /**
200
+ * Update the state value internalInputValue if the url value changes
201
+ * for example when clicking on another anchor
202
+ */
203
+ if ( value?.url ) {
204
+ setInternalInputValue( value.url );
205
+ }
206
+ }, [ value ] );
207
+
166
208
  /**
167
209
  * Cancels editing state and marks that focus may need to be restored after
168
210
  * the next render, if focus was within the wrapper when editing finished.
@@ -180,22 +222,47 @@ function LinkControl( {
180
222
  );
181
223
 
182
224
  const handleSelectSuggestion = ( updatedValue ) => {
183
- onChange( updatedValue );
225
+ onChange( {
226
+ ...updatedValue,
227
+ title: internalTextValue || updatedValue?.title,
228
+ } );
184
229
  stopEditing();
185
230
  };
186
231
 
187
- const handleSubmitButton = () => {
188
- if ( currentInputValue !== value?.url ) {
189
- onChange( { url: currentInputValue } );
232
+ const handleSubmit = () => {
233
+ if (
234
+ currentInputValue !== value?.url ||
235
+ internalTextValue !== value?.title
236
+ ) {
237
+ onChange( {
238
+ url: currentInputValue,
239
+ title: internalTextValue,
240
+ } );
190
241
  }
191
242
  stopEditing();
192
243
  };
193
244
 
245
+ const handleSubmitWithEnter = ( event ) => {
246
+ const { keyCode } = event;
247
+ if (
248
+ keyCode === ENTER &&
249
+ ! currentInputIsEmpty // disallow submitting empty values.
250
+ ) {
251
+ event.preventDefault();
252
+ handleSubmit();
253
+ }
254
+ };
255
+
194
256
  const shownUnlinkControl =
195
257
  onRemove && value && ! isEditingLink && ! isCreatingPage;
196
258
 
197
259
  const showSettingsDrawer = !! settings?.length;
198
260
 
261
+ // Only show text control once a URL value has been committed
262
+ // and it isn't just empty whitespace.
263
+ // See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.
264
+ const showTextControl = value?.url?.trim()?.length > 0 && hasTextControl;
265
+
199
266
  return (
200
267
  <div
201
268
  tabIndex={ -1 }
@@ -210,10 +277,26 @@ function LinkControl( {
210
277
 
211
278
  { ( isEditingLink || ! value ) && ! isCreatingPage && (
212
279
  <>
213
- <div className="block-editor-link-control__search-input-wrapper">
280
+ <div
281
+ className={ classnames( {
282
+ 'block-editor-link-control__search-input-wrapper': true,
283
+ 'has-text-control': showTextControl,
284
+ } ) }
285
+ >
286
+ { showTextControl && (
287
+ <TextControl
288
+ ref={ textInputRef }
289
+ className="block-editor-link-control__field block-editor-link-control__text-content"
290
+ label="Text"
291
+ value={ internalTextValue }
292
+ onChange={ setInternalTextValue }
293
+ onKeyDown={ handleSubmitWithEnter }
294
+ />
295
+ ) }
296
+
214
297
  <LinkControlSearchInput
215
298
  currentLink={ value }
216
- className="block-editor-link-control__search-input"
299
+ className="block-editor-link-control__field block-editor-link-control__search-input"
217
300
  placeholder={ searchInputPlaceholder }
218
301
  value={ currentInputValue }
219
302
  withCreateSuggestion={ withCreateSuggestion }
@@ -228,20 +311,15 @@ function LinkControl( {
228
311
  createSuggestionButtonText={
229
312
  createSuggestionButtonText
230
313
  }
314
+ useLabel={ showTextControl }
231
315
  >
232
316
  <div className="block-editor-link-control__search-actions">
233
317
  <Button
234
- onClick={ () => handleSubmitButton() }
235
- onKeyDown={ ( event ) => {
236
- const { keyCode } = event;
237
- if ( keyCode === ENTER ) {
238
- event.preventDefault();
239
- handleSubmitButton();
240
- }
241
- } }
318
+ onClick={ handleSubmit }
242
319
  label={ __( 'Submit' ) }
243
320
  icon={ keyboardReturn }
244
321
  className="block-editor-link-control__search-submit"
322
+ disabled={ currentInputIsEmpty } // disallow submitting empty values.
245
323
  />
246
324
  </div>
247
325
  </LinkControlSearchInput>
@@ -264,28 +342,21 @@ function LinkControl( {
264
342
  value={ value }
265
343
  onEditClick={ () => setIsEditingLink( true ) }
266
344
  hasRichPreviews={ hasRichPreviews }
345
+ hasUnlinkControl={ shownUnlinkControl }
346
+ onRemove={ onRemove }
267
347
  />
268
348
  ) }
269
349
 
270
- { ( showSettingsDrawer || shownUnlinkControl ) && (
350
+ { showSettingsDrawer && (
271
351
  <div className="block-editor-link-control__tools">
272
352
  <LinkControlSettingsDrawer
273
353
  value={ value }
274
354
  settings={ settings }
275
355
  onChange={ onChange }
276
356
  />
277
- { shownUnlinkControl && (
278
- <Button
279
- className="block-editor-link-control__unlink"
280
- isDestructive
281
- variant="link"
282
- onClick={ onRemove }
283
- >
284
- { __( 'Unlink' ) }
285
- </Button>
286
- ) }
287
357
  </div>
288
358
  ) }
359
+ { renderControlBottom && renderControlBottom() }
289
360
  </div>
290
361
  );
291
362
  }