Skip to content

Commit

Permalink
Fix rendering block-level blockGap set in the block's attributes in t…
Browse files Browse the repository at this point in the history
…he post editor
  • Loading branch information
andrewserong committed May 23, 2022
1 parent 75ce223 commit aca60cf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/block-editor/src/hooks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import { has } from 'lodash';
*/
import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';
import { addFilter } from '@wordpress/hooks';
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
import {
getBlockDefaultClassName,
getBlockSupport,
hasBlockSupport,
} from '@wordpress/blocks';
import { useSelect } from '@wordpress/data';
import {
Button,
Expand Down Expand Up @@ -217,6 +221,9 @@ export const withLayoutStyles = createHigherOrderComponent(
[ `wp-container-${ id }` ]: shouldRenderLayoutStyles,
[ `is-layout-${ layoutType }` ]: true,
} );
const selector = `.${ getBlockDefaultClassName(
name
) }.wp-container-${ id }`;

return (
<>
Expand All @@ -225,9 +232,7 @@ export const withLayoutStyles = createHigherOrderComponent(
createPortal(
<LayoutStyle
blockName={ name }
selector={ `${
props?.className || '' // TODO: It seems the block className isn't really available here.
}.wp-container-${ id }` }
selector={ selector }
layout={ usedLayout }
style={ attributes?.style }
/>,
Expand Down

0 comments on commit aca60cf

Please sign in to comment.