Skip to content

Commit

Permalink
Make sure theme setting overrides block setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Nov 20, 2023
1 parent b0756d5 commit ad4b76c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/block-editor/src/hooks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,12 @@ export function useLayoutStyles( blockAttributes = {}, blockName, selector ) {
function LayoutPanel( { setAttributes, attributes, name: blockName } ) {
const settings = useBlockSettings( blockName );
// Block settings come from theme.json under settings.[blockName].
const { layout: layoutSettings } = settings;
const {
layout: {
allowEditing: allowEditingSetting,
allowCustomContentSize: allowCustomContentSizeSetting,
},
} = settings;
// Layout comes from block attributes.
const { layout } = attributes;
const [ defaultThemeLayout ] = useSettings( 'layout' );
Expand All @@ -159,8 +164,9 @@ function LayoutPanel( { setAttributes, attributes, name: blockName } ) {
{}
);
const blockSupportAndThemeSettings = {
...layoutSettings,
...layoutBlockSupport,
allowEditing: allowEditingSetting ?? true,
allowCustomContentSize: allowCustomContentSizeSetting ?? true,
};
const {
allowSwitching,
Expand Down

0 comments on commit ad4b76c

Please sign in to comment.