Skip to content

Commit

Permalink
remove behavior from design mode
Browse files Browse the repository at this point in the history
  • Loading branch information
draganescu committed Nov 11, 2024
1 parent 3980b84 commit bbc8030
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
16 changes: 16 additions & 0 deletions packages/block-editor/src/components/block-inspector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ const BlockInspectorSingleBlock = ( {
),
};
} );
const { __unstableGetEditorMode } = useSelect( blockEditorStore );
const editorMode = __unstableGetEditorMode();

return (
<div className="block-editor-block-inspector">
Expand Down Expand Up @@ -311,6 +313,20 @@ const BlockInspectorSingleBlock = ( {

{ ! isSectionBlock && (
<>
{ editorMode === 'navigation' &&
isSelectedContentClientIdControlling && (
<PanelBody title={ __( 'Content' ) }>
<PrivateListView
rootClientId={
selectedContentClientId
}
ignoreRenderingMode
isExpanded
description={ __( 'Inner blocks' ) }
showAppender={ false }
/>
</PanelBody>
) }
<InspectorControls.Slot />
<InspectorControls.Slot group="list" />
<InspectorControls.Slot
Expand Down
8 changes: 4 additions & 4 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -3046,10 +3046,6 @@ export const getBlockEditingMode = createRegistrySelector(
clientId = '';
}

if ( areInnerBlocksControlled( state, clientId ) ) {
return 'contentOnly';
}

// In zoom-out mode, override the behavior set by
// __unstableSetBlockEditingMode to only allow editing the top-level
// sections.
Expand Down Expand Up @@ -3079,6 +3075,10 @@ export const getBlockEditingMode = createRegistrySelector(
if ( editorMode === 'navigation' ) {
const sectionRootClientId = getSectionRootClientId( state );

if ( areInnerBlocksControlled( state, clientId ) ) {
return 'contentOnly';
}

// The root section is "default mode"
if ( clientId === sectionRootClientId ) {
return 'default';
Expand Down

0 comments on commit bbc8030

Please sign in to comment.