我遇到与tinyMCE(所见即所得的编辑器)的问题。我实际上是在一个HTML元素里加入了textarea,就像DIV,它现在有一个style属性“display:none”。隐藏div内的TinyMCE不会显示为启用时,我们把div可见
当我将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%">
<p>This is the first paragraph.</p>
<p>This is the second paragraph.</p>
<p>This is the third paragraph.</p>
</textarea>
</div>
我想知道是否有人对如何解决这一问题的想法?
我忘了说,我有一个30至50 TinyMCE的textarea的我的网页里。我不想经常调用tinyMCE.init。它可能会带来性能问题?没有? – Nordes 2009-05-05 18:08:10