Skip to content

Commit 60526a2

Browse files
talldanjeryj
andauthored
Pattern content only experiment: Make template parts section blocks (WordPress#71627)
* Make template parts contentOnly by default when using contentOnly pattern experiment * Make Site Tagline a content block Co-authored-by: talldan <[email protected]> Co-authored-by: jeryj <[email protected]>
1 parent 484667d commit 60526a2

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

docs/reference-guides/core-blocks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ Describe in a few words what this site is about. This is important for search re
900900

901901
- **Name:** core/site-tagline
902902
- **Category:** theme
903-
- **Supports:** align (full, wide), color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
903+
- **Supports:** align (full, wide), color (background, gradients, text), contentRole, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
904904
- **Attributes:** level, levelOptions, textAlign
905905

906906
## Site Title

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,16 +519,17 @@ export function isSectionBlock( state, clientId ) {
519519
}
520520

521521
const attributes = getBlockAttributes( state, clientId );
522+
const isTemplatePart = blockName === 'core/template-part';
522523
if (
523-
attributes?.metadata?.patternName &&
524+
( attributes?.metadata?.patternName || isTemplatePart ) &&
524525
!! window?.__experimentalContentOnlyPatternInsertion
525526
) {
526527
return true;
527528
}
528529

529530
// Template parts become sections in navigation mode.
530531
const _isNavigationMode = isNavigationMode( state );
531-
if ( _isNavigationMode && blockName === 'core/template-part' ) {
532+
if ( _isNavigationMode && isTemplatePart ) {
532533
return true;
533534
}
534535

packages/block-editor/src/store/reducer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,6 +2286,9 @@ function getDerivedBlockEditingModesForTree(
22862286
const contentOnlyParents = [
22872287
...contentOnlyTemplateLockedClientIds,
22882288
...unsyncedPatternClientIds,
2289+
...( window?.__experimentalContentOnlyPatternInsertion
2290+
? templatePartClientIds
2291+
: [] ),
22892292
];
22902293

22912294
traverseBlockTree( state, treeClientId, ( block ) => {

packages/block-library/src/site-tagline/block.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"text": true
3737
}
3838
},
39+
"contentRole": true,
3940
"spacing": {
4041
"margin": true,
4142
"padding": true,

0 commit comments

Comments
 (0)