ASP.Net MVC:TinyMce编辑器没有显示

时间:2016-08-22 13:47:20

标签: javascript asp.net-mvc tinymce-4

我正在使用tinyMCE编辑器,但编辑器没有显示在页面中。我只是不明白为什么tinyMCE编辑器没有显示在页面中。

我按照这个链接http://rion.io/2014/09/30/integrating-tinymce-into-an-mvc-5-project/找到了如何在asp.net mvc项目中集成tinyMCE编辑器,但没有运气。

以下是代码段:

@section scripts{

<script src="~/scripts/tinymce/tinymce.min.js"></script>

<script>    
    $(document).ready(function () {
        tinyMCE.init({
            selector: '#txtEditor',
            mode: "textareas",
            theme: "modern",
            height: 400,
            width: 600,
            // Theme options
            theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
            theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
            theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
            theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
            theme_advanced_statusbar_location: "bottom",
            theme_advanced_resizing: true,

        });
        });

</script>
}        

当页面加载然后编辑器没有显示但占用空间时,当我通过firebug检查html代码时,我看到tinymce div被隐藏,我的textarea也被隐藏了。

<div id="mceu_13" class="mce-tinymce mce-container mce-panel" role="application" tabindex="-1" hidefocus="1" style="visibility: hidden; border-width: 1px; width: 600px;">
<textarea id="txtEditor" class="form-control" rows="6" name="Description" cols="10" style="width: 30%; display: none;" aria-hidden="true"></textarea>
</div>

我只是不明白它隐藏的原因?如果有人遇到同样的问题并解决了它,请分享知识,因为我希望TinyMce编辑器可见。请帮我。感谢。

0 个答案:

没有答案