@wordpress/block-editor 12.18.0 → 12.18.2

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 (101) hide show
  1. package/build/components/dimensions-tool/aspect-ratio-tool.js +2 -1
  2. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  3. package/build/components/global-styles/dimensions-panel.js +30 -5
  4. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  5. package/build/components/global-styles/hooks.js +10 -9
  6. package/build/components/global-styles/hooks.js.map +1 -1
  7. package/build/components/global-styles/typography-panel.js +14 -31
  8. package/build/components/global-styles/typography-panel.js.map +1 -1
  9. package/build/components/global-styles/use-global-styles-output.js +6 -0
  10. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  11. package/build/components/rich-text/index.js +1 -1
  12. package/build/components/rich-text/index.js.map +1 -1
  13. package/build/components/url-popover/image-url-input-ui.js +55 -34
  14. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  15. package/build/components/url-popover/index.js +3 -1
  16. package/build/components/url-popover/index.js.map +1 -1
  17. package/build/components/url-popover/link-editor.js +2 -1
  18. package/build/components/url-popover/link-editor.js.map +1 -1
  19. package/build/components/url-popover/link-viewer.js +2 -1
  20. package/build/components/url-popover/link-viewer.js.map +1 -1
  21. package/build/hooks/dimensions.js +71 -1
  22. package/build/hooks/dimensions.js.map +1 -1
  23. package/build/hooks/index.js +2 -8
  24. package/build/hooks/index.js.map +1 -1
  25. package/build/hooks/index.native.js +0 -6
  26. package/build/hooks/index.native.js.map +1 -1
  27. package/build/hooks/style.js +3 -0
  28. package/build/hooks/style.js.map +1 -1
  29. package/build/hooks/use-bindings-attributes.js +2 -2
  30. package/build/hooks/use-bindings-attributes.js.map +1 -1
  31. package/build/hooks/use-shadow-props.js +0 -15
  32. package/build/hooks/use-shadow-props.js.map +1 -1
  33. package/build/hooks/utils.js +4 -6
  34. package/build/hooks/utils.js.map +1 -1
  35. package/build/index.js +0 -7
  36. package/build/index.js.map +1 -1
  37. package/build/utils/object.js +0 -17
  38. package/build/utils/object.js.map +1 -1
  39. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +2 -1
  40. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  41. package/build-module/components/global-styles/dimensions-panel.js +30 -5
  42. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  43. package/build-module/components/global-styles/hooks.js +10 -9
  44. package/build-module/components/global-styles/hooks.js.map +1 -1
  45. package/build-module/components/global-styles/typography-panel.js +15 -32
  46. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  47. package/build-module/components/global-styles/use-global-styles-output.js +6 -0
  48. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  49. package/build-module/components/rich-text/index.js +1 -1
  50. package/build-module/components/rich-text/index.js.map +1 -1
  51. package/build-module/components/url-popover/image-url-input-ui.js +57 -36
  52. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  53. package/build-module/components/url-popover/index.js +3 -1
  54. package/build-module/components/url-popover/index.js.map +1 -1
  55. package/build-module/components/url-popover/link-editor.js +2 -1
  56. package/build-module/components/url-popover/link-editor.js.map +1 -1
  57. package/build-module/components/url-popover/link-viewer.js +2 -1
  58. package/build-module/components/url-popover/link-viewer.js.map +1 -1
  59. package/build-module/hooks/dimensions.js +70 -2
  60. package/build-module/hooks/dimensions.js.map +1 -1
  61. package/build-module/hooks/index.js +3 -2
  62. package/build-module/hooks/index.js.map +1 -1
  63. package/build-module/hooks/index.native.js +1 -1
  64. package/build-module/hooks/index.native.js.map +1 -1
  65. package/build-module/hooks/style.js +3 -0
  66. package/build-module/hooks/style.js.map +1 -1
  67. package/build-module/hooks/use-bindings-attributes.js +2 -2
  68. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  69. package/build-module/hooks/use-shadow-props.js +0 -14
  70. package/build-module/hooks/use-shadow-props.js.map +1 -1
  71. package/build-module/hooks/utils.js +4 -6
  72. package/build-module/hooks/utils.js.map +1 -1
  73. package/build-module/index.js +1 -1
  74. package/build-module/index.js.map +1 -1
  75. package/build-module/utils/object.js +0 -16
  76. package/build-module/utils/object.js.map +1 -1
  77. package/build-style/style-rtl.css +48 -31
  78. package/build-style/style.css +48 -31
  79. package/package.json +4 -4
  80. package/src/components/block-canvas/style.scss +2 -2
  81. package/src/components/dimensions-tool/aspect-ratio-tool.js +4 -1
  82. package/src/components/global-styles/dimensions-panel.js +50 -1
  83. package/src/components/global-styles/hooks.js +9 -8
  84. package/src/components/global-styles/typography-panel.js +13 -45
  85. package/src/components/global-styles/use-global-styles-output.js +6 -0
  86. package/src/components/media-replace-flow/style.scss +1 -1
  87. package/src/components/rich-text/index.js +1 -2
  88. package/src/components/url-popover/image-url-input-ui.js +86 -37
  89. package/src/components/url-popover/index.js +2 -0
  90. package/src/components/url-popover/link-editor.js +1 -0
  91. package/src/components/url-popover/link-viewer.js +1 -0
  92. package/src/components/url-popover/style.scss +51 -31
  93. package/src/hooks/dimensions.js +74 -3
  94. package/src/hooks/index.js +3 -1
  95. package/src/hooks/index.native.js +1 -1
  96. package/src/hooks/style.js +4 -0
  97. package/src/hooks/use-bindings-attributes.js +2 -5
  98. package/src/hooks/use-shadow-props.js +0 -14
  99. package/src/hooks/utils.js +8 -16
  100. package/src/index.js +0 -1
  101. package/src/utils/object.js +0 -16
@@ -128,11 +128,11 @@ iframe[name=editor-canvas] {
128
128
  display: block;
129
129
  }
130
130
 
131
- iframe[name=editor-canvas]:not(.has-history) {
131
+ iframe[name=editor-canvas]:not(.has-editor-padding) {
132
132
  background-color: #fff;
133
133
  }
134
134
 
135
- iframe[name=editor-canvas].has-history {
135
+ iframe[name=editor-canvas].has-editor-padding {
136
136
  padding: 48px 48px 0;
137
137
  }
138
138
 
@@ -2692,7 +2692,7 @@ iframe[name=editor-canvas].has-history {
2692
2692
  margin-bottom: 8px;
2693
2693
  }
2694
2694
  .block-editor-media-flow__url-input .block-editor-link-control {
2695
- width: 300px;
2695
+ width: 200px;
2696
2696
  }
2697
2697
  .block-editor-media-flow__url-input .block-editor-link-control .block-editor-url-input {
2698
2698
  padding: 0;
@@ -3094,47 +3094,37 @@ iframe[name=editor-canvas].has-history {
3094
3094
  }
3095
3095
 
3096
3096
  .block-editor-url-popover__additional-controls {
3097
- border-top: 1px solid #ddd;
3098
- }
3099
-
3100
- .block-editor-url-popover__additional-controls > div[role=menu] .components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary) > svg {
3101
- box-shadow: none;
3097
+ border-top: 1px solid #1e1e1e;
3098
+ padding: 8px 8px;
3102
3099
  }
3103
3100
 
3104
- .block-editor-url-popover__additional-controls div[role=menu] > .components-button {
3105
- padding-right: 12px;
3101
+ .block-editor-url-popover__input-container {
3102
+ padding: 8px;
3103
+ padding-right: 16px;
3106
3104
  }
3107
3105
 
3108
3106
  .block-editor-url-popover__row {
3109
3107
  display: flex;
3108
+ gap: 4px;
3110
3109
  }
3111
3110
 
3112
3111
  .block-editor-url-popover__row > :not(.block-editor-url-popover__settings-toggle) {
3113
3112
  flex-grow: 1;
3113
+ gap: 4px;
3114
3114
  }
3115
3115
 
3116
- .block-editor-url-popover .components-button.has-icon {
3117
- padding: 3px;
3118
- }
3119
- .block-editor-url-popover .components-button.has-icon > svg {
3120
- padding: 5px;
3121
- border-radius: 2px;
3122
- height: 30px;
3123
- width: 30px;
3124
- }
3125
- .block-editor-url-popover .components-button.has-icon:not(:disabled):focus {
3126
- box-shadow: none;
3116
+ .block-editor-url-popover__additional-controls .components-button.has-icon {
3117
+ padding-right: 8px;
3118
+ padding-left: 8px;
3119
+ height: auto;
3120
+ text-align: right;
3127
3121
  }
3128
- .block-editor-url-popover .components-button.has-icon:not(:disabled):focus > svg {
3129
- box-shadow: inset 0 0 0 1px var(--wp-components-color-background, #fff), 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
3130
- outline: 2px solid transparent;
3122
+ .block-editor-url-popover__additional-controls .components-button.has-icon > svg {
3123
+ margin-left: 8px;
3131
3124
  }
3132
3125
 
3133
3126
  .block-editor-url-popover__settings-toggle {
3134
3127
  flex-shrink: 0;
3135
- border-radius: 0;
3136
- border-right: 1px solid #ddd;
3137
- margin-right: 1px;
3138
3128
  }
3139
3129
  .block-editor-url-popover__settings-toggle[aria-expanded=true] .dashicon {
3140
3130
  transform: rotate(-180deg);
@@ -3143,7 +3133,7 @@ iframe[name=editor-canvas].has-history {
3143
3133
  .block-editor-url-popover__settings {
3144
3134
  display: block;
3145
3135
  padding: 16px;
3146
- border-top: 1px solid #ddd;
3136
+ border-top: 1px solid #1e1e1e;
3147
3137
  }
3148
3138
 
3149
3139
  .block-editor-url-popover__link-editor,
@@ -3152,19 +3142,46 @@ iframe[name=editor-canvas].has-history {
3152
3142
  }
3153
3143
 
3154
3144
  .block-editor-url-popover__link-viewer-url {
3155
- margin: 7px;
3145
+ display: flex;
3146
+ align-items: center;
3156
3147
  flex-grow: 1;
3157
3148
  flex-shrink: 1;
3158
3149
  overflow: hidden;
3159
3150
  text-overflow: ellipsis;
3160
3151
  white-space: nowrap;
3161
- min-width: 150px;
3162
- max-width: 500px;
3152
+ margin-left: 8px;
3163
3153
  }
3164
3154
  .block-editor-url-popover__link-viewer-url.has-invalid-link {
3165
3155
  color: #cc1818;
3166
3156
  }
3167
3157
 
3158
+ .block-editor-url-popover__expand-on-click {
3159
+ display: flex;
3160
+ align-items: center;
3161
+ min-width: 350px;
3162
+ overflow: hidden;
3163
+ white-space: nowrap;
3164
+ }
3165
+ .block-editor-url-popover__expand-on-click .fullscreen-icon {
3166
+ padding-left: 4px;
3167
+ }
3168
+ .block-editor-url-popover__expand-on-click .fullscreen-icon > svg {
3169
+ width: 24px;
3170
+ height: 24px;
3171
+ }
3172
+ .block-editor-url-popover__expand-on-click .text {
3173
+ flex-grow: 1;
3174
+ }
3175
+ .block-editor-url-popover__expand-on-click .text p {
3176
+ margin: 0;
3177
+ }
3178
+ .block-editor-url-popover__expand-on-click .description {
3179
+ color: #949494;
3180
+ }
3181
+ .block-editor-url-popover__expand-on-click .remove-link {
3182
+ margin-left: 8px;
3183
+ }
3184
+
3168
3185
  .html-anchor-control .components-external-link {
3169
3186
  display: block;
3170
3187
  margin-top: 8px;
@@ -128,11 +128,11 @@ iframe[name=editor-canvas] {
128
128
  display: block;
129
129
  }
130
130
 
131
- iframe[name=editor-canvas]:not(.has-history) {
131
+ iframe[name=editor-canvas]:not(.has-editor-padding) {
132
132
  background-color: #fff;
133
133
  }
134
134
 
135
- iframe[name=editor-canvas].has-history {
135
+ iframe[name=editor-canvas].has-editor-padding {
136
136
  padding: 48px 48px 0;
137
137
  }
138
138
 
@@ -2693,7 +2693,7 @@ iframe[name=editor-canvas].has-history {
2693
2693
  margin-bottom: 8px;
2694
2694
  }
2695
2695
  .block-editor-media-flow__url-input .block-editor-link-control {
2696
- width: 300px;
2696
+ width: 200px;
2697
2697
  }
2698
2698
  .block-editor-media-flow__url-input .block-editor-link-control .block-editor-url-input {
2699
2699
  padding: 0;
@@ -3095,47 +3095,37 @@ iframe[name=editor-canvas].has-history {
3095
3095
  }
3096
3096
 
3097
3097
  .block-editor-url-popover__additional-controls {
3098
- border-top: 1px solid #ddd;
3099
- }
3100
-
3101
- .block-editor-url-popover__additional-controls > div[role=menu] .components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary) > svg {
3102
- box-shadow: none;
3098
+ border-top: 1px solid #1e1e1e;
3099
+ padding: 8px 8px;
3103
3100
  }
3104
3101
 
3105
- .block-editor-url-popover__additional-controls div[role=menu] > .components-button {
3106
- padding-left: 12px;
3102
+ .block-editor-url-popover__input-container {
3103
+ padding: 8px;
3104
+ padding-left: 16px;
3107
3105
  }
3108
3106
 
3109
3107
  .block-editor-url-popover__row {
3110
3108
  display: flex;
3109
+ gap: 4px;
3111
3110
  }
3112
3111
 
3113
3112
  .block-editor-url-popover__row > :not(.block-editor-url-popover__settings-toggle) {
3114
3113
  flex-grow: 1;
3114
+ gap: 4px;
3115
3115
  }
3116
3116
 
3117
- .block-editor-url-popover .components-button.has-icon {
3118
- padding: 3px;
3119
- }
3120
- .block-editor-url-popover .components-button.has-icon > svg {
3121
- padding: 5px;
3122
- border-radius: 2px;
3123
- height: 30px;
3124
- width: 30px;
3125
- }
3126
- .block-editor-url-popover .components-button.has-icon:not(:disabled):focus {
3127
- box-shadow: none;
3117
+ .block-editor-url-popover__additional-controls .components-button.has-icon {
3118
+ padding-left: 8px;
3119
+ padding-right: 8px;
3120
+ height: auto;
3121
+ text-align: left;
3128
3122
  }
3129
- .block-editor-url-popover .components-button.has-icon:not(:disabled):focus > svg {
3130
- box-shadow: inset 0 0 0 1px var(--wp-components-color-background, #fff), 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
3131
- outline: 2px solid transparent;
3123
+ .block-editor-url-popover__additional-controls .components-button.has-icon > svg {
3124
+ margin-right: 8px;
3132
3125
  }
3133
3126
 
3134
3127
  .block-editor-url-popover__settings-toggle {
3135
3128
  flex-shrink: 0;
3136
- border-radius: 0;
3137
- border-left: 1px solid #ddd;
3138
- margin-left: 1px;
3139
3129
  }
3140
3130
  .block-editor-url-popover__settings-toggle[aria-expanded=true] .dashicon {
3141
3131
  transform: rotate(180deg);
@@ -3144,7 +3134,7 @@ iframe[name=editor-canvas].has-history {
3144
3134
  .block-editor-url-popover__settings {
3145
3135
  display: block;
3146
3136
  padding: 16px;
3147
- border-top: 1px solid #ddd;
3137
+ border-top: 1px solid #1e1e1e;
3148
3138
  }
3149
3139
 
3150
3140
  .block-editor-url-popover__link-editor,
@@ -3153,19 +3143,46 @@ iframe[name=editor-canvas].has-history {
3153
3143
  }
3154
3144
 
3155
3145
  .block-editor-url-popover__link-viewer-url {
3156
- margin: 7px;
3146
+ display: flex;
3147
+ align-items: center;
3157
3148
  flex-grow: 1;
3158
3149
  flex-shrink: 1;
3159
3150
  overflow: hidden;
3160
3151
  text-overflow: ellipsis;
3161
3152
  white-space: nowrap;
3162
- min-width: 150px;
3163
- max-width: 500px;
3153
+ margin-right: 8px;
3164
3154
  }
3165
3155
  .block-editor-url-popover__link-viewer-url.has-invalid-link {
3166
3156
  color: #cc1818;
3167
3157
  }
3168
3158
 
3159
+ .block-editor-url-popover__expand-on-click {
3160
+ display: flex;
3161
+ align-items: center;
3162
+ min-width: 350px;
3163
+ overflow: hidden;
3164
+ white-space: nowrap;
3165
+ }
3166
+ .block-editor-url-popover__expand-on-click .fullscreen-icon {
3167
+ padding-right: 4px;
3168
+ }
3169
+ .block-editor-url-popover__expand-on-click .fullscreen-icon > svg {
3170
+ width: 24px;
3171
+ height: 24px;
3172
+ }
3173
+ .block-editor-url-popover__expand-on-click .text {
3174
+ flex-grow: 1;
3175
+ }
3176
+ .block-editor-url-popover__expand-on-click .text p {
3177
+ margin: 0;
3178
+ }
3179
+ .block-editor-url-popover__expand-on-click .description {
3180
+ color: #949494;
3181
+ }
3182
+ .block-editor-url-popover__expand-on-click .remove-link {
3183
+ margin-right: 8px;
3184
+ }
3185
+
3169
3186
  .html-anchor-control .components-external-link {
3170
3187
  display: block;
3171
3188
  margin-top: 8px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "12.18.0",
3
+ "version": "12.18.2",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -38,7 +38,7 @@
38
38
  "@wordpress/a11y": "^3.50.0",
39
39
  "@wordpress/api-fetch": "^6.47.0",
40
40
  "@wordpress/blob": "^3.50.0",
41
- "@wordpress/blocks": "^12.27.0",
41
+ "@wordpress/blocks": "^12.27.1",
42
42
  "@wordpress/commands": "^0.21.0",
43
43
  "@wordpress/components": "^25.16.0",
44
44
  "@wordpress/compose": "^6.27.0",
@@ -59,7 +59,7 @@
59
59
  "@wordpress/preferences": "^3.27.0",
60
60
  "@wordpress/private-apis": "^0.32.0",
61
61
  "@wordpress/rich-text": "^6.27.0",
62
- "@wordpress/style-engine": "^1.33.0",
62
+ "@wordpress/style-engine": "^1.33.1",
63
63
  "@wordpress/token-list": "^2.50.0",
64
64
  "@wordpress/url": "^3.51.0",
65
65
  "@wordpress/warning": "^2.50.0",
@@ -87,5 +87,5 @@
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  },
90
- "gitHead": "45de2cb4212fed7f2763e95f10300d1ff9d0ec08"
90
+ "gitHead": "fefb6f718fbfd5df9390f366d5733369f613084a"
91
91
  }
@@ -4,10 +4,10 @@ iframe[name="editor-canvas"] {
4
4
  display: block;
5
5
  }
6
6
 
7
- iframe[name="editor-canvas"]:not(.has-history) {
7
+ iframe[name="editor-canvas"]:not(.has-editor-padding) {
8
8
  background-color: $white;
9
9
  }
10
10
 
11
- iframe[name="editor-canvas"].has-history {
11
+ iframe[name="editor-canvas"].has-editor-padding {
12
12
  padding: $grid-unit-60 $grid-unit-60 0;
13
13
  }
@@ -98,6 +98,7 @@ export default function AspectRatioTool( {
98
98
  onChange = () => {},
99
99
  options = DEFAULT_ASPECT_RATIO_OPTIONS,
100
100
  defaultValue = DEFAULT_ASPECT_RATIO_OPTIONS[ 0 ].value,
101
+ hasValue,
101
102
  isShownByDefault = true,
102
103
  } ) {
103
104
  // Match the CSS default so if the value is used directly in CSS it will look correct in the control.
@@ -105,7 +106,9 @@ export default function AspectRatioTool( {
105
106
 
106
107
  return (
107
108
  <ToolsPanelItem
108
- hasValue={ () => displayValue !== defaultValue }
109
+ hasValue={
110
+ hasValue ? hasValue : () => displayValue !== defaultValue
111
+ }
109
112
  label={ __( 'Aspect ratio' ) }
110
113
  onDeselect={ () => onChange( undefined ) }
111
114
  isShownByDefault={ isShownByDefault }
@@ -27,6 +27,7 @@ import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
27
27
  import SpacingSizesControl from '../spacing-sizes-control';
28
28
  import HeightControl from '../height-control';
29
29
  import ChildLayoutControl from '../child-layout-control';
30
+ import AspectRatioTool from '../dimensions-tool/aspect-ratio-tool';
30
31
  import { cleanEmptyObject } from '../../hooks/utils';
31
32
  import { setImmutably } from '../../utils/object';
32
33
 
@@ -39,6 +40,7 @@ export function useHasDimensionsPanel( settings ) {
39
40
  const hasMargin = useHasMargin( settings );
40
41
  const hasGap = useHasGap( settings );
41
42
  const hasMinHeight = useHasMinHeight( settings );
43
+ const hasAspectRatio = useHasAspectRatio( settings );
42
44
  const hasChildLayout = useHasChildLayout( settings );
43
45
 
44
46
  return (
@@ -49,6 +51,7 @@ export function useHasDimensionsPanel( settings ) {
49
51
  hasMargin ||
50
52
  hasGap ||
51
53
  hasMinHeight ||
54
+ hasAspectRatio ||
52
55
  hasChildLayout )
53
56
  );
54
57
  }
@@ -77,6 +80,10 @@ function useHasMinHeight( settings ) {
77
80
  return settings?.dimensions?.minHeight;
78
81
  }
79
82
 
83
+ function useHasAspectRatio( settings ) {
84
+ return settings?.dimensions?.aspectRatio;
85
+ }
86
+
80
87
  function useHasChildLayout( settings ) {
81
88
  const {
82
89
  type: parentLayoutType = 'default',
@@ -192,6 +199,7 @@ const DEFAULT_CONTROLS = {
192
199
  margin: true,
193
200
  blockGap: true,
194
201
  minHeight: true,
202
+ aspectRatio: true,
195
203
  childLayout: true,
196
204
  };
197
205
 
@@ -346,8 +354,18 @@ export default function DimensionsPanel( {
346
354
  const showMinHeightControl = useHasMinHeight( settings );
347
355
  const minHeightValue = decodeValue( inheritedValue?.dimensions?.minHeight );
348
356
  const setMinHeightValue = ( newValue ) => {
357
+ const tempValue = setImmutably(
358
+ value,
359
+ [ 'dimensions', 'minHeight' ],
360
+ newValue
361
+ );
362
+ // Apply min-height, while removing any applied aspect ratio.
349
363
  onChange(
350
- setImmutably( value, [ 'dimensions', 'minHeight' ], newValue )
364
+ setImmutably(
365
+ tempValue,
366
+ [ 'dimensions', 'aspectRatio' ],
367
+ undefined
368
+ )
351
369
  );
352
370
  };
353
371
  const resetMinHeightValue = () => {
@@ -355,6 +373,24 @@ export default function DimensionsPanel( {
355
373
  };
356
374
  const hasMinHeightValue = () => !! value?.dimensions?.minHeight;
357
375
 
376
+ // Aspect Ratio
377
+ const showAspectRatioControl = useHasAspectRatio( settings );
378
+ const aspectRatioValue = decodeValue(
379
+ inheritedValue?.dimensions?.aspectRatio
380
+ );
381
+ const setAspectRatioValue = ( newValue ) => {
382
+ const tempValue = setImmutably(
383
+ value,
384
+ [ 'dimensions', 'aspectRatio' ],
385
+ newValue
386
+ );
387
+ // Apply aspect-ratio, while removing any applied min-height.
388
+ onChange(
389
+ setImmutably( tempValue, [ 'dimensions', 'minHeight' ], undefined )
390
+ );
391
+ };
392
+ const hasAspectRatioValue = () => !! value?.dimensions?.aspectRatio;
393
+
358
394
  // Child Layout
359
395
  const showChildLayoutControl = useHasChildLayout( settings );
360
396
  const childLayout = inheritedValue?.layout;
@@ -397,6 +433,7 @@ export default function DimensionsPanel( {
397
433
  dimensions: {
398
434
  ...previousValue?.dimensions,
399
435
  minHeight: undefined,
436
+ aspectRatio: undefined,
400
437
  },
401
438
  };
402
439
  }, [] );
@@ -617,6 +654,18 @@ export default function DimensionsPanel( {
617
654
  />
618
655
  </ToolsPanelItem>
619
656
  ) }
657
+ { showAspectRatioControl && (
658
+ <AspectRatioTool
659
+ hasValue={ hasAspectRatioValue }
660
+ value={ aspectRatioValue }
661
+ onChange={ setAspectRatioValue }
662
+ panelId={ panelId }
663
+ isShownByDefault={
664
+ defaultControls.aspectRatio ??
665
+ DEFAULT_CONTROLS.aspectRatio
666
+ }
667
+ />
668
+ ) }
620
669
  { showChildLayoutControl && (
621
670
  <VStack
622
671
  as={ ToolsPanelItem }
@@ -49,6 +49,7 @@ const VALID_SETTINGS = [
49
49
  'color.palette',
50
50
  'color.text',
51
51
  'custom',
52
+ 'dimensions.aspectRatio',
52
53
  'dimensions.minHeight',
53
54
  'layout.contentSize',
54
55
  'layout.definitions',
@@ -66,7 +67,6 @@ const VALID_SETTINGS = [
66
67
  'spacing.units',
67
68
  'typography.fluid',
68
69
  'typography.customFontSize',
69
- 'typography.defaultFontSizes',
70
70
  'typography.dropCap',
71
71
  'typography.fontFamilies',
72
72
  'typography.fontSizes',
@@ -239,7 +239,6 @@ export function useSettingsForBlockElement(
239
239
  ...updatedSettings.typography,
240
240
  fontSizes: {},
241
241
  customFontSize: false,
242
- defaultFontSizes: false,
243
242
  };
244
243
  }
245
244
 
@@ -344,12 +343,14 @@ export function useSettingsForBlockElement(
344
343
  }
345
344
  } );
346
345
 
347
- if ( ! supportedStyles.includes( 'minHeight' ) ) {
348
- updatedSettings.dimensions = {
349
- ...updatedSettings.dimensions,
350
- minHeight: false,
351
- };
352
- }
346
+ [ 'aspectRatio', 'minHeight' ].forEach( ( key ) => {
347
+ if ( ! supportedStyles.includes( key ) ) {
348
+ updatedSettings.dimensions = {
349
+ ...updatedSettings.dimensions,
350
+ [ key ]: false,
351
+ };
352
+ }
353
+ } );
353
354
 
354
355
  [ 'radius', 'color', 'style', 'width' ].forEach( ( key ) => {
355
356
  if (
@@ -22,7 +22,7 @@ import TextTransformControl from '../text-transform-control';
22
22
  import TextDecorationControl from '../text-decoration-control';
23
23
  import WritingModeControl from '../writing-mode-control';
24
24
  import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
25
- import { setImmutably, uniqByProperty } from '../../utils/object';
25
+ import { setImmutably } from '../../utils/object';
26
26
 
27
27
  const MIN_TEXT_COLUMNS = 1;
28
28
  const MAX_TEXT_COLUMNS = 6;
@@ -53,10 +53,7 @@ export function useHasTypographyPanel( settings ) {
53
53
 
54
54
  function useHasFontSizeControl( settings ) {
55
55
  return (
56
- ( settings?.typography?.defaultFontSizes !== false &&
57
- settings?.typography?.fontSizes?.default?.length ) ||
58
- settings?.typography?.fontSizes?.theme?.length ||
59
- settings?.typography?.fontSizes?.custom?.length ||
56
+ hasMergedOrigins( settings?.typography?.fontSizes ) ||
60
57
  settings?.typography?.customFontSize
61
58
  );
62
59
  }
@@ -103,45 +100,16 @@ function useHasTextColumnsControl( settings ) {
103
100
  return settings?.typography?.textColumns;
104
101
  }
105
102
 
106
- /**
107
- * TODO: The reversing and filtering of default font sizes is a hack so the
108
- * dropdown UI matches what is generated in the global styles CSS stylesheet.
109
- *
110
- * This is a temporary solution until #57733 is resolved. At which point,
111
- * the mergedFontSizes would just need to be the concatenated array of all
112
- * presets or a custom dropdown with sections for each.
113
- *
114
- * @see {@link https://github.com/WordPress/gutenberg/issues/57733}
115
- *
116
- * @param {Object} settings The global styles settings.
117
- *
118
- * @return {Array} The merged font sizes.
119
- */
120
- function getMergedFontSizes( settings ) {
121
- // The font size presets are merged in reverse order so that the duplicates
122
- // that may defined later in the array have higher priority to match the CSS.
123
- const mergedFontSizesAll = uniqByProperty(
124
- [
125
- settings?.typography?.fontSizes?.custom,
126
- settings?.typography?.fontSizes?.theme,
127
- settings?.typography?.fontSizes?.default,
128
- ].flatMap( ( presets ) => presets?.toReversed() ?? [] ),
129
- 'slug'
130
- ).reverse();
131
-
132
- // Default presets exist in the global styles CSS no matter the setting, so
133
- // filtering them out in the UI has to be done after merging.
134
- const mergedFontSizes =
135
- settings?.typography?.defaultFontSizes === false
136
- ? mergedFontSizesAll.filter(
137
- ( { slug } ) =>
138
- ! [ 'small', 'medium', 'large', 'x-large' ].includes(
139
- slug
140
- )
141
- )
142
- : mergedFontSizesAll;
143
-
144
- return mergedFontSizes;
103
+ function getUniqueFontSizesBySlug( settings ) {
104
+ const fontSizes = settings?.typography?.fontSizes;
105
+ const mergedFontSizes = fontSizes ? mergeOrigins( fontSizes ) : [];
106
+ const uniqueSizes = [];
107
+ for ( const currentSize of mergedFontSizes ) {
108
+ if ( ! uniqueSizes.some( ( { slug } ) => slug === currentSize.slug ) ) {
109
+ uniqueSizes.push( currentSize );
110
+ }
111
+ }
112
+ return uniqueSizes;
145
113
  }
146
114
 
147
115
  function TypographyToolsPanel( {
@@ -217,7 +185,7 @@ export default function TypographyPanel( {
217
185
  // Font Size
218
186
  const hasFontSizeEnabled = useHasFontSizeControl( settings );
219
187
  const disableCustomFontSizes = ! settings?.typography?.customFontSize;
220
- const mergedFontSizes = getMergedFontSizes( settings );
188
+ const mergedFontSizes = getUniqueFontSizesBySlug( settings );
221
189
 
222
190
  const fontSize = decodeValue( inheritedValue?.typography?.fontSize );
223
191
  const setFontSize = ( newValue, metadata ) => {
@@ -434,6 +434,12 @@ export function getStylesDeclarations(
434
434
  );
435
435
  }
436
436
 
437
+ // For aspect ratio to work, other dimensions rules (and Cover block defaults) must be unset.
438
+ // This ensures that a fixed height does not override the aspect ratio.
439
+ if ( cssProperty === 'aspect-ratio' ) {
440
+ output.push( 'min-height: unset' );
441
+ }
442
+
437
443
  output.push( `${ cssProperty }: ${ ruleValue }` );
438
444
  } );
439
445
 
@@ -27,7 +27,7 @@
27
27
  }
28
28
 
29
29
  .block-editor-link-control {
30
- width: 300px; // Hardcoded width avoids resizing of control when switching between preview/edit.
30
+ width: 200px; // Hardcoded width avoids resizing of control when switching between preview/edit.
31
31
 
32
32
  .block-editor-url-input {
33
33
  padding: 0; // Cancel unnecessary default 1px padding in this case.
@@ -160,8 +160,7 @@ export function RichTextWrapper(
160
160
  if (
161
161
  blockTypeAttributes?.[ attribute ]?.source ===
162
162
  'rich-text' &&
163
- getBlockBindingsSource( args.source.name )
164
- ?.lockAttributesEditing
163
+ getBlockBindingsSource( args.source )?.lockAttributesEditing
165
164
  ) {
166
165
  shouldDisableEditing = true;
167
166
  break;