From e22eea11cdc6c559bf6491218dbfa0da906859e6 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 7 Mar 2015 23:43:19 +0100 Subject: [PATCH] Strip background-color from pasted content --- .../files/js/3rdParty/redactor/plugins/wbbcode.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 81f4b4d71f..adfee4506d 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -1509,6 +1509,20 @@ RedactorPlugins.wbbcode = function() { html = html.replace(/\[size=(\d+)\]/g, '

'); html = html.replace(/\[\/size\]/g, '

'); + // strip background-color + html = html.replace(/style="([^"]+)"/, function(match, inlineStyles) { + var $parts = inlineStyles.split(';'); + var $styles = [ ]; + for (var $i = 0, $length = $parts.length; $i < $length; $i++) { + var $part = $parts[$i]; + if (!$part.match(/^\s*background-color/)) { + $styles.push($part); + } + } + + return 'style="' + $styles.join(';') + '"'; + }); + WCF.System.Event.fireEvent('com.woltlab.wcf.redactor', 'afterPaste', { html: html }); return html; -- 2.20.1