输入banner图图片脚本导航/分类

解决UEditor超出最大字数后只提示不限制的问题

QQ截图20200420202818.jpg

解决UEditor最大字数方法1

修改ueditor.config.js文件里把注释去掉

wordCount:true,     
maximumWords:1000000,//允许的最大字符数

解决UEditor最大字数方法2

这个方法不一定生效谨慎修改

第一步:在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变量,成功。