最近开发的项目中有统计字数的问题,要求不能把空格算到统计总数中,在ueditor.all.js中找到getContentLength方法,在count=this.getContentTxt().replace(/[\t\t\n]+/g,'')这句后面加trim().length就好了.
count=this.getContentTxt().replace(/[\t\t\n]+/g,'').trim().length;
对于禁止输入问题,需要先在ueditor中配置 wordCount为true;
maxwordnumber:10000,
然后在ueditor.all.js 中
1,在/include/ueditor/ueditor.all.js中找到这两行注释掉
countDom.innerHTML = errMsg;
editor.fireEvent(“wordcountoverflow”)
2,在注释点的两行下面写上这三行就搞定了
var content = editor.getContentTxt();
editor.setContent(content.substring(0,max));
editor.focus(true);
要是觉得下面的边框难看可以修改ueditor.all.js 中 getHtmlTpl:function(){...}找到 id="##_wordcount" 在class后面加style="border-top:0px;"