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);
}
}
|