2009-05-05 5 views
4

tinyMCE(WYSIWYGエディタ)に問題があります。私は実際には、現在スタイル属性 "display:none"を持っているDIVのようなHTML要素の中にtextareaを追加しています。divを表示すると、hidden div内のTinyMCEが有効に表示されない

DIV表示スタイルを表示に変更するとき、tinyMCEエディタは無効になっています。

重要:この問題の原因となっている設定は、「auto_resize」オプションです。これは、tinyMCEエディタを編集モードまたは読み取り専用モードにする唯一のオプションです。ここで

は私のコードです:

tinyMCE.init({ 
    mode: "specific_textareas", 
       editor_selector: /(RichTextArea)/, 
       theme: "advanced", 
       auto_reset_designmode: true, 
       auto_resize:true, 
       theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,fontselect,fontsizeselect,|,forecolor,backcolor,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,justifyfull", 
       theme_advanced_buttons2: "", 
       theme_advanced_buttons3: "", 
       theme_advanced_buttons4: "", 
       theme_advanced_more_colors: 0, 
       theme_advanced_toolbar_location: "external", 
       theme_advanced_toolbar_align: "left" 
}); 

...

<a href="#" onclick='document.getElementById("myHiddenDiv").style.display = "block"; return false;'>Show WYSIWYG</a><br/> 
<div id="myHiddenDiv" style="display:none"> 
    <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded --> 
    <textarea class="RichTextArea" id="elm1" name="elm1" rows="15" cols="80" style="width: 80%"> 
     &lt;p&gt;This is the first paragraph.&lt;/p&gt; 
     &lt;p&gt;This is the second paragraph.&lt;/p&gt; 
     &lt;p&gt;This is the third paragraph.&lt;/p&gt; 
    </textarea> 
</div> 

私は、誰もがその問題を解決する方法のアイデアを持っているかどうかを知りたいですか?

答えて

5

含まれているdivを再表示した後にtinyMCE.init(...)を呼び出してみてください。

+0

を構築するようにするに

<textarea class="tinymce" style="width: 300px; height: 400px"></textarea> 

。私はしばしばそれをtinyMCEと呼びたいとは思わない。パフォーマンスの問題が発生する可能性がありますか?いいえ? – Nordes

+0

initコールを変更する必要があるかもしれません:mode: "exact"、要素: "id_of_unhidden_​​div" – slolife

+0

私はそれを試みますが、それは唯一の方法だと思います。個人的には、setTimeoutを使用して、表示サイズになると自動的にサイズを変更しました(setIntervalの一種)。しかし、それは何の理由もなくCPUを使いすぎている。 – Nordes

1

この質問はかなり古いですが、この問題もありました。 インラインスタイルで修正されました。それが簡単に私は私が私のページ内の30〜50 TinyMCEをテキストエリアのように持っていることを言うのを忘れて初期化する前に私のためにIRを行うには、この簡単なスクリプト()

$('textarea.tinymce').each(function(){ 
    $(this).css({ 
     width: $(this).width(), 
     height: $(this).height() 
    }); 
}) 
関連する問題