From: Alexander Ebert Date: Tue, 16 Dec 2014 14:46:56 +0000 (+0100) Subject: Improved handling of inline formatting tags X-Git-Tag: 2.1.0_Beta_2~28 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=054680d125a33de569fbe4175a01a4726f24085c;p=GitHub%2FWoltLab%2FWCF.git Improved handling of inline formatting tags --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 2a5e4bf742..8ed23c0b0b 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -436,7 +436,7 @@ RedactorPlugins.wbbcode = function() { if ($value == '') { var $opening = $openElements.pop(); - var $tmp = $opening.start + $buffer.pop() + $opening.end; + var $tmp = $opening.start + $.trim($buffer.pop()) + $opening.end; if ($buffer.length) { $buffer[$buffer.length - 1] += $tmp; @@ -692,13 +692,34 @@ RedactorPlugins.wbbcode = function() { data = data.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,''); // [size] - data = data.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,'$2'); + data = data.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi, (function(match, a, content) { + content = $.trim(content); + if (!content.length) { + content = this.opts.invisibleSpace; + } + + return '' + content + ''; + }).bind(this)); // [color] - data = data.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,'$2'); + data = data.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi, (function(match, color, content) { + content = $.trim(content); + if (!content.length) { + content = this.opts.invisibleSpace; + } + + return '' + content + ''; + }).bind(this)); // [font] - data = data.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,'$2'); + data = data.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi, (function(match, fontFamily, content) { + content = $.trim(content); + if (!content.length) { + content = this.opts.invisibleSpace; + } + + return '' + content + ''; + }).bind(this)); // [align] data = data.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,'
$2
');