-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add new mode to contentOnly
locking to allow insertion of new inner blocks
#52018
Comments
@noisysocks @jorgefilipecosta Do you maybe have any insights as to how difficult it would be to allow for this kind of behavior in the content only locked mode? |
The difficulty is in designing a coherent API for extenders 😀 I think it might be better to move away from |
This request makes so much sense IMHOTo me this sound as a must have to make the content only mode really usable. I can also imagine that we would allow users to add/move/remove arbitrary blocks to e.g. a group which has contentOnly set. All blocks that would be added would of course run in contentOnly mode. Maybe we could introduce an attribute that overrides the default behaviour of contentOnly.
2,3 and 4 should be able to be overriden using e.g. a
Further more I would love to see the 🤞 |
CC: @annezazu @SaxonF Tagging you here because we talked about this in the WordPress 6.5 Hallway hangout yesterday. I believe this is a major limitation of the |
Also tagging @talldan to ensure you saw #52018 (comment) as it relates to the block connections work :) |
+1 to this, especially where a block is just a wrapper for a specific single inner block (Button, List, Gallery, (Columns is a weird one)). Some ideas:
Partially synced patterns are going to need to consider the use case for repeatable elements. There are plenty of synced patterns that might want to have some flexibility in the number of buttons, bullet points, etc. And that's not even including more complicated use cases where you might want a user to be able to duplicate/delete entire columns with blocks inside- instead of having to make separate pattern designs (Pattern with three testimonial block quotes, Pattern with four testimonial block quotes, etc). |
Apologies for missing this @fabiankaegy ! I regularly come across the need to add/remove elements from a repeatable container, even in other tools like Figma. I touched on this a little bit in the [advancing content only issue ]. It would also be nice to mark blocks that can easily be toggled on/off eg I may not need a subheading from a pattern |
@SaxonF Yeah the ability to toggle on / off something is a common need. I today removed content only locking from a pattern because the client sometimes needs to remove a CTA button from that section. And that's just not possible currently. Long term I think it would also be super cool to allow for users to switch between color schemes like light & dark of a pattern. Like described in the section specific theme.json task. This all is why I'm really hoping we build pattern overrides in a way where we can make it really granular :) |
I thought of a potential technical solution for this in terms of pattern overrides. Right now pattern overrides work by 'bubbling' the content attribute values of inner blocks like paragraph and heading to the parent pattern block where they're stored in a Potentially we could do the same for lists, with the wrapper blocks (list, gallery, buttons) also working the same way. They have a This might work ok for container blocks that only support one inner block type, the list items are interchangeable, so the position of the data doesn't matter so much. cc @SantosGuillamot @gziolo @kevin940726 - would be interested to hear your thoughts. |
On writing it out, just realized one potential issue with a solution like this is that we need the markup of the inner blocks (e.g. a list item) to be able to carry out the dynamic injection of values on the server 🤔 Potentially you could take the first inner block and replicate it, but a limitation would be needing at least one inner block defined in the pattern. |
@youknowriad @mtias @richtabor Coming back to our conversation earlier today. I do think there may be merit to the idea of introducing a new We currently have:
Why not introduce a new mode or use one of the existing ones to allow opening up editing of descendants again? We could add that Paired with |
I've referenced this issue for the various blocks this affects in #65778. I did start exploring this in #65836, but there were more pressing things at the time. Not sure if it still works, I remember hitting on some writing flow issues that I wasn't sure how to solve.
Could it also be the other way around, that insertion is allowed by default for these kinds of blocks, and then I think there are likely to be more cases where that's a good default - e.g. users don't want to be stuck with the default provided social icons in a contentOnly pattern. |
@talldan Thanks for linking that. I can certainly help with testing / light reviews :) Something that has me a bit concerned at the moment is that it seems #65204 (comment) introduced a workaround that patches this behavior, particularly for the core list block in the global write mode. I mean, it's great to see that the list block can accept new list items in this mode and remains selectable. But I worry that this is not thinking about the issue wholistically and is setting a bad precedent.
I think the only argument against that I can come up with is backwards compatibility. Other than that, I would agree that it would probably be the better default. |
Ah, ok, I think I know what you mean. I noticed that as well, though I don't think it's related to the code you mentioned? I'm pretty sure that PR only moved that line of code, I left a comment here to show where it was originally: |
contentOnly
locking is super powerful. There are some instances though, where actual inner blocks are used for content. An example of this is the core list or also the core buttons block. It would be great to be able to say that editors should be able to add additional list items or additional buttons even when the container block has it'stemplateLock
set tocontentOnly
CleanShot.2023-06-28.at.10.41.03.mp4
The text was updated successfully, but these errors were encountered: