-
Notifications
You must be signed in to change notification settings - Fork 7
Description
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.