修复 编辑器BUG

This commit is contained in:
Discuz! 2017-01-20 10:11:16 +08:00
parent 979b566b47
commit b23dbd78a7
2 changed files with 18 additions and 7 deletions

View File

@ -2,7 +2,7 @@
[Discuz!] (C)2001-2099 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: bbcode.js 35331 2015-06-15 07:03:11Z nemohou $
$Id: bbcode.js 36348 2017-01-13 06:36:44Z nemohou $
*/
var re, DISCUZCODE = [];
@ -201,7 +201,7 @@ function dstag(options, text, tagname) {
prepend = '[align=' + align + ']' + prepend;
append += '[/align]';
} else {
append += '\n';
prepend += '\n';
}
}
return prepend + recursion(tagname, text, 'dstag') + append;
@ -212,7 +212,7 @@ function ptag(options, text, tagname) {
return '\n';
}
if(trim(options) == '') {
return text + '\n';
return text;
}
var lineHeight = null;
@ -314,7 +314,10 @@ function html2bbcode(str) {
return str;
}
str = str.replace(/<div\sclass=["']?blockcode["']?>[\s\S]*?<blockquote>([\s\S]+?)<\/blockquote>[\s\S]*?<\/div>/ig, function($1, $2) {return codetag($2);});
str = str.replace(/<\/p><p>/ig, '<br>');
str = str.replace(/<\/div><div>/ig, '<br>');
str = str.replace(/<div[^>]*blockcode[^>]*><blockquote>([\s\S]*?)<\/blockquote><\/div>([\s\S]*?)(<br[^>]*>)?/ig, function($1, $2) {return codetag($2);});
if(!fetchCheckbox('bbcodeoff') && allowbbcode) {
var postbg = '';
@ -660,8 +663,11 @@ function recursion(tagname, text, dofunction, extraargs) {
}
var localbegin = optionend + 1;
var localtext = eval(dofunction)(tagoptions, text.substr(localbegin, tagend - localbegin), tagname, extraargs);
if(tagbegin != 0 || tagname != 'div') {
var localtext = eval(dofunction)(tagoptions, text.substr(localbegin, tagend - localbegin), tagname, extraargs);
}else{
var localtext = text.substr(localbegin, tagend - localbegin);
}
text = text.substring(0, tagbegin) + localtext + text.substring(tagend + close_tag_len);
beginsearchpos = tagbegin + localtext.length;

View File

@ -2,7 +2,7 @@
[Discuz!] (C)2001-2099 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: common.js 34611 2014-06-11 10:28:49Z nemohou $
$Id: common.js 36348 2017-01-13 06:36:44Z nemohou $
*/
function $(id) {
@ -1499,6 +1499,11 @@ function parseurl(str, mode, parsecode) {
function codetag(text, br) {
var br = !br ? 1 : br;
DISCUZCODE['num']++;
text = text.replace(/<\/blockquote><blockquote>/ig, '<br>');
text = text.replace(/<div>([\s\S]*?)<\/div>/ig, "$1");
text = text.replace(/<p>([\s\S]*?)<\/p>/ig, "$1");
if(br > 0 && typeof wysiwyg != 'undefined' && wysiwyg) text = text.replace(/<br[^\>]*>/ig, '\n');
text = text.replace(/\$/ig, '$$');
DISCUZCODE['html'][DISCUZCODE['num']] = '[code]' + text + '[/code]';