From 376524e3adb8fb1f1e6112704151dd9682abc3c6 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 10 Aug 2017 14:00:55 +0200 Subject: [PATCH] Fixed removal of block element attributes Fixes #2370 --- .../redactor2/plugins/WoltLabBlock.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabBlock.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabBlock.js index 38be62bd54..302749db4c 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabBlock.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabBlock.js @@ -106,6 +106,28 @@ $.Redactor.prototype.WoltLabBlock = function() { return $(firstBlock); }).bind(this); + + this.block.removeAllAttr = (function(block) { + block = this.block.getBlocks(block); + + var returned = []; + $.each(block, function(i,s) + { + if (typeof s.attributes === 'undefined') + { + returned.push(s); + } + + // WoltLab fix: `attributes` is a live collection + while (s.attributes.length) { + s.removeAttribute(s.attributes[0].name); + } + + returned.push(s); + }); + + return returned; + }).bind(this); }, register: function(tag, arrowKeySupport) { -- 2.20.1