Site icon Hip-Hop Website Design and Development

Creating Block templates with ‘core/heading’ apart from stage 2

Each time I try to outline a stage apart from H2 for ‘core/heading’ in any block template, upon reload of the web page editor, the block will get a "This block contains unexpected or invalid content" error, and when the "Attempt Block Recovery" button is clicked, the block stage is modified to stage 2. Why would I not appear to have the ability to use another stage than 2 in a block template?

Instance template excerpt:

<?php
$template = [
  [
        'core/heading', 
        [
          'level' => '2',
            'content' => 'Directions',
            'className' => 'block-header-directions',
        ],
    ],
  [
        'core/heading', 
        [
          'level' => '3',
            'placeholder' => 'Subheading',
            'className' => 'block-subheader-directions has-blue-alt-color',
        ],
    ],
  [
        'core/list', 
        [
          'placeholder' => 'List item',
          'ordered' => true,
          'className' => 'block-list-directions',
        ],
  ],
];

Within the above instance, the block with the placeholder "Subheading" causes that chain of occasions.

I believed initially that this was doubtlessly some enforcement of semantics (that Gutenberg wished to see H1, H2, H3, and so forth. within the right order within the content material), however it happens, as within the case above, even when the heading ranges are in a very sematic order within the content material.

(Doubtlessly associated, because the pressured H2 drawback appears to increase to different editor areas as effectively: I’ve added a block fashion to ‘core/heading’, so the block editor now shows previews of the kinds. However regardless of which heading stage is chosen, solely the preview for the H2 heading is displayed.)