From 68c06a0345d7a6880ad4c4b1211476b89c9b821c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 21 Jan 2015 00:38:30 +0100 Subject: [PATCH] Work-around for multiple formatting removing each other in Firefox --- .../3rdParty/redactor/plugins/wmonkeypatch.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js index 9a24ff5ed4..6e752f255c 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js @@ -596,6 +596,25 @@ RedactorPlugins.wmonkeypatch = function() { $mpFormat.call(this, tag, type, value); }).bind(this); + // inline.formatRemoveSameChildren; + this.inline.formatRemoveSameChildren = (function($el, tag) { + $el.children(tag).each((function(index, child) { + var $child = $(child); + if (!$child.hasClass('redactor-selection-marker')) { + // check if this represents a style + if (tag === 'span' && this.inline.type === 'style') { + var $newProperty = this.inline.value.replace(/^([^:]+?):.*/, '$1'); + if (!child.style.getPropertyValue($newProperty)) { + // child carries a different CSS property, skip + return true; + } + } + + $child.contents().unwrap(); + } + }).bind(this)); + }).bind(this); + var $mpRemoveStyleRule = this.inline.removeStyleRule; this.inline.removeStyleRule = (function(name) { if ($.browser.iOS) { -- 2.20.1