-
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
useEditorFeature: take block context into account #24416
Conversation
Size Change: +32 B (0%) Total Size: 1.17 MB
ℹ️ View Unchanged
|
I'm thinking we may want to change the algorithm, so the theme can override the block.json defaults. Something like this makes more sense to me:
|
@nosolosw I was going to suggest this too #24416 (comment) :) Also, I've been wondering whether the "core's" theme.json file is needed at all? What's its purpose I'm not sure I understand it personally. |
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've been thinking more about the priorities here and I think there are very rare use-cases where block.json would actually impact whether a feature is enabled or not, it's more to define that a block supports a feature than to actually enable or disable it.
So I think this PR is good enough to start and we can iterate on the priorities as we explore concrete use-cases.
Those are questions that I also have:
|
Yeah for 2, it seems we should keep it for now and see how it evolves. Maybe as you suggest it just becomes the way for Core to define whether a config is opt-in or opt-out. For 1, you're right that we should change the algorithm in that case.. Here's what I think:
So block.json defines that a block accepts that feature, and theme.json decides to hide it or show it. And each feature can be opt-in (disabled by default) or opt-out (enabled by default for blocks that support it). How's that sound? |
bcebcb4
to
e2c70a1
Compare
Related #20588
Follows-up #24275
Partially fixes #22657
This PR makes
useEditorFeature
to take into account the block context data to decide whether a feature should be enabled or not.This is the current algorithm to decide what value to take:
core/paragraph
) of the theme's config? If so, take this value.core/paragraph
) of the core's config? If so, take this value.global
section of the theme's config? If so, take this value.global
section of the core's config? If so, take this value.Test
Using a theme that supports global styles:
You can use the demo theme at https://github.com/nosolosw/global-styles-theme/pull/12 as a testbed. The expected result is that custom colors are disabled for every block except paragraph.
Follow-up tasks: