Skip to content

If there is a block with apiVersion of 2 in block.json, the content width is applied to the pattern preview #52155

@inc2734

Description

@inc2734

Description

For example, activate a plugin with apiVersion 2 blocks such as CoBlocks. The content width would then be applied to the content in the pattern preview.

Specifically, the following styles will be added in the pattern preview.

.editor-styles-wrapper .block-editor-block-list__layout.is-root-container > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
    max-width: 650px;
    margin-left: auto !important;
    margin-right: auto !important;
}

If the apiVersion is only a block of 3, this style will not be loaded.

Even without the block plugin installed, I was able to reproduce the problem by changing wp-includes/blocks/blocks-json.php as follows.

<?php return array(
  'archives' => array(
    '$schema' => 'https://schemas.wp.org/trunk/block.json',
    'apiVersion' => 2, // 3 to 2

Step-by-step reproduction instructions

  1. Activate the appropriate block plugins. For example, CoBlocks
  2. Open the Submission Editor
  3. Open the Pattern Inserter
  4. Check the preview

  1. Modify wp-includes/blocks/blocks-json.php.
  2. Open the Submission Editor
  3. Open the Pattern Inserter
  4. Check the preview

Screenshots, screen recording, code snippet

Kapture.2023-06-30.at.15.16.51.mp4

Environment info

  • WordPress 6.3 beta2
  • TwentyTwentyThree v1.1

This problem does not occur when the Gutenberg (v16.1.0) plugin is activated.

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Labels

[Package] Block editor/packages/block-editor[Type] BugAn existing feature does not function as intended

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions