Skip to content

Commit b15f5e3

Browse files
committed
Consider template parts a section in navigation mode
1 parent 0059331 commit b15f5e3

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

packages/block-editor/src/store/private-selectors.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,13 +502,23 @@ export const getParentSectionBlock = ( state, clientId ) => {
502502
* @return {boolean} Whether the block is a content locking parent.
503503
*/
504504
export function isSectionBlock( state, clientId ) {
505+
const blockName = getBlockName( state, clientId );
506+
if (
507+
blockName === 'core/block' ||
508+
getTemplateLock( state, clientId ) === 'contentOnly'
509+
) {
510+
return true;
511+
}
512+
513+
// Template parts become sections in navigation mode.
514+
const _isNavigationMode = isNavigationMode( state );
515+
if ( _isNavigationMode && blockName === 'core/template-part' ) {
516+
return true;
517+
}
518+
505519
const sectionRootClientId = getSectionRootClientId( state );
506520
const sectionClientIds = getBlockOrder( state, sectionRootClientId );
507-
return (
508-
getBlockName( state, clientId ) === 'core/block' ||
509-
getTemplateLock( state, clientId ) === 'contentOnly' ||
510-
( isNavigationMode( state ) && sectionClientIds.includes( clientId ) )
511-
);
521+
return _isNavigationMode && sectionClientIds.includes( clientId );
512522
}
513523

514524
/**

0 commit comments

Comments
 (0)