Skip to content

Audit blocks for contentOnly mode support #65778

@talldan

Description

@talldan

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

  • Restrict formatting controls in write mode (contentOnly)
  • Disable block transforms in write mode - All transform actions (row, stack, grid, etc on the Group block for example) should be disabled for all blocks when the editor is in write mode.
  • Remove tools from third party blocks by default and consider surfacing a way for block toolbar controls to opt into rendering during write mode.

Buttons

Cover

  • Background image cannot be modified (should it be possible to modify this?)
  • Initial block placeholder can't be interacted with in contentOnly mode (possibly the same issue as above).
  • Text inside Cover not always editable. Reproduced intermittently, with Cover containing Groups with text inside.

Details

PR: #70124

  • Details block appears as a single 'Paragraph' in the Inspector Content panel

File

PR: #65787

  • Block is completely non-interactive, including the placeholder

Gallery

Image

  • Image inserted while in write mode or pre-inserted at root level has "add text over image" option available but doesn't have "caption" option.
  • Image not having ability to add caption is inconsistent with Audio and Video blocks which do allow adding a caption.
  • For pre-inserted Images with captions, the caption isn't always editable (I've reproduced the bug fairly consistently when the block toolbar is at the bottom of the block).
  • Update the order of the tools in the image block to: 1. Add link, 2. Add caption, 3. Crop, 4. Add text over image, 5. Add duotone. In Write Mode the only one of these available should be "link".
  • Move "Replace" to before the other tools as it's the most critical
  • Hide Cut/Copy commands in Write Mode (contentOnly)

List

PR: #65836

Media / Text

  • Additional paragraphs can't be added in the content area of the block (similar to Quote)
  • In the Inspector panel, the paragraph that's inside the Media Text block appears after it (again, similar to Quote)

More

PR: #70100

  • User cannot edit 'Read more' text

Navigation

Post Title / Featured Image / Excerpt

  • Blocks cannot be edited (they have no attributes suitable for the role: content declaration)

Query

Quote

  • The paragraph that's inside the Quote appears after the Quote block in the Inspector Content panel (to repro, add a quote block inside a group, apply contentOnly templateLock to the group, and select the group.)
  • Users cannot add more paragraphs (should they be able to? If so should they also be able to add other types of blocks? How do these appear in the Inspector Content panel?) (see Add new mode to contentOnly locking to allow insertion of new inner blocks #52018)

Site Logo / Site Title / Site Tagline

PR: #71627 (makes site tagline a content block)

Social Link(s)

Spacer

  • Should spacer be resizable?

Synced Patterns in Write Mode

PR: #67026

Table

PR: #70114

  • Block is completely non-editable in contentOnly mode, including the initial placeholder

Template Parts

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block LockingThe API allowing for the ability to lock/unlock blocks[Feature] Write mode[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.
    No fields configured for Enhancement.

    Projects

    Status

    Now

    Status

    🦵 Punted to 7.0

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions