Discuz! X3.4 发帖换行丢失问题解决
摘要:
修正discuz发帖首次换行无效的问题修改static/js/bbcode.js在下面代码之后if((allowhtml && fetchChe...
修正discuz发帖首次换行无效的问题
修改static/js/bbcode.js
在下面代码之后
if((allowhtml && fetchCheckbox('htmlon')) || trim(str) == '') { for(i in EXTRAFUNC['html2bbcode']) { EXTRASTR = str; try { eval('str = ' + EXTRAFUNC['html2bbcode'][i] + '()'); } 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; }
添加以下内容即可
//fix first enter cannot start new line 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); } } //end