Skip to content

Commit

Permalink
Update: Disable layout toolbar controls for content locked blocks. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Feb 23, 2023
1 parent 80cd581 commit 626362e
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions packages/block-editor/src/hooks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,25 @@ export function useLayoutStyles( block = {}, selector ) {
return css;
}

function LayoutPanel( { setAttributes, attributes, name: blockName } ) {
function LayoutPanel( {
clientId,
setAttributes,
attributes,
name: blockName,
} ) {
const { layout } = attributes;
const defaultThemeLayout = useSetting( 'layout' );
const themeSupportsLayout = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
return getSettings().supportsLayout;
}, [] );
const { themeSupportsLayout, isContentLocked } = useSelect(
( select ) => {
const { getSettings, __unstableGetContentLockingParent } =
select( blockEditorStore );
return {
themeSupportsLayout: getSettings().supportsLayout,
isContentLocked: __unstableGetContentLockingParent( clientId ),
};
},
[ clientId ]
);

const layoutBlockSupport = getBlockSupport(
blockName,
Expand Down Expand Up @@ -254,7 +266,7 @@ function LayoutPanel( { setAttributes, attributes, name: blockName } ) {
) }
</PanelBody>
</InspectorControls>
{ ! inherit && layoutType && (
{ ! inherit && ! isContentLocked && layoutType && (
<layoutType.toolBarControls
layout={ usedLayout }
onChange={ onChangeLayout }
Expand Down

1 comment on commit 626362e

@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 626362e.
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/4255321619
📝 Reported issues:

Please sign in to comment.