• Cerddaf

    (@cerddaf)


    I’ve found a logical bug in the Multiple Content Blocks plugin.

    It started off Here , but I’ve tracked it down to a problem with the re-formatting for display of the data to be output.

    All text data to be output to an edit window goes through the function “the_editor” in general-template c line 1660.
    Depending which editor is being used (html or richedit) the data is sent to one of two reformatting procedures wp-htmledit-pre or wp-richedit-pre.

    However the “editor being used” is set by the last time anyone clicked any Visual /wysiwyg or html edit tab. So all data for all boxes is reformatted according to this last edit mode. But only the first edit box has its Visual/html tab set according to last edit mode, the others are all set to Wysiwyg/Visual.

    So if the last tab click was to switch to html on any edit box, then any refresh of submit will result in the first edit box being set to html and receiving data formatted for the html editor, but all other boxes being set to Wysiwyg/Visual editor but receiving data formatted for the html editor.

    Anyone else met this, and have a fix?

Viewing 1 replies (of 1 total)
  • Thread Starter Cerddaf

    (@cerddaf)

    I found a fix which works (at least I’ve not managed to break it yet)

    Add a new call to admin_head hook to force editor in stored cookies to be tinymce, so everything is always output formatted (not raw htlm), regardles of the format in which it came in.

    Here is the code, complete with the commented out diagnostics.

    function multiplecontent_css() {
    /* force tinymce as editor for the additional blocks */
        force_tinymce();    <======== add this line
    
        echo '
        <style type="text/css">
            .js .theEditor, #editorcontainer #content {
                color: #000 !important;
                width: 100%;
            }
        </style>
        ';
    }
    
    /**
    force tinymce as editor
    */
    function force_tinymce() {    <===== add this function
        global $_updated_user_settings;
    //echo("<br /> force_tinymce: ");
    
        if ( ! $user = wp_get_current_user() )  return ;
    
        $OldCookie = $_COOKIE['wp-settings-' . $user->ID];
        $NewCookie = str_replace( 'html', 'tinymce', $OldCookie );
        $_COOKIE['wp-settings-' . $user->ID] =  $NewCookie;
    
    //echo("<br /> OldCookie: "); print_r($OldCookie); echo("<br />");
    //echo("<br /> NewCookie: "); print_r($NewCookie); echo("<br />");
        $ChgCookie = $_COOKIE['wp-settings-' . $user->ID];
    //echo("<br /> ChgCookie: "); print_r($ChgCookie); echo("<br />");
    
        return;
    }
Viewing 1 replies (of 1 total)

The topic ‘formatting problems editting with Multiple content blocks’ is closed to new replies.