百度UEditor修改右下角统计字数包含html样式

2023-12-07 0 638

百度UEditor修改右下角统计字数默认只统计前台所见的文字个数,为了便于展示实际保存的时候是保存的包含html标签的,所以右下角的统计字数功能需要修改

/**
* 计算编辑器当前内容的长度
* @name getContentLength
* @grammar editor.getContentLength(ingoneHtml,tagNames) =>
* @example
* editor.getLang(true)
*
* 2013年7月1日16:53:15 注释掉的内容为 去除html标记后的内容数,实际入库是算上html标签和文字的 所以统计字数以getContents为准
*/
getContentLength: function (ingoneHtml, tagNames) {
var count = this.getContent(false,false,true).length;
/*if (ingoneHtml) {
tagNames = (tagNames || []).concat([ \’hr\’, \’img\’, \’iframe\’]);
count = this.getContentTxt().replace(/[\\t\\r\\n]+/g, \’\’).length;
for (var i = 0, ci; ci = tagNames[i++];) {
count += this.document.getElementsByTagName(ci).length;
}
}*/
return count;

},

找到ueditor.all.js这个文件 找到4944行到4951行 注释掉 就ok了

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 网页编辑器 百度UEditor修改右下角统计字数包含html样式 https://www.u-9.cn/biancheng/bianji/125801.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务