Discuz!在发帖时,经常出现回车换行失效
故障解决:
找到static/js/bbcode.js 进入
找到:
if((allowhtml && fetchCheckbox(‘htmlon’)) || trim(str) == ”) {
for(i in EXTRAFUNC[‘html2bbcode’]) {
EXTRASTR = str;
try {
eval(‘str = ‘ + EXTRAFUNC[‘html2bbcode’] + ‘()’);
} catch(e) {}
}
str = str.replace(/<img[^>]+smilieid=([“‘]?)(\d+)(\1)[^>]*>/ig, function($1, $2, $3) {return smileycode($3);});
str = str.replace(/<img([^>]*aid=[^>]*)>/ig, function($1, $2) {return imgtag($2);});
return str;
}
在上面代码之后添加如下代码:
var divPos = strpos(str,”<div>”);
if(divPos > 0 ){
if(divPos > 4 && str.substr(divPos – 4,4) == ‘</p>’){}
else{
str = str.substr(0,divPos) + ‘<br>’+ str.substr(divPos);
}
}