Skip to content

Commit

Permalink
Update template part block editing modes to behave more like synced p…
Browse files Browse the repository at this point in the history
…atterns
  • Loading branch information
talldan committed Dec 17, 2024
1 parent 9cba28a commit aaba10f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/block-editor/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,9 @@ export function isSectionBlock( state, clientId ) {
const sectionRootClientId = getSectionRootClientId( state );
const sectionClientIds = getBlockOrder( state, sectionRootClientId );
return (
getBlockName( state, clientId ) === 'core/block' ||
[ 'core/block', 'core/template-part' ].includes(
getBlockName( state, clientId )
) ||
getTemplateLock( state, clientId ) === 'contentOnly' ||
( isNavigationMode( state ) && sectionClientIds.includes( clientId ) )
);
Expand Down
7 changes: 4 additions & 3 deletions packages/block-editor/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2260,9 +2260,10 @@ function getDerivedBlockEditingModesForTree(
const sectionClientIds = state.blocks.order.get( sectionRootClientId );
const syncedPatternClientIds = Object.keys(
state.blocks.controlledInnerBlocks
).filter(
( clientId ) =>
state.blocks.byClientId?.get( clientId )?.name === 'core/block'
).filter( ( clientId ) =>
[ 'core/block', 'core/template-part' ].includes(
state.blocks.byClientId?.get( clientId )?.name
)
);

traverseBlockTree( state, treeClientId, ( block ) => {
Expand Down

0 comments on commit aaba10f

Please sign in to comment.