2

我尝试在我的网站上设置 tinyMCE。这是我的设置:

<script type="text/javascript" src="extensions/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
    tinyMCE.init({
        // General options
        mode : "exact",
        elements: "mceContent",
        language : "ru",
        theme : "advanced",
        forced_root_block : false,
        force_br_newlines : true,
        force_p_newlines : false,

        plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,formatselect,forecolor,backcolor,link,unlink,justifyleft,justifycenter,justifyright,bullist,numlist,|,pasteword,pastetext,table,image,|,undo,redo,|,code,fullscreen",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,
        height: 400,
        width: 680,

        skin : "o2k7",
        skin_variant : "blue",
        theme_advanced_toolbar_align : "left",
        relative_urls : false
    });
</script>

这是我的html代码:

<textarea class="span8" name="mceContent" id="mceContent" rows="15" 
    style="width: 40em; height: 20em" >
        {$mceContent}
</textarea>

当我打开此页面时,文本区域被隐藏。这是我在浏览器中看到的 html 代码:

<textarea class="span8" name="mceContent" id="mceContent" rows="15" 
style="width: 40em; height: 20em; visibility: hidden;">                 
</textarea> 

那么,我该如何解决这个问题呢?

4

2 回答 2

2

tinymce.init()在 DOM 正确加载之前运行。你需要把你的init()内部包装起来document.ready

document.addEventListener('DomContentLoaded', function(){

    tinyMCE.init({
        // your init options
    });

});
于 2019-10-30T10:22:08.630 回答
0

好吧,这不是问题。bcoz 你已经将元素:“mceContent”值传递给 tinymce 构造函数,通过这样做,插件将隐藏匹配的元素,它将改为编辑器。

于 2015-12-22T12:00:22.450 回答