Skip to content

Commit

Permalink
Switch to using the block id as the selector for custom gap property
Browse files Browse the repository at this point in the history
  • Loading branch information
Glen Davies committed Jan 25, 2022
1 parent 5422714 commit 06543e4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/block-library/src/gallery/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { concat, find } from 'lodash';
/**
* WordPress dependencies
*/
import { compose, useInstanceId } from '@wordpress/compose';
import { compose } from '@wordpress/compose';
import {
BaseControl,
PanelBody,
Expand Down Expand Up @@ -121,7 +121,6 @@ function GalleryEdit( props ) {
};
}, [] );

const id = useInstanceId( getBlock( clientId ) );
const styleElement = useContext( BlockList.__unstableElementContext );

const innerBlockImages = useSelect(
Expand Down Expand Up @@ -471,8 +470,8 @@ function GalleryEdit( props ) {
const hasLinkTo = linkTo && linkTo !== 'none';

const gap = attributes.style?.spacing?.blockGap
? `.wp-container-${ id } { --wp--style--unstable-gallery-gap: ${ attributes.style.spacing.blockGap } }`
: undefined;
? `#block-${ clientId } { --wp--style--unstable-gallery-gap: ${ attributes.style.spacing.blockGap } }`
: `#block-${ clientId } { --wp--style--unstable-gallery-gap: var( --wp--style--block-gap ) }`;

const GapStyle = () => {
return <style>{ gap }</style>;
Expand Down

0 comments on commit 06543e4

Please sign in to comment.