Description
contentOnly mode is becoming more prevalent in the editor after 'Select Mode: Use the content-only behavior in select mode' was merged.
Lots of block types still aren't working perfectly in contentOnly mode, so this list intends to capture those issues so that they can be worked on in parallel by multiple devs. Lots of the blocks also share similar issues, so hopefully there are higher-level solutions to the problems that can be found (lets discuss these in the comments).
Feel free to add more to this issue if you discover untracked issues.
Rough snippet that can be run in post editor's console to generate example blocks in contentOnly locked groups, YMMV 🤷
const blockExamples = wp.data.select( 'core/blocks' ).getBlockTypes()
.filter( ( { example } ) => example )
.map( ( { name, title, example: { attributes, innerBlocks } } ) => ( { name, title, attributes, innerBlocks } ) );
const createInnerExamples = ( innerBlocks ) => innerBlocks.map( ( { name, attributes, innerBlocks } ) => {
return wp.blocks.createBlock( name, attributes, createInnerExamples( innerBlocks ?? [] ) );
});
const createExamples = ( examples ) => examples.map( ( { name, title, attributes, innerBlocks } ) => {
const innerBlockInstances = createInnerExamples( innerBlocks ?? [] );
return wp.blocks.createBlock( 'core/group', {
templateLock: 'contentOnly',
metadata: { name: title }
}, [ wp.blocks.createBlock( name, attributes, innerBlockInstances ) ]);
});
const innerBlockInstances = createExamples( blockExamples );
const blocks = wp.data.select( 'core/block-editor' ).getBlocks();
wp.data.dispatch( 'core/block-editor' ).insertBlocks( innerBlockInstances, blocks.length );
Blocks
All blocks
Buttons
Cover
Details
PR: #70124
File
PR: #65787
Gallery
Image
List
PR: #65836
Media / Text
More
PR: #70100
Navigation
Post Title / Featured Image / Excerpt
Query
Quote
Site Logo / Site Title / Site Tagline
PR: #71627 (makes site tagline a content block)
Social Link(s)
Spacer
Synced Patterns in Write Mode
PR: #67026
Table
PR: #70114
Template Parts
Description
contentOnlymode is becoming more prevalent in the editor after 'Select Mode: Use the content-only behavior in select mode' was merged.Lots of block types still aren't working perfectly in
contentOnlymode, so this list intends to capture those issues so that they can be worked on in parallel by multiple devs. Lots of the blocks also share similar issues, so hopefully there are higher-level solutions to the problems that can be found (lets discuss these in the comments).Feel free to add more to this issue if you discover untracked issues.
Rough snippet that can be run in post editor's console to generate example blocks in contentOnly locked groups, YMMV 🤷
Blocks
All blocks
Buttons
contentOnlylocking to allow insertion of new inner blocks #52018)Add before" and "add after" options available in the Button block but they don't do anythingCover
contentOnlymode (possibly the same issue as above).Details
PR: #70124
File
PR: #65787
Gallery
contentOnlylocking to allow insertion of new inner blocks #52018)Image
List
PR: #65836
contentOnlylocking to allow insertion of new inner blocks #52018)gutenberg/packages/block-editor/src/components/block-inspector/index.js
Line 242 in df27bd9
Media / Text
More
PR: #70100
Navigation
Post Title / Featured Image / Excerpt
role: contentdeclaration)Query
Quote
contentOnlytemplateLock to the group, and select the group.)contentOnlylocking to allow insertion of new inner blocks #52018)Site Logo / Site Title / Site Tagline
PR: #71627 (makes site tagline a content block)
role: contentdeclaration)Social Link(s)
<RichText />?contentOnlylocking to allow insertion of new inner blocks #52018)Spacer
Synced Patterns in Write Mode
PR: #67026
Table
PR: #70114
contentOnlymode, including the initial placeholderTemplate Parts