Skip to content

Commit

Permalink
Gallery: Ensure block spacing controls are available at block level b…
Browse files Browse the repository at this point in the history
…y moving check to hide controls to global styles screen (#53900)
  • Loading branch information
andrewserong committed Aug 24, 2023
1 parent 1bc4205 commit 5d42ed1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
10 changes: 1 addition & 9 deletions packages/blocks/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,7 @@ export const getSupportedStyles = createSelector(

// Check for blockGap support.
// Block spacing support doesn't map directly to a single style property, so needs to be handled separately.
// Also, only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.
if (
blockType?.supports?.spacing?.blockGap &&
blockType?.supports?.spacing?.__experimentalSkipSerialization !==
true &&
! blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(
( spacingType ) => spacingType === 'blockGap'
)
) {
if ( blockType?.supports?.spacing?.blockGap ) {
supportKeys.push( 'blockGap' );
}

Expand Down
14 changes: 14 additions & 0 deletions packages/edit-site/src/components/global-styles/screen-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ function ScreenBlock( { name, variation } ) {
const { behavior } = useGlobalBehaviors( name, 'user' );

const blockType = getBlockType( name );

// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.
if (
settings?.spacing?.blockGap &&
blockType?.supports?.spacing?.blockGap &&
( blockType?.supports?.spacing?.__experimentalSkipSerialization ===
true ||
blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(
( spacingType ) => spacingType === 'blockGap'
) )
) {
settings.spacing.blockGap = false;
}

const blockVariations = useBlockVariations( name );
const hasTypographyPanel = useHasTypographyPanel( settings );
const hasColorPanel = useHasColorPanel( settings );
Expand Down

1 comment on commit 5d42ed1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 5d42ed1.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5969988873
📝 Reported issues:

Please sign in to comment.