• Resolved rgfactory

    (@rgfactory)


    Hi Thomas,

    I have the same problem ( I can’t reply to this resolved issue), if I add an additional css class to a Katex block, it breaks the block rendering in the post edition page.

    Example : I add the class named “rgf-test” to the block, then after saving my post and reloading the page, I have the following message in the JS console :

    Block validation: Expected attribute "class" of value "wp-block-katex-display-block katex-eq", saw "wp-block-katex-display-block katex-eq rgf-test
    Block validation: Block validation failed for "katex/display-block"

    Wordpress => 5.4
    katex plugin version => 2.0.2
    theme => twenty-eleven => 3.4

    I hope you’re doing well.

    Thank you very much.

    RG Factory.

    PS : you can push the fix in development version if it’s more convenient, I will test it, just tell me.

    • This topic was modified 4 years, 7 months ago by rgfactory.
    • This topic was modified 4 years, 7 months ago by rgfactory.
    • This topic was modified 4 years, 7 months ago by rgfactory.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Thomas Churchman

    (@beskhue)

    Hi RG Factory,

    I’ve not been able to reproduce this issue.

    Does this (also) occur when creating a completely new post?

    Could you share the post’s code? In the editor, press the three vertical dots in the top right, and select “code editor”.

    Thread Starter rgfactory

    (@rgfactory)

    Hi Thomas,

    yes it happens when creating a completely new post.

    This is the post’s code :

    <!-- wp:paragraph -->
    <p>this is a test </p>
    <!-- /wp:paragraph -->
    
    <!-- wp:katex/display-block -->
    <div class="wp-block-katex-display-block katex-eq rgf-test" data-katex-display="true">\overrightarrow{OB} \begin{cases} x = v_0.\cos(\alpha).t
    \\ y = -\dfrac{1}{2}.g.t^2 + v_0.\sin(\alpha).t + h
    \end{cases}</div>
    <!-- /wp:katex/display-block -->
    Plugin Author Thomas Churchman

    (@beskhue)

    I unfortunately am still not able to reproduce this issue with the same versions of WordPress, this plugin, and the theme Twenty Eleven. The additional class is added as expected.

    However, the code your shared is immediately changed by WordPress to:

    <!-- wp:paragraph -->
    <p>this is a test </p>
    <!-- /wp:paragraph -->
    
    <!-- wp:katex/display-block {"className":"rgf-test"} -->
    <div class="wp-block-katex-display-block katex-eq rgf-test" data-katex-display="true">\overrightarrow{OB} \begin{cases} x = v_0.\cos(\alpha).t
    \\ y = -\dfrac{1}{2}.g.t^2 + v_0.\sin(\alpha).t + h
    \end{cases}</div>
    <!-- /wp:katex/display-block -->

    Note the addition of {"className":"rgf-test"}. Could you try whether this code does render inside the block editor?

    Thread Starter rgfactory

    (@rgfactory)

    Thomas,

    I tried your code with the className, but when I save the post the code is replaced by the one without the classname…

    But I figured out what is the problem (kind of…) : the wordpress framework Bedrock

    Yeah, I forgot to say this, I use the framework Bedrock.

    So here is what I did :
    Fresh install without Bedrock, your plugin works like a charm, you are right.
    Fresh install with Bedrock, this css custom class bug appears.

    I am a new user of Bedrock, so it will be difficult for me to find the origin of the bug…

    So for now I’am gonna use the classic WordPress, without Bedrock, it is not a problem at all.

    What do I do ? I mark as resolved, or do you wanna try to fix this Bedrock bug ?

    Thank you again Thomas.

    Plugin Author Thomas Churchman

    (@beskhue)

    I was able to reproduce the issue on Bedrock. I am not sure why the issue occurs on Bedrock and not on a “normal” WordPress install.

    Regardless, I believe I’ve fixed the issue. The fix is available in the development version: https://www.ads-software.com/plugins/katex/advanced/

    Please test it and let me know whether it works for you.

    Thread Starter rgfactory

    (@rgfactory)

    Hello Thomas,

    I tried with the development version (2.0.3) but it does not work on a fresh install of bedrock.

    The css custom class bug is still there.

    Plugin Author Thomas Churchman

    (@beskhue)

    Hi RG Factory,

    I made a mistake with the previous development version. Could you download the new development version and try again?

    Thread Starter rgfactory

    (@rgfactory)

    It works !

    Thank you very much.

    Did you figured out why this error only appeared in Bedrock ?

    Plugin Author Thomas Churchman

    (@beskhue)

    Thank you for the confirmation!

    I have not found out why it broke specifically for Bedrock. Bedrock uses the exact same WordPress 5.4 code as a “normal” install, so it probably has something to do with the WordPress configuration.

    I was able to ascertain the issue was caused by a Bedrock installation requiring className to be explicitly mentioned as an attribute on the KaTeX block, whereas in a “normal” install it was not required (and, I believed, that was how it was intended).

    I’ve not been able to tell what the specific difference between Bedrock and a normal install is that made this issue crop up, though.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘additonal CSS class, again’ is closed to new replies.