Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groups with contentOnly locking should not be transformable into other variations #64661

Closed
richtabor opened this issue Aug 21, 2024 · 11 comments · Fixed by #64917
Closed

Groups with contentOnly locking should not be transformable into other variations #64661

richtabor opened this issue Aug 21, 2024 · 11 comments · Fixed by #64917
Assignees
Labels
[Feature] Block Locking The API allowing for the ability to lock/unlock blocks [Feature] Block Transforms Block transforms from one block to another [Type] Enhancement A suggestion for improvement.

Comments

@richtabor
Copy link
Member

I propose that when contentOnly locking is in place on a group block, the pattern should not have have transform controls.

contentOnly is a form of flattening/locking the innerBlocks, which when transformed does not typically result in a positive experience (as you can't manipulate the blocks further anyhow to try and fix it).

Current

CleanShot.2024-08-20.at.20.04.07.mp4

CleanShot 2024-08-20 at 20 05 50

@richtabor richtabor added [Type] Enhancement A suggestion for improvement. [Feature] Block Transforms Block transforms from one block to another [Feature] Block Locking The API allowing for the ability to lock/unlock blocks labels Aug 21, 2024
@richtabor
Copy link
Member Author

There may be validity in not having transforms at all for contentOnly locked group blocks?

@jasmussen
Copy link
Contributor

There may be validity in not having transforms at all for contentOnly locked group blocks?

I'd agree. If need be we can build an edit affordance, like there is for synced overridable patterns. Or you would just need to detach. By switching from row to stack, for example, it substantially alters the appearance of most patterns that were meant to be the former.

@richtabor richtabor changed the title Groups with contentOnly locking should not be transformable into other variations ContentOnly: Groups with contentOnly locking should not be transformable into other variations Aug 27, 2024
@ramonjd
Copy link
Member

ramonjd commented Aug 28, 2024

I started looking briefly.

We could completely short-circuit the block switcher in the toolbar, but I think the rest would have to be done at the block level, at least for Group blocks.

@ramonjd
Copy link
Member

ramonjd commented Aug 30, 2024

Testing stuff over here:

What do folks think should happen when multiple blocks are selected?

My guess is that if a single block among multiple select is locked, then we shouldn't show the transformation options.

The other option is to show them and (try to) only apply the transformation to the non-locked blocks.

@jasmussen
Copy link
Contributor

What do folks think should happen when multiple blocks are selected?

Would it be reasonable/possible to omit the individual-level transform, and keep only the container-level transforms, i.e. "I want to group a paragraph with a content-only locked pattern"? If that's at all hard, I'd also tend to support your instinct:

My guess is that if a single block among multiple select is locked, then we shouldn't show the transformation option

@ramonjd
Copy link
Member

ramonjd commented Aug 30, 2024

Would it be reasonable/possible to omit the individual-level transform, and keep only the container-level transforms

Hmm, I'm not sure they're filterable off the top of my hat, but I can have a quick look next week 🤔

@jasmussen
Copy link
Contributor

I would say: go with the simplest option.

@richtabor
Copy link
Member Author

Reopening as destructive transforms are still available from the Inspector:

CleanShot 2024-09-11 at 13 57 14

@richtabor richtabor reopened this Sep 11, 2024
@richtabor richtabor reopened this Sep 11, 2024
@richtabor richtabor changed the title ContentOnly: Groups with contentOnly locking should not be transformable into other variations Groups with contentOnly locking should not be transformable into other variations Sep 11, 2024
@ramonjd
Copy link
Member

ramonjd commented Sep 11, 2024

Reopening as destructive transforms are still available from the Inspector:

Thanks for the report.

Could you add some testing steps on how to reproduce what you're seeing?

Template lock values of "contentOnly" behave as expected for me in post and site editors so far given the following example:

<!-- wp:group {"templateLock":"contentOnly", "style":{"color":{"background":"#f8f6db"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group has-background" style="background-color:#f8f6db"><!-- wp:paragraph -->
<p>A Group block with template lock === "contentOnly"</p>
<!-- /wp:paragraph -->

<!-- wp:group {"style":{"color":{"background":"#e1dbfd"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group has-background" style="background-color:#e1dbfd"><!-- wp:paragraph -->
<p>A nested Group block with template lock === "contentOnly"</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
Screenshot 2024-09-12 at 9 34 28 AM

@getdave
Copy link
Contributor

getdave commented Sep 12, 2024

I wonder if some PRs might need rebasing and that's why this is still coming up in demos...etc?

@richtabor
Copy link
Member Author

I wonder if some PRs might need rebasing and that's why this is still coming up in demos...etc?

Yup! Pretty sure that's what's going on. Closing this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block Locking The API allowing for the ability to lock/unlock blocks [Feature] Block Transforms Block transforms from one block to another [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants