skip to Main Content

I have installed TinyMCE cloud on my WordPress front-end comments. Now, I use it on WordPress and when I submit new post or edit existing post I lose formats I added before submit.

Please check the images:

Screenshot 1:

Writing content, each block of text added between <p></p>.

enter image description here

Screenshot 2:

When submit the form the content and all text combined inside one <p></p> and the normal <p> replaced with <br>

enter image description here

Screenshot 3:

When editing the post the content also combined as 1 paragraph and ignoring all formats I added.

enter image description here

Can you please let me know how to resolve that?

Thank you

2

Answers


  1. Chosen as BEST ANSWER

    I figured it our, the issue was due to these functions:

    /* Kses stip */
    if (!function_exists('wpqa_kses_stip')) :
        function wpqa_kses_stip($value,$ireplace = "",$p_active = "") {
            return wpqa_deslash(wp_kses(($ireplace == "yes"?str_ireplace(array("<br />","<br>","<br/>","</p>"), "rn",$value):$value),wpqa_html_tags(($p_active == "yes"?$p_active:""))));
        }
    endif;
    
    /* Kses stip wpautop */
    if (!function_exists('wpqa_kses_stip_wpautop')) :
        function wpqa_kses_stip_wpautop($value,$ireplace = "",$p_active = "") {
            return wpqa_deslash(wpautop(wp_kses((($ireplace == "yes"?str_ireplace(array("<br />","<br>","<br/>","</p>"), "rn",$value):$value)),wpqa_html_tags(($p_active == "yes"?$p_active:"")))));
        }
    endif;
    

    When disabled, the TinyMCE worked as normal.


  2. One solution is, if you’re copying in content, is to switch on the TinyMCE power paste plugin. This can help control what HTML is going into your textarea.

    It looks like this could be an issue with the power paste plugin if you already have it running. the Power Paste plugin might be applying merge formats. The option merges identical text format elements. The goal is to reduce the number of HTML elements in text. The plugin may be merging the paragraphs together when the document is published.

    tinymce.init({
      selector: 'textarea', 
      plugins: 'powerpaste',
      menubar: 'edit',
      toolbar: 'pastetext',
      paste_as_text: false, //change this to false if you have power paste enabled to stop merging tags
    });
    

    Something to help diagnose what’s going on here is to turn on the Tiny Code plugin. This is one of the
    Open Source plugins. You can add it to your toolbar to open a dialog and see exactly what is happening
    with the HTML:

    tinymce.init({
      selector: 'textarea',  // change this value according to your HTML
      plugins: 'code',
      toolbar: 'code',
      menubar: 'tools'
    });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search