修复 编辑器BUG
This commit is contained in:
parent
979b566b47
commit
b23dbd78a7
|
@ -2,7 +2,7 @@
|
||||||
[Discuz!] (C)2001-2099 Comsenz Inc.
|
[Discuz!] (C)2001-2099 Comsenz Inc.
|
||||||
This is NOT a freeware, use is subject to license terms
|
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 = [];
|
var re, DISCUZCODE = [];
|
||||||
|
@ -201,7 +201,7 @@ function dstag(options, text, tagname) {
|
||||||
prepend = '[align=' + align + ']' + prepend;
|
prepend = '[align=' + align + ']' + prepend;
|
||||||
append += '[/align]';
|
append += '[/align]';
|
||||||
} else {
|
} else {
|
||||||
append += '\n';
|
prepend += '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return prepend + recursion(tagname, text, 'dstag') + append;
|
return prepend + recursion(tagname, text, 'dstag') + append;
|
||||||
|
@ -212,7 +212,7 @@ function ptag(options, text, tagname) {
|
||||||
return '\n';
|
return '\n';
|
||||||
}
|
}
|
||||||
if(trim(options) == '') {
|
if(trim(options) == '') {
|
||||||
return text + '\n';
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
var lineHeight = null;
|
var lineHeight = null;
|
||||||
|
@ -314,7 +314,10 @@ function html2bbcode(str) {
|
||||||
return 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) {
|
if(!fetchCheckbox('bbcodeoff') && allowbbcode) {
|
||||||
var postbg = '';
|
var postbg = '';
|
||||||
|
@ -660,8 +663,11 @@ function recursion(tagname, text, dofunction, extraargs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var localbegin = optionend + 1;
|
var localbegin = optionend + 1;
|
||||||
|
if(tagbegin != 0 || tagname != 'div') {
|
||||||
var localtext = eval(dofunction)(tagoptions, text.substr(localbegin, tagend - localbegin), tagname, extraargs);
|
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);
|
text = text.substring(0, tagbegin) + localtext + text.substring(tagend + close_tag_len);
|
||||||
|
|
||||||
beginsearchpos = tagbegin + localtext.length;
|
beginsearchpos = tagbegin + localtext.length;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
[Discuz!] (C)2001-2099 Comsenz Inc.
|
[Discuz!] (C)2001-2099 Comsenz Inc.
|
||||||
This is NOT a freeware, use is subject to license terms
|
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) {
|
function $(id) {
|
||||||
|
@ -1499,6 +1499,11 @@ function parseurl(str, mode, parsecode) {
|
||||||
function codetag(text, br) {
|
function codetag(text, br) {
|
||||||
var br = !br ? 1 : br;
|
var br = !br ? 1 : br;
|
||||||
DISCUZCODE['num']++;
|
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');
|
if(br > 0 && typeof wysiwyg != 'undefined' && wysiwyg) text = text.replace(/<br[^\>]*>/ig, '\n');
|
||||||
text = text.replace(/\$/ig, '$$');
|
text = text.replace(/\$/ig, '$$');
|
||||||
DISCUZCODE['html'][DISCUZCODE['num']] = '[code]' + text + '[/code]';
|
DISCUZCODE['html'][DISCUZCODE['num']] = '[code]' + text + '[/code]';
|
||||||
|
|
Loading…
Reference in New Issue