Gutenberg: Group Block - custom markup filtering option

Created on 16 Apr 2019  路  8Comments  路  Source: WordPress/gutenberg

Suggestion for improvement regarding the Group block:

  • custom markup filtering option (to change <div> -> <section>, add a wrap element between Group block and content, and etc.)

Your thoughts, please.

[Block] Group [Type] Enhancement

All 8 comments

Isn't there a generic block markup filtering chain in place already @paulkirspuu have you researched?

Isn't there a generic block markup filtering chain in place already @paulkirspuu have you researched?

I have, didn't find a filtering option unfortunately.

@paulkirspuu ping Slack #core-editor perhaps, as well.

About the wrapper between the group block and the content: issue #15042 goes deeper into that

The section block of the Ultimate Addons for Gutenberg plugin offers the possibility to switch the html-tag:

image

https://github.com/brainstormforce/ultimate-addons-for-gutenberg/tree/master/src/blocks/section

In the meantime, the blocks.getSaveElement filter can be used to change the HTML tags.

I don't think giving everyday users an option to change the HTML tag makes sense. They would not know what to do with that.

Tyvm. @paulkirspuu lmk what you can do w/ this filter.

But this means when a theme is switched, all pages have to be opened in page editor and re-saved so the blocks.getSaveElement filter can update the markup? Wouldn't it be better to have an intermediate layer that can change the markup on editor page and frontend, without affecting the stored editor content?

Was this page helpful?
0 / 5 - 0 ratings