Skip to content
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 transformations only going in one direction #52584

Open
AlchemyUnited opened this issue Jul 12, 2023 · 1 comment
Open

Block variations transformations only going in one direction #52584

AlchemyUnited opened this issue Jul 12, 2023 · 1 comment
Labels
[Block] Paragraph Affects the Paragraph Block Needs Testing Needs further testing to be confirmed. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. [Type] Bug An existing feature does not function as intended

Comments

@AlchemyUnited
Copy link

Description

I have two variations of core/paragraph. For the sake of this issue, I'll call them Blue Paragraph and Red Paragraph. I can, via scope (in erach variation), add the select in the block setting pallet (in the right sidebar) for picking a variation. Via that select, I can transform from core/paragraph, Blue paragraph or Red paragraph to Blue or Red, but not to core. That is, for example, I can't transform from Blue Paragraph back to the core/paragraph.

I've read the following looking for a solution:

#26687

https://gutenberg.10up.com/reference/Blocks/block-variations/

https://developer.wordpress.org/block-editor/reference-guides/block-api/block-variations/

https://richtabor.com/block-variations/

And didn't see any mention of how to do this. Maybe it's not a code bug, but a documentation bug in that it's not explained how to achieve this?

It may help to know, my hope is to setup very specify blocks & variations that reflect the client's style guide. Yes, I understand I can define a color pallet, but there's currently no way to control color combos within that set of colors; specific combos that are defined in the brand style guide. In addition, this enables the client's team to focus on content and layout and not have to worry - at all - about maintaining the style guide. The blocks and block variations limit them, in a good and desired way.

Step-by-step reproduction instructions

Here's a quick & dirty of my two (test) variations:

wp.blocks.registerBlockVariation( 'core/paragraph', {
    name: 'custom',
     title: __( 'Blue Paragraph' ),
     description: __( 'My new Blue Paragraph' ),
    attributes: { providerNameSlug: 'custom', className: 'is-style-blue-p4' },
    scope: [ 'inserter', 'transform' ],
});

wp.blocks.registerBlockVariation( 'core/paragraph', {
    name: 'custom2',
     title: __( 'Red Paragraph' ),
     description: __( 'My new Red Paragraph' ),
    attributes: { providerNameSlug: 'custom2', className: 'is-style-red-p1' },
    scope: [ 'block', 'inserter', 'transform' ],
});

Screenshots, screen recording, code snippet

No response

Environment info

Latest version of WP, not using the Gutenberg plugin.

Firefox on Win 10 Pro, tho' I don't feel these are part of the problem.

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@jordesign jordesign added [Type] Bug An existing feature does not function as intended Needs Testing Needs further testing to be confirmed. [Block] Paragraph Affects the Paragraph Block labels Jul 12, 2023
@github-actions
Copy link

Hi,
This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
Thanks for helping out.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Paragraph Affects the Paragraph Block Needs Testing Needs further testing to be confirmed. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants