-
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
Idea: using the group block in synced patterns as a freeform content area (via pattern overrides) #61225
Comments
I really like the idea of this. Currently, we often have to build custom block wrappers that then have an open inner blocks area. Pattern Overrides in general still have the limitation, due to it's usage of |
Yep, I think this is one area that makes me hesitant at the same time. I think there could still be separate solutions for blocks like list/buttons, those containers that have one supported inner block type (gallery and social links are maybe others) and aren't really freeform. I think this might be good so that I would be hesitant of too many solutions for this kind of thing, but at the same time I think a freeform area in synced patterns would be quite a powerful feature. |
Over at #37753 a good point was made about "template tag" blocks being facsimiles of generic blocks (e.g. Post Title and Site Title being facsimiles of Heading) that would be better implemented as block bindings within the generic blocks. I guess the point quoted above is the same point regarding Post Content as a facsimile of Group. Accordingly, the solution described here could enable post content data to be a block binding source for Group, and would be a better solution to #41073 which I would be happy to close in favour of this issue. |
Great idea indeed. For me this means "inner blocks" support for block bindings. It's important that the implementation of such feature is not pattern overrides specific and would allow any block bindings source to inject blocks. |
This is the holy grail of hybrid template / freeform editing and is something I've been dreaming of since the block editor was introduced. I agree with @youknowriad that making |
Another good use case for this will be nesting patterns. For example you could have a section that contains a header, images and an overridden grid/columns, and within the grid/columns you could nest card patterns. That allows for pretty cool composition of patterns. |
With the ability to now express Side note, but we need to expose |
I've also been thinking on the idea of composing patterns. An example use case I have in my head is a pricing table pattern. It has a 'freeform' columns block, and by default there are a few columns, and each has a A challenge would be that when the user appends an additional column, the new column is going to be empty whereas I think it could be populated with the This use case isn't limited to only pricing tables, it's illustrative, there are plenty of situations where a pattern designer would want users to insert consistent content into columns, grids and other types of lists. Some kind of This might be a few steps ahead of where we are right now, but it's good to think about how these things can be configured. |
Hello, I would say my suggestion also fits here. |
Quoting the issue created by @liviopv:
It might be a good idea to consolidate these two issues and expand the scope for this one. |
Yes, I agree—this is the holy grail. I often face the challenge of creating multiple synced patterns for slight variations like “Hero Area With Text and a List” versus “Hero Area With Text, a List, and a Button.” An innerBlock (or a classic/WYSIWYG block with override support) would solve this. Prioritizing this feature would let us immediately benefit from synced patterns even as broader block support is gradually added. It’s a win-win: developers can avoid building custom React blocks every time, and non-coders (who aren't going to be creating native blocks) can create consistent across site structured content without advanced HTML/CSS skills. I did find some plugin developers are looking into this too and equally frustrated it being so close to possible https://wordpress.org/support/topic/blocks-with-custom-block-editor-content/ I’m relatively new to modern WordPress (after using it in 2005 with a long hiatus) and will be testing interim solutions; wish I could help more with this, but also hear that its hardcoded in what blocks area allowed to have overrides; but if I can think of something to help in the meantime I will post. I hope its ok I mention this here, not sure if this the right place to simply +1 an idea but I see so much potential in this. |
What problem does this address?
In my own usage of the block editor, I'd find it useful to add sections to my posts that have a predefined style/layout, but would still allow me to add freeform 'blog' style content (an unbound amount of paragraphs, images, videos etc) within those sections. Right now I use unsynced patterns for this, but that means I can't manage the design aspects of these patterns.
This is a shortcoming of pattern overrides currently. Only a few blocks can have specific 'content' attributes overriden in instances of a pattern. Even if more block types and attributes are allowed in the future, those blocks are locked in place and the user can't move them (which is an advantage for some types of content, but a disadvantage for others).
In the future I think there might be space for different ways to edit content in synced pattern instances using overrides.
What is your proposed solution?
UX
I think it may be possible to solve this by allowing pattern overrides on a group block. For a user, the process would be the same as declaring an override on any other block. Click the 'Enable overrides' button and name a group.
Some default blocks could be added within the group as part of the pattern.
When inserting an instance of the pattern, the group's inner blocks would be a completely unlocked part of the pattern with the user able to add/remove new blocks freely.
The group block also supports an
allowedBlocks
prop, so that would open up some interesting editorial/workflow possibilities, like only allowing basic text and media blocks as a preset.Technical solution
The inner blocks for these groups need to be saved somewhere, but I think it would be ok to save them as part of the pattern block's inner blocks when serializing:
Only the container blocks that are enabled in this way would be serialized, and it would be possible to support multiple container blocks in a pattern that work this way.
When rendering post content server-side, the content of these named groups would be copied into the correct container blocks.
In this way it works a little bit like slot/fills.
Considerations
The text was updated successfully, but these errors were encountered: