5

tinyMCE(WYSIWYGエディター)に問題があります。私は実際に、現在スタイル属性「display:none」を持っているDIVのようなHTML要素内にtextareaを追加しています。

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>

誰かがその問題を修正する方法のアイデアを持っているかどうか知りたいですか?

4

2 に答える 2

7

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

于 2009-05-05T17:56:47.557 に答える
1

この質問はかなり古いですが、私もこの問題を抱えていました。インラインスタイルで修正しました。

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

簡単にするために、init()の前にirを実行するこの単純なスクリプトを作成します。

$('textarea.tinymce').each(function(){
    $(this).css({
        width: $(this).width(),
        height: $(this).height()
    });
})
于 2013-04-25T20:15:54.160 に答える