Ueditor字数统计限制输入问题(去掉空格统计)

最近开发的项目中有统计字数的问题,要求不能把空格算到统计总数中,在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;"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值