Add: Mechanism to detect if a block instance matches a global styles selector - #26945
Merged
jorgefilipecosta merged 1 commit intoNov 13, 2020
Conversation
jorgefilipecosta
requested review from
Soean,
TimothyBJacobs,
ajitbohra,
ellatrix,
spacedmonkey and
talldan
as code owners
November 12, 2020 18:17
|
Size Change: +240 B (0%) Total Size: 1.19 MB
ℹ️ View Unchanged
|
oandregal
force-pushed
the
try/extract-theme-json-processor
branch
from
November 13, 2020 09:26
aee8a21 to
77d626a
Compare
jorgefilipecosta
force-pushed
the
add/mechanism-to-detect-if-a-block-instance-is-being-affected-by-global-styles-selector
branch
from
November 13, 2020 12:37
82c572e to
9ce8161
Compare
oandregal
approved these changes
Nov 13, 2020
oandregal
left a comment
Member
There was a problem hiding this comment.
This is nice!
A few minor things that I'd like us to address are:
- make the title key mandatory for all blocks that use this new mechanism (not having the key is only useful for the heading block)
- add some checkings for those keys (title, selector, attributes) being present
I'm pre-approving because I'm eager to get this in and don't want you to be blocked by my review.
Member
|
Unsure how this should be advertised, though. Although it's experimental, if there're third-parties testing this already, how do make sure they know about this? Add a note into the block-library changelog, perhaps? |
jorgefilipecosta
force-pushed
the
add/mechanism-to-detect-if-a-block-instance-is-being-affected-by-global-styles-selector
branch
from
November 13, 2020 16:38
9ce8161 to
eed7d5f
Compare
jorgefilipecosta
deleted the
add/mechanism-to-detect-if-a-block-instance-is-being-affected-by-global-styles-selector
branch
November 13, 2020 17:10
This was referenced Nov 16, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alternative to #24423.
This PR adds a mechanism to detect at run time if global styles selector affects a given block instance.
Basically, the selector defines a set of attributes and we consider a block matches a selector if all the attributes defined in the selector have the same value on the block.
How has this been tested?
I added the following information to the theme.json
I created a new post.
I added a heading block.
I verified that the available colors change depending on if I select heading levels 1 or 2.