-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Enable template part specific block patterns. #28802
Comments
I wonder what would be the best way to tackle this implementation-wise. Should we add a filter and use that to manipulate the patterns array in the gutenberg/packages/block-editor/src/components/inserter/hooks/use-patterns-state.js Line 35 in 6d3c4b3
What should happen to template part-specific block patterns? Should they appear on top of the list? Or a bit separated from the others? 🤔 @jameskoster What do you think? Do we have a mock-up for this? |
I think a good first step for this would be to find a way to enable this 'recommendation' in the existing UI. That is, when we are selected inside a template part the normal sidebar patterns inserter should show patterns corresponding to template parts of that 'area' as the first results. This will allow us to have a better technical understanding of what we need in place and how to best enable this recommendation feature (what filters, hooks, data structures, etc. make the most sense to enable this). That exploration should make creating 'new UI' areas specifically for recommendations easier to implement once those designs are more finalized and ready to be created. |
I wonder if we could conditionally add an item to this dropdown in that case. If a header is selected (and header patterns exist), have a 'header' option in this dropdown and have the patterns inserter default to that when it opens: |
We hacked up a quick PR to see what that would feel like - #29595 just to test. But the current inserting behavior of appending beneath the currently selected block makes it feel quite clunky though. 🤔 |
Closing this as we have used the |
What problem does this address?
As noted in #27337 - we should enable special block patterns that only show up when specific template part types are selected (such as header or footer).
Also related to - #27575
What is your proposed solution?
Once #28410 lands, we should have a way to distinguish what section type a template part corresponds to. This should open up the ability to link block patterns to them.
The text was updated successfully, but these errors were encountered: