bobbingwide / oik-css

[bw_css] shortcode for internal CSS styling
https://www.oik-plugins.com/oik-plugins/oik-css
0 stars 0 forks source link

Support for WordPress 5.0 and the new editor - Gutenberg #9

Closed bobbingwide closed 4 years ago

bobbingwide commented 6 years ago

Since early 2017 a new editor has been under development. Code named Gutenberg this new editor is being developed as a feature plugin. It is expected to be merged into core for WordPress 5.0.

We need to be aware of Gutenberg and to attempt to be compatible with it. Actually, it's the other way round. Gutenberg needs to be backward compatible with us.

According to Gutenberg's README.

Posts are backwards compatible, and shortcodes will still work.

That's not the case right now.

The following shortcodes, which depend on the new line character being respected in content, may not work correctly after being manipulated by the Gutenberg editor [bw_css] [bw_geshi]

Area Problem Reference / Solution
bw_geshi Unexpected <br /> tags in output gutenberg_autop needs to be removed from priority 8
bw_css Seems OK

Analysis

The reason we see br's for the [bw_geshi] output is because gutenberg_wpautop() introduces them but bw_geshi() doesn't strip them. We don't see them in [bw_css] because the oik_css() function removes them using bw_remove_unwanted_tags().

bobbingwide commented 6 years ago

Note: The problem with [bw_geshi] is demonstrated at https://herbmiller.me/getting-access-files/ With Gutenberg 2.6.0, since it’s running oik-css v0.9.0. See if Gutenberg 2.7.0 makes any difference then build and install oik-css v0.9.1 if it doesn’t.

bobbingwide commented 6 years ago

Gutenberg v2.7.0 didn't make a difference, so I've applied oik-css v0.9.1

bobbingwide commented 5 years ago

<br /> stripping is not working with WP 5.0-RC3 and Gutenberg 4.6.1 on s.b/oikcom. It seems almost impossible to prevent the Block editor from adding a whole load of unwanted p's and br's even when using the code editor to edit a Classic block.

The solution would appear to be to create a Geshi block, similar to the CSV and CSS blocks prototyped in https:/github.com/bobbingwide/oik-blocks.

bobbingwide commented 5 years ago

As noted in https://github.com/bobbingwide/oik-blocks/issues/18#issuecomment-446944075 the GeSHi block needs to accept a default value of none for the lang parameter.

bobbingwide commented 4 years ago

In order to be able to close this I either have to release oik-blocks formally, or add the relevant blocks to each plugin. I.e. Add the CSS and GeSHi blocks to oik-css.

bobbingwide commented 4 years ago

OK, so I've prototyped adding the CSS and GeSHi blocks to oik-css. I used a prefix of oik-css; oik-blocks uses oik-block. So the blocks will coexist peacefully. Now do have to consider implementing a transform?

bobbingwide commented 4 years ago

And what do I have to do about oik-css saying it's dependent upon oik?

bobbingwide commented 4 years ago

Note: The transform from logic added to allow transform from core/paragraph, core/code and core/preformatted was done incorrectly and prevented the transform from oik-block/css.

bobbingwide commented 4 years ago

This was released in v1.0.0 on 30th January 2020. Better late than never?