Fixed removal of block element attributes
authorAlexander Ebert <ebert@woltlab.com>
Thu, 10 Aug 2017 12:00:55 +0000 (14:00 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 10 Aug 2017 12:01:02 +0000 (14:01 +0200)
Fixes #2370

wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabBlock.js

index 38be62bd5445331f4521f5b82bb1ebab070d1dcf..302749db4c5a148e29177b48823f6e27db413895 100644 (file)
@@ -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) {