百度UEditor修改右下角統(tǒng)計字?jǐn)?shù)默認(rèn)只統(tǒng)計前臺所見的文字個數(shù),為了便于展示實際保存的時候是保存的包含html標(biāo)簽的,所以右下角的統(tǒng)計字?jǐn)?shù)功能需要修改
/*** 計算編輯器當(dāng)前內(nèi)容的長度* @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ù),實際入庫是算上html標(biāo)簽和文字的 所以統(tǒng)計字?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;},
找到ueditor.all.js這個文件 找到4944行到4951行 注釋掉 就ok了
新聞熱點
疑難解答