1

我无法弄清楚为什么 tinyMCE 不会在切换块上执行。

Javascript:

$(document).ready(function(){

    // Turn ON tinyMCE for every .tiny_editor
    tinyMCE.init({  
        language : 'es',
        mode: 'textareas',
        editor_selector : "tiny_editor",
        theme: 'advanced',

        theme_advanced_toolbar_align: 'left',
        theme_advanced_toolbar_location: 'top',
        theme_advanced_statusbar_location: 'bottom',

        plugins: 'table,advhr,advlink,preview,advimage,media,searchreplace,print,fullscreen',

        theme_advanced_buttons1: 'bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,outdent,indent,|,fontselect,fontsizeselect,forecolor,backcolor',
        theme_advanced_buttons2: 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,undo,redo,|,link,unlink,anchor,advhr,|,sub,sup,|,charmap,image,media,|,cleanup,removeformat,code,fullscreen',
        theme_advanced_buttons3: 'tablecontrols,|,preview,print,|,help',

        extended_valid_elements: 'iframe[align<bottom?left?middle?right?top|class|frameborder|height|id|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style|title|width]'
    });

        // Clear checkbox
    $('.entradilla_check').attr('checked', false);
        // On checkbox value change (set or not), toggle .entradilla_box
    $('.entradilla_check').change(function(){
        $('.entradilla_box').toggle('slow');
    });

});

HTML:

<textarea style="width: 100%; height: 200px; display: none;" name="entradilla" class="tiny_editor entradilla_box">
    <?=$news_row['abstract'];?>
</textarea>

切换有效,但是当 textarea 显示时...它显示时没有 tinymce

4

1 回答 1

1

这是我能做的最好的。我使用了 tinymce.hidetinymce.show

显示

隐藏编辑器并显示编辑器应该替换的任何 textarea/div。

隐藏

显示编辑器并隐藏编辑器应该替换的任何 textarea/div。

var tinymcevisible = true;
$('#show').click(function() {
    if (tinymcevisible) {
        tinyMCE.get('second').hide();
        $('#second').hide();
        tinymcevisible = false;
    } else {
        tinyMCE.get('second').show();
        tinymcevisible = true;
    }
});

演示

希望这可以帮助

于 2012-05-21T02:48:56.917 回答