-
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
Try: Filter Pattern Categories by Editor Type #47275
Conversation
Size Change: +4.93 kB (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
Flaky tests detected in aa9f190. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3997796164
|
Speaking personally, I do think it makes sense to have a split with the post editor as much of those patterns aren't useful there and it helps to proactively curate things a bit for users. I would move forward with implementing this but I'm curious what @WordPress/gutenberg-design thinks though as this ultimately is a design question mark. |
Ok, so the PR is about creating a filter showing all Patterns in the Site Editor and removing those patterns that does not feel natural to show in the Post Editor be filtered out / not seen. This PR will remove the Header and Footer patterns from the Post Editor. It seems like a good idea! It is good to have a filtering mechanism in place to where a developer can filter which pattern categories to show in the Post and/or Site Editor. I will assume it will be developer friendly making it possible for a developer to filter it like they need. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this API should consider the semantics of patterns and their categories. It might be not as simple as adding a field to the categories.
Maybe it makes more sense to add it to patterns instead and have a block editor setting for allowed pattern categories? 🤔 I'll have it think more about it..
( x, index, arr ) => | ||
index === arr.findIndex( ( y ) => x.name === y.name ) | ||
) | ||
.filter( ( cat ) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With only a check like that, any pattern that belongs to such categories(ex footers
) will still be present in post editor, but under uncategorized
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, thanks for highlighting!
This makes sense 👍
I like the idea of having allowed pattern categories. Patterns can already have categories, so would the work for this involve adding the new block editor setting? |
@mikachan Is this PR still relevant or can it be closed now? |
Going to close as inactive. |
What?
This adds the ability to filter Pattern Categories by editor type (post or site editor), as a small step to improving the pattern inserter experience.
Why?
Part of #44501
How?
Adds an
editors
key to the block patterns category controller, which accepts an array of allowed editors (core/post and/or core/site). Also adds an additional filter toblockPatternCategories
, which filters by editor type based on theeditors
key.Currently, the 'Headers' and 'Footers' categories have been restricted to only showing in the Site editor.
This PR also adds a description to the 'Banners' category, as it was previously missing.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast