• Resolved hpr78

    (@hpr78)


    The following code is generated by other gutenberg blocks and is correctly saved in database.

    Prismatic disabled, the working code look like this:
    <div class="accordion"><input type="radio" id="accordion-1" name="accordion-group-1" hidden checked/><div class="accordion-body">

    Prismatic enabled, input is removed:

    <div class="accordion"><div class="accordion-body">
    <div class="columns">

    Version: 2.8
    WordPress: 5.7.2

    Settings:
    Library: Prism.js
    Block Styles: Enabled
    Prism.js Line Numbers: Enabled
    Copy to Clipboard: Enabled
    Limit to Posts: Enabled

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter hpr78

    (@hpr78)

    Found the problem in prismatic/inc/prismatic-core.php
    it wp_kses_post all the content, not only the prismatic specific content.

    
    function prismatic_decode($text) {
    // ...
    		$output .= $content;
    	}
    	return wp_kses_post($output);
    }
    

    It should be better to secure only the replaced content:

    function prismatic_decode($text) {
    // ...
    		$output .= wp_kses_post( $content );
    	}
    	return $output;
    }

    `

    Thread Starter hpr78

    (@hpr78)

    Or complete without wp_kses_post, cause before you esc_html the content.

    Plugin Author Jeff Starr

    (@specialk)

    Thanks for the infos and help, @hpr78. Will be looking into this (and the other recent escape-related issues soon.

    Plugin Author Jeff Starr

    (@specialk)

    @hpr78 What are the steps to repeat this issue? I am trying but failing to get the reported behavior. I have all the same settings that you’ve outlined. I have block editor enabled. But from there not sure which block(s) are involved, and in which order. If you can walk me through the steps to replicate the issue, I will be able to investigate asap. Thank you.

    Plugin Author Jeff Starr

    (@specialk)

    Update: after much investigation, I narrowed down the issue to one thing: the block editor force escapes left-angle brackets and other characters. I’ve tried many different things, ways of adding block elements and so forth, but so far nothing works.

    So, the plan is to ask for help from the WP community. I posted a forum topic here explaining the issue and asking for help. I’m not sure if it’s even possible to achieve. If it is, then Prismatic will continue to provide its own Gutenberg block. If not, then the block will be discontinued.

    If you or anyone has insight on how to add code snippets *raw* unescaped into a block, please let me know. Check the above-linked support topic for more details. Thank you.

    Thread Starter hpr78

    (@hpr78)

    In one of my gutenberg components i use RawHTML, if this is what you are looking for.

    
    import { RawHTML } from "@wordpress/element"
    //...
    return (
    <pre className={ classes }>
      <code className={ codeClasses }>
        <RawHTML>{ content }</RawHTML>
      </code>
    </pre>
    )
    
    • This reply was modified 3 years, 4 months ago by hpr78.
    • This reply was modified 3 years, 4 months ago by hpr78.
    • This reply was modified 3 years, 4 months ago by hpr78.
    • This reply was modified 3 years, 4 months ago by hpr78.
    Plugin Author Jeff Starr

    (@specialk)

    Thanks but the plugin doesn’t use any build step, how would you write that in vanilla JS?

    Plugin Author Jeff Starr

    (@specialk)

    Update: Finally figured it out, it was an issue with the render callback function.

    So that means Prismatic will continue to provide the same blocks as before, only without the weird code-escaping bug.

    Thanks for reporting, @hpr78.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Prismatic removes HTML Input-Tags’ is closed to new replies.