时间:2021-07-01 10:21:17 帮助过:454人阅读
修改ueditor.config.js文件里把注释去掉
wordCount:true, maximumWords:1000000,//允许的最大字符数
这个方法不一定生效谨慎修改
第一步:在ueditor.all.js中找到这两行注释掉
countDom.innerHTML = errMsg; editor.fireEvent(“wordcountoverflow”)
第二步:在注释点的两行下面写上这三行就搞定了
var content = editor.getContentTxt(); editor.setContent(content.substring(0,maxwordsnum)); editor.focus(true);
function setCount(editor,ui) { editor.setOpt({ wordCount:true, maximumWords:10000, wordCountMsg:editor.options.wordCountMsg || editor.getLang("wordCountMsg"), wordOverFlowMsg:editor.options.wordOverFlowMsg || editor.getLang("wordOverFlowMsg") }); var opt = editor.options, max = opt.maximumWords, msg = opt.wordCountMsg , errMsg = opt.wordOverFlowMsg, countDom = ui.getDom('wordcount'); if (!opt.wordCount) { return; } var count = editor.getContentLength(true); if (count > max) { // countDom.innerHTML = errMsg; // editor.fireEvent("wordcountoverflow"); debugger; var content = editor.getContentTxt(); editor.setContent(content.substring(0,max)); editor.focus(true); } else { countDom.innerHTML = msg.replace("{#leave}", max - count).replace("{#count}", count); } } 其实只是将maxwordsnum修改成了max变量,成功。