Skip to content

templateLock: contentOnly on core/cover does nothing #66044

Closed as not planned
Closed as not planned

Description

@wongjn

Description

Applying "templateLock":"contentOnly" to a core/cover block (undersome some unknown circumstances) does not convert the block in anyway to content-only editing. It behaves as though the templateLock attribute is not set on it at all.

Step-by-step reproduction instructions

  1. Create/Edit an existing page.
  2. Enter Code Editing mode.
  3. Paste the code snippet included below.
  4. Observe no content-only editing behavior for the first cover block, but see it working for the second.

Screenshots, screen recording, code snippet

<!-- wp:cover {"url":"https://s.w.org/images/core/5.3/MtBlanc1.jpg","dimRatio":50,"customOverlayColor":"#99908e","isUserOverlayColor":true,"isDark":false,"templateLock":"contentOnly","layout":{"type":"constrained"}} -->
<div class="wp-block-cover is-light"><span aria-hidden="true" class="wp-block-cover__background has-background-dim" style="background-color:#99908e"></span><img class="wp-block-cover__image-background" alt="" src="https://s.w.org/images/core/5.3/MtBlanc1.jpg" data-object-fit="cover"/><div class="wp-block-cover__inner-container">
  <!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
  <p class="has-text-align-center has-large-font-size">Foo</p>
  <!-- /wp:paragraph -->
</div></div>
<!-- /wp:cover -->

<!-- wp:cover {"url":"https://s.w.org/images/core/5.3/MtBlanc1.jpg","dimRatio":60,"isUserOverlayColor":true,"align":"full","style":{"spacing":{"padding":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20","left":"var:preset|spacing|20","right":"var:preset|spacing|20"},"blockGap":"var:preset|spacing|10","margin":{"top":"0"}}},"layout":{"type":"constrained","contentSize":"78.75rem"},"templateLock":"contentOnly"} -->
<div class="wp-block-cover alignfull" style="margin-top:0;padding-top:var(--wp--preset--spacing--20);padding-right:var(--wp--preset--spacing--20);padding-bottom:var(--wp--preset--spacing--20);padding-left:var(--wp--preset--spacing--20)"><span aria-hidden="true" class="wp-block-cover__background has-background-dim-60 has-background-dim"></span><img class="wp-block-cover__image-background" alt="" src="https://s.w.org/images/core/5.3/MtBlanc1.jpg" data-object-fit="cover"/><div class="wp-block-cover__inner-container">
  <!-- wp:paragraph {"align":"center","className":"wp-block-paragraph","style":{"typography":{"fontStyle":"normal","fontWeight":"700"},"spacing":{"margin":{"top":"5rem"}}},"fontSize":"large"} -->
  <p class="has-text-align-center wp-block-paragraph has-large-font-size" style="margin-top:5rem;font-style:normal;font-weight:700">Phasellus viverra nulla ut metus varius laoreet. Suspendisse non nisl sit amet velit hendrerit rutrum. Curabitur nisi.</p>
  <!-- /wp:paragraph -->

  <!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
  <div class="wp-block-buttons">
    <!-- wp:button {"backgroundColor":"yellow","textColor":"pink","style":{"elements":{"link":{"color":{"text":"var:preset|color|pink"}}}}} -->
    <div class="wp-block-button"><a class="wp-block-button__link has-pink-color has-yellow-background-color has-text-color has-background has-link-color wp-element-button" href="https://brigstowe.test/support-our-work/membership">Find out more</a></div>
    <!-- /wp:button -->
  </div>
  <!-- /wp:buttons -->
</div></div>
<!-- /wp:cover -->

Image

Environment info

  • WordPress 6.6.2
  • Twenty Twenty-Four 1.2
  • Chrome 129.0.6668.90 (64-bit)
  • Windows 11

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

Activity

  1. added
    [Type] BugAn existing feature does not function as intended
    on Oct 11, 2024
  2. added
    [Block] CoverAffects the Cover Block - used to display content laid over a background image
    [Status] DuplicateUsed to indicate that a current issue matches an existing one and can be closed
    on Oct 11, 2024
  3. talldan commented on Oct 11, 2024

    @talldan
    Contributor

    I'm unable to reproduce the issue with the Gutenberg plugin active.

    I believe this was already fixed by #65105, which will be released in WordPress 6.7.

    I'll close the issue, but let me know if it's still something you're experiencing with the plugin active and I can reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] CoverAffects the Cover Block - used to display content laid over a background image[Status] DuplicateUsed to indicate that a current issue matches an existing one and can be closed[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions