Skip to content

Commit

Permalink
Check if block has layout support before adding layout to context.
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Jan 31, 2023
1 parent ebe258d commit f1acfb5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/block-editor/src/components/block-edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import { useMemo } from '@wordpress/element';

import { hasBlockSupport } from '@wordpress/blocks';
/**
* Internal dependencies
*/
Expand All @@ -28,11 +29,16 @@ export default function BlockEdit( props ) {
__unstableLayoutClassNames,
} = props;
const { layout = null } = attributes;
const layoutSupport = hasBlockSupport(
name,
'__experimentalLayout',
false
);
const context = {
name,
isSelected,
clientId,
layout,
layout: layoutSupport ? layout : null,
__unstableLayoutClassNames,
};
return (
Expand Down

0 comments on commit f1acfb5

Please sign in to comment.