Skip to content

Empty check for Gutenberg blocks #1388

@chindris

Description

@chindris

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions