百度UEditor修改右下角統(tǒng)計(jì)字?jǐn)?shù)默認(rèn)只統(tǒng)計(jì)前臺(tái)所見的文字個(gè)數(shù),為了便于展示實(shí)際保存的時(shí)候是保存的包含html標(biāo)簽的,所以右下角的統(tǒng)計(jì)字?jǐn)?shù)功能需要修改
/**
* 計(jì)算編輯器當(dāng)前內(nèi)容的長(zhǎng)度
* @name getContentLength
* @grammar editor.getContentLength(ingoneHtml,tagNames) =>
* @example
* editor.getLang(true)
*
* 2013年7月1日16:53:15 注釋掉的內(nèi)容為 去除html標(biāo)記后的內(nèi)容數(shù),實(shí)際入庫(kù)是算上html標(biāo)簽和文字的 所以統(tǒng)計(jì)字?jǐn)?shù)以getContents為準(zhǔn)
*/
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;
},