Work-around for code being stripped from pasted data
authorAlexander Ebert <ebert@woltlab.com>
Thu, 22 Dec 2016 11:29:59 +0000 (12:29 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 22 Dec 2016 11:29:59 +0000 (12:29 +0100)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js

index 852ce1b8a4ae195bab90907d8005a41c41d0d89a..9736d864c13b3beb0f1f7ff7470dc2757bc6103e 100644 (file)
@@ -107,7 +107,15 @@ $.Redactor.prototype.WoltLabClean = function() {
                        var mpOnPaste = this.clean.onPaste;
                        this.clean.onPaste = (function (html, data, insert) {
                                if (data.pre) {
-                                       return mpOnPaste.call(this, html, data, insert);
+                                       // prevent method call when data.pre is true
+                                       var mpRemoveEmptyInlineTags = this.clean.removeEmptyInlineTags;
+                                       this.clean.removeEmptyInlineTags = function(html) { return html; };
+                                       
+                                       html = mpOnPaste.call(this, html, data, insert);
+                                       
+                                       this.clean.removeEmptyInlineTags = mpRemoveEmptyInlineTags;
+                                       
+                                       return html;
                                }
                                
                                var div = elCreate('div');