Skip to content

Commit

Permalink
in zoom out mode remove the drop zone for the sections
Browse files Browse the repository at this point in the history
  • Loading branch information
draganescu authored and scruffian committed Apr 19, 2024
1 parent fb6d46f commit 440e289
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/block-editor/src/components/inner-blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
getBlockEditingMode,
getBlockSettings,
isDragging,
getSettings,
getBlockOrder,
} = unlock( select( blockEditorStore ) );
const { hasBlockSupport, getBlockType } = select( blocksStore );
const blockName = getBlockName( clientId );
Expand All @@ -212,6 +214,17 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
const blockEditingMode = getBlockEditingMode( clientId );
const parentClientId = getBlockRootClientId( clientId );
const [ defaultLayout ] = getBlockSettings( clientId, 'layout' );

// in zoom out mode, we want to disable the drop zone for the sections.
// the inner blocks belonging to the section drop zone is
// already disabled by the blocks themselves being disabled
let _isDropZoneDisabled = blockEditingMode === 'disabled';
if ( __unstableGetEditorMode() === 'zoom-out' ) {
const { sectionRootClientId } = unlock( getSettings() );
const sectionsClientIds = getBlockOrder( sectionRootClientId );
_isDropZoneDisabled = sectionsClientIds?.includes( clientId );
}

return {
__experimentalCaptureToolbars: hasBlockSupport(
blockName,
Expand All @@ -228,7 +241,7 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
blockType: getBlockType( blockName ),
parentLock: getTemplateLock( parentClientId ),
parentClientId,
isDropZoneDisabled: blockEditingMode === 'disabled',
isDropZoneDisabled: _isDropZoneDisabled,
defaultLayout,
};
},
Expand Down

0 comments on commit 440e289

Please sign in to comment.