Skip to content

Commit

Permalink
Ensure block support is checked properly
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong committed Dec 12, 2023
1 parent 3e84a7c commit c52cd77
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,6 @@ export default function DimensionsPanel( {
setImmutably( value, [ 'dimensions', 'aspectRatio' ], newValue )
);
};
// const resetAspectRatioValue = () => {
// setAspectRatioValue( undefined );
// };
const hasAspectRatioValue = () => !! value?.dimensions?.aspectRatio;

// Child Layout
Expand Down
15 changes: 9 additions & 6 deletions packages/block-editor/src/components/global-styles/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const VALID_SETTINGS = [
'color.palette',
'color.text',
'custom',
'dimensions.aspectRatio',
'dimensions.minHeight',
'layout.contentSize',
'layout.definitions',
Expand Down Expand Up @@ -339,12 +340,14 @@ export function useSettingsForBlockElement(
}
} );

if ( ! supportedStyles.includes( 'minHeight' ) ) {
updatedSettings.dimensions = {
...updatedSettings.dimensions,
minHeight: false,
};
}
[ 'aspectRatio', 'minHeight' ].forEach( ( key ) => {
if ( ! supportedStyles.includes( key ) ) {
updatedSettings.dimensions = {
...updatedSettings.dimensions,
[ key ]: false,
};
}
} );

[ 'radius', 'color', 'style', 'width' ].forEach( ( key ) => {
if (
Expand Down
5 changes: 5 additions & 0 deletions packages/blocks/src/api/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export const __EXPERIMENTAL_STYLE_PROPERTY = {
value: [ 'color', 'link' ],
support: [ 'color', 'link' ],
},
aspectRatio: {
value: [ 'dimensions', 'aspectRatio' ],
support: [ 'dimensions', 'aspectRatio' ],
useEngine: true,
},
background: {
value: [ 'color', 'gradient' ],
support: [ 'color', 'gradients' ],
Expand Down

0 comments on commit c52cd77

Please sign in to comment.