-
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
Block Variations: Detect active variation correctly based on RichText attribute #62325
Block Variations: Detect active variation correctly based on RichText attribute #62325
Conversation
Size Change: +15 B (0%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
03f14d9
to
137323d
Compare
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 tested it and looks good.
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.
That looks good on the code side of things. Great to see this regression fixed 👍🏻
Thank you very much, folks! Going to merge, since failing performance tests seem to be unrelated. |
… attribute (#62325) If a block variation has an `isActive` property that is an array of strings (i.e. attribute names), and one of the attributes referenced therein is a `RichText` value, compare the given `RichText` string correctly to the given block's. (This applies also to nested attributes, i.e. if a `RichText` value is contained in an object (that might be contained in another, and so on) inside an attribute.) Co-authored-by: ockham <[email protected]> Co-authored-by: cbravobernal <[email protected]> Co-authored-by: gziolo <[email protected]>
I just cherry-picked this PR to the release/18.5 branch to get it included in the next release: 5fcb3ee |
… attribute (#62325) If a block variation has an `isActive` property that is an array of strings (i.e. attribute names), and one of the attributes referenced therein is a `RichText` value, compare the given `RichText` string correctly to the given block's. (This applies also to nested attributes, i.e. if a `RichText` value is contained in an object (that might be contained in another, and so on) inside an attribute.) Co-authored-by: ockham <[email protected]> Co-authored-by: cbravobernal <[email protected]> Co-authored-by: gziolo <[email protected]>
… attribute (#62325) If a block variation has an `isActive` property that is an array of strings (i.e. attribute names), and one of the attributes referenced therein is a `RichText` value, compare the given `RichText` string correctly to the given block's. (This applies also to nested attributes, i.e. if a `RichText` value is contained in an object (that might be contained in another, and so on) inside an attribute.) Co-authored-by: ockham <[email protected]> Co-authored-by: cbravobernal <[email protected]> Co-authored-by: gziolo <[email protected]>
… attribute (WordPress#62325) If a block variation has an `isActive` property that is an array of strings (i.e. attribute names), and one of the attributes referenced therein is a `RichText` value, compare the given `RichText` string correctly to the given block's. (This applies also to nested attributes, i.e. if a `RichText` value is contained in an object (that might be contained in another, and so on) inside an attribute.) Co-authored-by: ockham <[email protected]> Co-authored-by: cbravobernal <[email protected]> Co-authored-by: gziolo <[email protected]>
This was cherry-picked to the wp/6.6 branch. |
What?
If a block variation has an
isActive
property that is an array of strings (attribute names), and one of the attributes referenced therein is aRichText
value, compare the givenRichText
string correctly to the given block's.Why?
Block variations aren't currently recognized as active if one of the distinguishing attributes is a RichText value, see #62031 (comment).
How?
By translating the
RichTextData
object received from the given block's attributes to an HTML string, viaRichTextData.toHTMLString()
.Testing Instructions
Apply the following patch to create a variation of the Paragraph block:
Then, create a new post and insert a Paragraph block in the editor that matches the variation -- e.g. by switching to the Code Editor and pasting the following markup:
In the Block Inspector, verify that the variation is correctly recognized as "Warning with color" (rather than "Paragraph").
Note that if you make any modification to that block (e.g. change the text or formatting), it will no longer be recognized, and will show up as "Paragraph" block in the Block Inspector insted.
Screenshots or screencast