当我在tinmyce.int()中编写设置函数时,tinymce消失了,只有纯文本区域可见



请参阅下面的代码:

  tinymce.init({
      selector:"#editArea", //id of my textarea to be replaced by tinymce
      plugins : [
                  "advlist autolink link image lists charmap print preview textcolor colorpicker image imagetools contextmenu" ,
                  "autosave searchreplace wordcount insertdatetime code media nonbreaking spellchecker save table",
                  "directionality emoticons template paste visualblocks visualchars hr anchor pagebreak autoresize"
                  ],
       fontsize_formats: "8pt 9pt 10pt 11pt 12pt 26pt 36pt",            
      forced_root_block : '',
      schema: "html5",

      autosave_ask_before_unload:true,
      image_title: true,
      paste_data_images:true,

      toolbar: ["save undo redo styleselect  ", 
                    "alignleft aligncenter alignright emoticons",
                 " bullist  numlist outdent bold italic ",
                 " indent forecolor  backcolor code image",
                  "fontselect fontsizeselect"],

      contextmenu: "link image inserttable | cell row column deletetable",
      automatic_uploads: true,
      setup:function(ed){
            ed.onLoadContent.add(function(ed,o){
                o.content=o.content.replace(/Â/g,'');
            });
      }
});

为什么在编写设置函数时,tinymce编辑器会消失(如果我注释掉上面代码中的设置函数部分,它是可见的)

您正在使用哪个版本的tinymce?请检查它是否支持ed.onLoadContent.add(函数(ed,o){o.content=o.content.replace(/?/g,'');});

当我把这个函数添加到我的tinymce init函数中时。。效果很好。请找到下面的代码,它对我有效。

 tinyMCE.init({
        
        mode : "textareas",
        theme : "advanced",
        //plugins : "safari,spellchecker,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,imagemanager,filemanager",
        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 : false,
        ////template_external_list_url : "js/template_list.js",
        ////external_link_list_url : "js/link_list.js",
        ////external_image_list_url : "js/image_list.js",
       ////media_external_list_url : "js/media_list.js"
        setup: function (ed) {
            ed.onLoadContent.add(function (ed, o) {
                o.content = o.content.replace(/Â/g, '');
            });
        }
   });

最新更新