liip / bootstrap-blocks-wordpress-plugin

Bootstrap Gutenberg Blocks for WordPress
https://wordpress.org/plugins/wp-bootstrap-blocks/
279 stars 60 forks source link

Strange className encoding #61

Closed forcecodema closed 3 years ago

forcecodema commented 3 years ago

Hi,

Double minus sign in className property is encoded in the following way:

<!-- wp:wp-bootstrap-blocks/column {"className":"offer-deep\u002d\u002dimg_wrapper"} -->

className entered in editor is offer-deep--img_wrapper

Regards,

Michal

tschortsch commented 3 years ago

Hmm we're actually using the official className attribute of Gutenberg. But I will look into that.

tschortsch commented 3 years ago

This looks like the default behavior of the editor. It also happens with core blocks. I tried it with the core/paragraph block:

<!-- wp:paragraph {"className":"test\u002d\u002dclass test-class"} -->

It seems that a double dash gets encoded with unicode characters when saved in the className attribute. But the output on the page seems to be correct again:

<p class="test--class test-class">
openmindculture commented 1 year ago

So this encoding is not mandatory to keep when persisting the code in a block pattern file.