From e8bd782d47e36d512a37c589609633f676cbe303 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 18 Jan 2015 15:08:03 +0100 Subject: [PATCH] Improved pasting of

formatted content --- .../js/3rdParty/redactor/plugins/wbbcode.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index abb0e8b164..b92346a338 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -1305,17 +1305,24 @@ RedactorPlugins.wbbcode = function() { * @return string */ _pasteCallback: function(html) { - // reduce successive
by one - //html = html.replace(/]*>(]*>)+/g, '$1'); + var $uuid = WCF.getUUID(); - // replace

...

with

...


- /*html = html.replace(/

([\s\S]*?)<\/p>/g, function(match, content) { - if (content.match(/$/)) { + // replace

...

with

...


unless there is already a newline + html = html.replace(/

([\s\S]*?)<\/p>/gi, function(match, content) { + if (content.match(/^$/)) { return match; } - return '

' + content + '


'; - });*/ + return match + '@@@' + $uuid + '@@@'; + }); + + html = html.replace(new RegExp('@@@' + $uuid + '@@@(

)?', 'g'), function(match, next) { + if (next) { + return next; + } + + return '


'; + }); // restore font size html = html.replace(/\[size=(\d+)\]/g, '

'); -- 2.20.1