我正在将tinymce与使用zend框架开发的应用程序集成。
以下是代码:
<!-- Load TinyMCE -->
<script type="text/javascript" src="<?php echo $this->baseUrl()?>/js/tinymce/jquery.tinymce.js"></script>
<script type="text/javascript">
$().ready(function() {
$('textarea.editor').tinymce({
// Location of TinyMCE script
script_url : '<?php echo $this->baseUrl()?>/js/tinymce/tiny_mce_src.js',
// General options
theme : "advanced",
plugins : "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,advlist",
// 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,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true
});
});
</script>
<!-- /TinyMCE -->
这在Chrome上运行良好。但是在FF上它打印出以下错误:
b.editor is null
var tinymce=null,tinyMCEPopup,tinyMCE;...yMCEPopup.init();tinyMCEPopup._wait();
tiny_mce_popup.js (line 5)
this.params is undefined
var tinymce=null,tinyMCEPopup,tinyMCE;...yMCEPopup.init();tinyMCEPopup._wait();
tiny_mce_popup.js (line 5)
我不确定为什么。检查非文件是否给出404或任何其他http错误,所以如果加载了所有脚本,导致此错误的原因是什么?
答案 0 :(得分:2)
我强烈建议不要使用jQuery构建!处理输入输入时非常慢。最好先包含jQuery库,然后再包含常规的tinymce库。
另一个可以帮助您调试代码的事情是包含开发构建,它使用未缩小的文件,从而产生更容易的可跟踪代码进行调试。这是我使用的
<script type="text/javascript" src="http://myserver/js/jquery/jquery.js"></script>
<script type="text/javascript" src="http://myserver/js/tiny_mce/tiny_mce_dev.js"></script>
初始化使用:
进行tinyMCE.init({
mode: "textareas", // none, textareas, exact, ...
theme: "advanced", // also simple available
...
});