-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Stretchy text: Hide variations in Block Inspector (hack) #73238
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
Conversation
|
Size Change: +127 B (+0.01%) Total Size: 2.41 MB
ℹ️ View Unchanged
|
Follow-up of #73056 Workaround for WordPress 6.9. See comment in the patch.
4d58cd2 to
997a1db
Compare
|
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. |
| ); | ||
| } else if ( blockName === 'core/heading' ) { | ||
| return unfilteredVariations.filter( | ||
| ( v ) => v.name !== 'heading' && v.name !== 'stretchy-heading' |
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.
Although a very hypothetical edge case This may bring issues for third party extenders. Imagine the following scenario:
Someone implemented a "Strong heading" variation, and also a default heading variation as we are doing to allow toggling between default and there custom variation. Our code will remove the default, and from now on users can only transform to "Strong heading" without possibility to go back to default.
I guess we should remove both variations if they are the only two variations on the block, otherwise we could just remove stretchy versions.
When we are with the Stretchy variation active we remove all the variations so it looks like a different block and we never show the heading variations.
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.
This is a very good point. Addressed.
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.
Actually, can't push due to GitHub service issues. :/ Pushed.
|
Did we consider adding more specific flags to the variations API to indicate clearly where we want them to appear? |
… that may be registered for Paragraph and Heading.
This is the question I asked in another PR, but to me this is a line of exploration we definitely need but for after 6.9. I don't think it's wise to rush an API extension just for this. |
| } else if ( blockName === 'core/heading' ) { | ||
| if ( | ||
| activeBlockVariation?.name === 'stretchy-heading' || | ||
| unfilteredVariations.every( ( v ) => | ||
| [ 'heading', 'stretchy-heading' ].includes( v.name ) | ||
| ) | ||
| ) { | ||
| return []; | ||
| } | ||
| return unfilteredVariations.filter( | ||
| ( v ) => v.name !== 'stretchy-heading' | ||
| ); | ||
| } | ||
| return unfilteredVariations; |
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.
Though this block just duplicates the same logic for headings, I prefered not to refactor: I want the strings of the block types and variation names to be static so that they can be searched easily.
This stretched what was possible with the current API's. We probably need additional flags on the variations, probably some flag like "treat as independent block" that changes the inserter order to be seen independently from the block, and to remove the transforms may work for the two hacks we have. But it is probably better not to rush in a last minute api. |
jorgefilipecosta
left a comment
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.
Worked well for me 👍 Thank you for working on this.
* Stretchy text: Hide variations in Block Inspector (hack) Workaround for WordPress 6.9. See comment in the patch. Co-authored-by: mcsf <[email protected]> Co-authored-by: jorgefilipecosta <[email protected]> Co-authored-by: youknowriad <[email protected]>
|
I just cherry-picked this PR to the wp/6.9 branch to get it included in the next release: e7f0dea |
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/. - [Block Bindings: Add unit test coverage for `core/post-data` source](WordPress/gutenberg#73055) - [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585) - [Notes: Collapse note on blur](WordPress/gutenberg#73158) - [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324) - [Fix navigation tag entity binding](WordPress/gutenberg#73255) - [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345) - [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327) - [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325) - [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173) - [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241) - [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177) - [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238) - [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189) - [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164) Developed in #10528. See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches. Fixes #64267. Props priethor. git-svn-id: https://develop.svn.wordpress.org/trunk@61262 602fd350-edb4-49c9-b593-d223f7449a82
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/. - [Block Bindings: Add unit test coverage for `core/post-data` source](WordPress/gutenberg#73055) - [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585) - [Notes: Collapse note on blur](WordPress/gutenberg#73158) - [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324) - [Fix navigation tag entity binding](WordPress/gutenberg#73255) - [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345) - [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327) - [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325) - [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173) - [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241) - [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177) - [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238) - [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189) - [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164) Developed in WordPress/wordpress-develop#10528. See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches. Fixes #64267. Props priethor. Built from https://develop.svn.wordpress.org/trunk@61262 git-svn-id: http://core.svn.wordpress.org/trunk@60574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/. - [Block Bindings: Add unit test coverage for `core/post-data` source](WordPress/gutenberg#73055) - [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585) - [Notes: Collapse note on blur](WordPress/gutenberg#73158) - [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324) - [Fix navigation tag entity binding](WordPress/gutenberg#73255) - [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345) - [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327) - [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325) - [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173) - [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241) - [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177) - [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238) - [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189) - [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164) Developed in WordPress/wordpress-develop#10528. See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches. Fixes #64267. Props priethor. Built from https://develop.svn.wordpress.org/trunk@61262 git-svn-id: https://core.svn.wordpress.org/trunk@60574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/. [Block Bindings: Add unit test coverage for core/post-data source](WordPress/gutenberg#73055) [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585) [Notes: Collapse note on blur](WordPress/gutenberg#73158) [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324) [Fix navigation tag entity binding](WordPress/gutenberg#73255) [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345) [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327) [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325) [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173) [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241) [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177) [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238) [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189) [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164) Developed in #10528. See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches. Reviewed by davidbaumwald. Merges [61262] to the 6.9 branch. Props priethor, ellatrix. See #64267. git-svn-id: https://develop.svn.wordpress.org/branches/6.9@61263 602fd350-edb4-49c9-b593-d223f7449a82
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/. [Block Bindings: Add unit test coverage for core/post-data source](WordPress/gutenberg#73055) [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585) [Notes: Collapse note on blur](WordPress/gutenberg#73158) [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324) [Fix navigation tag entity binding](WordPress/gutenberg#73255) [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345) [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327) [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325) [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173) [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241) [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177) [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238) [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189) [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164) Developed in WordPress/wordpress-develop#10528. See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches. Reviewed by davidbaumwald. Merges [61262] to the 6.9 branch. Props priethor, ellatrix. See #64267. Built from https://develop.svn.wordpress.org/branches/6.9@61263 git-svn-id: http://core.svn.wordpress.org/branches/6.9@60575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
A few moments ago I noticed in the slash dropdown for blocks the stretchy Paragraph and Heading. I tested it out and found it weird that it was so prominent. I believe that is what has been addressed in this PR. |
I will try to look into an enhacement. cc: @jorgefilipecosta (to make it appear on the mentioned to notifications) |
|
Let's also not forget to look into removing these hacks post 6.9 |
)" This reverts commit 767fcef.
)" This reverts commit 767fcef.

Follow-up of #73056.
Best read with whitespace ignored.
Implementing Stretchy Paragraph and Stretchy Heading as block variations makes them too prominent in the editor for what they are. This was already known in the base PR, but was worth the tradeoffs. One workaround done in the base PR was to patch
getInserterItemsto push the variations down the list. This PR applies the same idea to block transformations, so that they are still available but not via the block inspector: