2012-05-20 3 views
1

토글 된 블록에서 tinyMCE가 실행되지 않는 이유를 알 수 없습니다.tinymce가 토글 내에서 작동하지 않습니다.

자바 스크립트 :

$(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> 

토글이 작동하지만, 텍스트 영역이 ... 표시하는 경우는 TinyMCE에없이 보여줍니다

답변

1

이 내가 할 수있는 최선입니다 . 나는 tinymce.hidetinymce.show을 사용했습니다.

보기 편집기를 숨기고 편집기가 대체하도록되어있는 텍스트 영역/DIV을 보여줍니다.

숨기기 편집기를 표시하고 편집기를 대체하도록되어있는 텍스트 영역/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

희망이

+0

내가 대신 ID의 클래스를 사용할 수 있습니다? – Alex

+0

tinymce.get은 ID 만 사용할 수 있습니다. 클래스를 사용하려면 클래스 요소를 반복하고 ID를 얻은 다음 숨기기/보이기 작업을 수행하십시오. – Dhiraj

+0

도움을 주셔서 감사합니다.하지만 왜 잘 이해하지 못합니까? 클래스 요소를 반복하고 이드를 얻는다. 설명해 줄 수 있니? – Alex

관련 문제