• Resolved cknowles

    (@cknowles)


    When adding/editing text in a Text Block, pressing shift-enter inserts a line break ().

    After publishing/updating the page containing the Text Block, this line break can be seen on the front end of the site, as expected and desired.

    However, if one updates the page again, all tags are stripped out, ruining the desired formatting.

    I’m not sure if this is a King Composer issue, a TinyMCE issue, or something to do with WordPress’s wpautop function. Does anyone know of a way to fix it?

    https://www.ads-software.com/plugins/kingcomposer/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter cknowles

    (@cknowles)

    Thread Starter cknowles

    (@cknowles)

    Resolved.

    Thread Starter cknowles

    (@cknowles)

    Actually, that code broke any TinyMCE editors outside of King Composer (e.g. posts, custom post types, pages not using King Composer). This works:

    // stop TinyMCE from removing <br> tags
    function cyqBK19O_tinymce_fix($in) {
        //don't remove line breaks
        $in['remove_linebreaks'] = false;
    
        // convert newline characters to BR
        $in['convert_newlines_to_brs'] = true;
    
        // don't remove redundant BR
        $in['remove_redundant_brs'] = false;
    
        return $in;
    }
    add_filter( 'tiny_mce_before_init', 'cyqBK19O_tinymce_fix' );
    Plugin Author king-theme

    (@kingthemes)

    Hi!

    This issue is very serious, I am checking all of your post now.

    Thank you!

    Plugin Author king-theme

    (@kingthemes)

    I tested so many time, step by step as your post. But I still can not see that trouble. ( clean & newest WordPress + tweenty theme )

    I think that issue may be caused by some of 3rd party theme or plugin.

    By the way, I added your code into the core of plugin ( new version 2.3.8 ) to ensure that this error will not happen in the future in any case.

    One again, Thank you so much!

    For the record, this actually IS a problem with TinyMCE. If you do a lot of switching between visual and text view in the WP editor, you will probably notice it. TinyMCE messes up a lot of HTML code. Also, if you have a <div> element without a class or ID assigned, it will strip the div tags. And it REALLY doesn’t like nested tables.

    Anything you can add to prevent this is appreciated. It’s one of those things that has been a problem in WordPress for years because of their use of TinyMCE. Not sure if it is a problem in the core TinyMCE, or just how WordPress itself uses it. But it is a problem.

    Brent

    Second that ??

    Certainly an issue with most page builders actually – any update would be great

    Plugin Author king-theme

    (@kingthemes)

    Apologies you guys, this is my mistakes.

    I could not find the bug to fix until a developer help me. And I’ve fixed it thoroughly in version 2.3.9.2

    Please update the plugin.

    Just to clarify above, this isn’t just a problem with page builders. It is a core problem with the editor in WordPress itself. All page builders suffer from it because they use the WP builder, which is a modified TinyMCE. But even without a builder, you will get the same annoying problem.

    One of the reasons, I believe, is because the “text” editor is NOT designed to be a code editor. It is supposed to be exactly what it says, a text editor. So any “code” it sees that doesn’t seem to have a purpose(such as a div tag without a class or ID assigned) are stripped. It strips out paragraph and break tags as well because it handles them based on line breaks automatically. But they don’t take into account that some people may actually want code in there for specific reasons.

    On the front end, the “code” of paragraphs and breaks are still there. They are just handled differently in the backend. And I personally wish they would make this optional so that you really COULD use the text tab as a code editor without having to install a plugin.

    It doesn’t seem to be something that is in the works though, unfortunately.

    Brent

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Line break (br) tags are stripped from Text Blocks’ is closed to new replies.