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

Empty check for Gutenberg blocks #1388

Open
2 tasks
chindris opened this issue Jul 3, 2023 · 0 comments
Open
2 tasks

Empty check for Gutenberg blocks #1388

chindris opened this issue Jul 3, 2023 · 0 comments

Comments

@chindris
Copy link
Contributor

chindris commented Jul 3, 2023

We do not have currently an easy way to check that a Gutenberg block is actually empty. This would useful in case there are editor blocks which are displayed conditionally in the editor (like for example the case highlighted here : #1387 , the user could activate the setting and then deactivate it, which basically would create the additional blocks in the document). Also, we could just filter out empty blocks on parsing, to not create empty placeholders in the frontend.

One possible option would be to put a new method in the GutenbergValidator plugins, like isEmpty(), so we don't necessarily need another plugin manager. And, only if needed, we could place a utils function that would be a wrapper for instantiating the validation plugin manager and calling the isEmpty() method on a block.

Tasks:

  • Implement an 'isEmpty()' method for Gutenberg blocks.
  • Filter out empty blocks on parsing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant