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

Ability to exclude the blocks from Post Editor but include them in the Template Editor #40780

Closed
dinhtungdu opened this issue May 3, 2022 · 2 comments
Labels
Developer Experience Ideas about improving block and theme developer experience [Feature] Block API API that allows to express the block paradigm. [Feature] Template Editing Mode Related to the template editor available in the Block Editor [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Enhancement A suggestion for improvement.

Comments

@dinhtungdu
Copy link
Contributor

dinhtungdu commented May 3, 2022

What problem does this address?

In woocommerce/woocommerce-blocks#6342, the Mini Cart block is excluded from the Post Editor and included in other screens. But if the store admins edit a page template using the edit link in the Templates Panel (which opens a Template Editor), the popup editor doesn't include the Mini Cart block because the screen is still the post edit screen.

I tried using the editor context with the allowed_block_types_all filter to register blocks conditionally but it doesn't work with the embedded Template Editor, the filter is only fired for the initial load when the admins edit a post/page.

What is your proposed solution?

A way to filter the blocks list for the embed Template Editor inside Post Editor.

@annezazu annezazu added [Type] Enhancement A suggestion for improvement. [Feature] Template Editing Mode Related to the template editor available in the Block Editor Developer Experience Ideas about improving block and theme developer experience labels May 4, 2022
@gziolo gziolo added the [Feature] Block API API that allows to express the block paradigm. label Feb 3, 2023
@gziolo
Copy link
Member

gziolo commented Feb 20, 2023

@dinhtungdu, a similar issue #46900 exists that proposes an option to register a block only in a specific editor. Is there anything unique in this proposal, or can we close it and add your use case and findings about allowed_block_types_all as a comment?

Edit: I see this one was filed earlier, but the other one gained more feedback so we would have to at least connect those two items together.

@dinhtungdu
Copy link
Contributor Author

Is there anything unique in this proposal, or can we close it and add your use case and findings about allowed_block_types_all as a comment?

Make sense, closing in favor of #46900

@gziolo gziolo added the [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed label Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Experience Ideas about improving block and theme developer experience [Feature] Block API API that allows to express the block paradigm. [Feature] Template Editing Mode Related to the template editor available in the Block Editor [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants