我无法弄清楚为什么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
答案 0 :(得分:1)
这是我能做的最好的事情。我使用了tinymce.hide和tinymce.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;
}
});
<强> DEMO 强>
希望这有帮助