Using 2 HTML blocks in Gutenberg to wrap content with div


I’m trying to wrap a Gutenberg block with a div with class x.

The structure I’m using looks like this:

  • HTML Block (<div class="x">)
  • Other Block(s)
  • HTML Block (</div>)

In the frontend, all works as expected, but in the Editor, when saving and reloading, it will popup the “This block contains unexpected or invalid content” error in both HTML blocks.

I assume the editor considers the code is wrong, cause the first one is not closed, and the second one is not open.
Is there another cleaner/better way of doing this? Shouldn’t I be able to write HTML in the blocks that are not necesserely self-contained?

Eric Mitjans 2 years 2021-04-05T12:59:50-05:00 0 Answers 0 views 0

Leave an answer