admin管理员组文章数量:1287636
I am having an issue with tinyMCE (WYSIWYG editor). I am actually adding the textarea inside a HTML element like a DIV which is currently having the style attribute "display:none".
When I am changing the DIV display style to visible the tinyMCE editor is shown as disabled.
Important Note: The setting which is causing the issue is the "auto_resize" option. This is the only option that I turn on/off that make the tinyMCE editor goes in edit or read-only mode.
Here's my code:
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>
I would like to know if anyone has an idea of how to fix that issue?
I am having an issue with tinyMCE (WYSIWYG editor). I am actually adding the textarea inside a HTML element like a DIV which is currently having the style attribute "display:none".
When I am changing the DIV display style to visible the tinyMCE editor is shown as disabled.
Important Note: The setting which is causing the issue is the "auto_resize" option. This is the only option that I turn on/off that make the tinyMCE editor goes in edit or read-only mode.
Here's my code:
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>
I would like to know if anyone has an idea of how to fix that issue?
Share Improve this question asked May 5, 2009 at 17:25 NordesNordes 2,5213 gold badges21 silver badges31 bronze badges2 Answers
Reset to default 7Try calling tinyMCE.init(...) after you unhide the containing div.
This question it's quite old, but I had this problem too. I fixed with inline styles.
<textarea class="tinymce" style="width: 300px; height: 400px"></textarea>
To make it easier I build this simple script to do ir for me before the init()
$('textarea.tinymce').each(function(){
$(this).css({
width: $(this).width(),
height: $(this).height()
});
})
版权声明:本文标题:javascript - TinyMCE inside hidden div are not displayed as enabled when we put the div visible - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741317689a2372015.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论