tinymce编辑器没有显示,getcontent返回false

时间:2017-05-31 08:55:39

标签: javascript php tinymce

这是tinymce的道路:

<script type="text/javascript" src="demo/tinymce/js/tinymce/tinymce.js"></script>

我的文字区域是:

    <textarea name="description" id="description" class="texarea" >

这是我的TinyMCE初始化代码:

<script type="text/javascript">
 tinymce.init({
 selector: "texarea",theme: "modern",width: 680,height: 300,
    plugins: [
         "advlist autolink link image lists charmap print preview hr anchor pagebreak",
         "searchreplace wordcount visualblocks visualchars insertdatetime media nonbreaking",
         "table contextmenu directionality emoticons paste textcolor ResponsiveFilemanager"
   ],
   toolbar1: "undo redo | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | styleselect",
   toolbar2: "| ResponsiveFilemanager | link unlink anchor | image media | forecolor backcolor  | print preview code ",
   image_advtab: true ,

 external_filemanager_path:"ResponsiveFilemanager/filemanager/",
 filemanager_title:"Responsive Filemanager" ,

 });
</script>

问题是文本区域没有显示编辑器和

tinyMCE.get('description').getContent()

返回错误“Uncaught TypeError:无法读取null的属性'getContent'”。请帮我在这段代码中找到错误。提前致谢。

1 个答案:

答案 0 :(得分:0)

你有一个错字。它是textarea,而不是texarea。另外,最后一个逗号不应该出现在那里:

<script type="text/javascript">
 tinymce.init({
 selector: "textarea",theme: "modern",width: 680,height: 300,
    plugins: [
         "advlist autolink link image lists charmap print preview hr anchor pagebreak",
         "searchreplace wordcount visualblocks visualchars insertdatetime media nonbreaking",
         "table contextmenu directionality emoticons paste textcolor ResponsiveFilemanager"
   ],
   toolbar1: "undo redo | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | styleselect",
   toolbar2: "| ResponsiveFilemanager | link unlink anchor | image media | forecolor backcolor  | print preview code ",
   image_advtab: true ,

 external_filemanager_path:"ResponsiveFilemanager/filemanager/",
 filemanager_title:"Responsive Filemanager"

 });
</script>

编辑:

此外,您错过了textarea的结束标记:

<textarea name="description" id="description" class="texarea" ></textarea>

现在应该可以了。