|
修正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;
- }
复制代码
修改为
- 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
复制代码
|
|