Fixed a few pasting issues
authorAlexander Ebert <ebert@woltlab.com>
Wed, 18 Jan 2017 10:03:35 +0000 (11:03 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 18 Jan 2017 10:03:42 +0000 (11:03 +0100)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js

index cc9eb262f5abd970c9eaa150573978187de7e112..0e5472396ab351470b61be98aa6dd6eada372a7d 100644 (file)
@@ -377,6 +377,23 @@ $.Redactor.prototype.WoltLabClean = function() {
                        this.clean.removeSpans = function(html) {
                                return html;
                        };
+                       
+                       var mpGetCurrentType = this.clean.getCurrentType;
+                       this.clean.getCurrentType = (function(html, insert) {
+                               var data = mpGetCurrentType.call(this, html, insert);
+                               
+                               if (this.utils.isCurrentOrParent(['kbd'])) {
+                                       data.inline = false;
+                                       data.block = false;
+                                       data.encode = true;
+                                       data.pre = true;
+                                       data.paragraphize = false;
+                                       data.images = false;
+                                       data.links = false;
+                               }
+                               
+                               return data;
+                       }).bind(this);
                }
        }
 };
index d3b3a2df427c6238e8580159fd1dd5480ffbf83a..3117a675c113ca8d91a4b4dfc447839d363cf149 100644 (file)
@@ -87,7 +87,10 @@ $.Redactor.prototype.WoltLabPaste = function() {
                                                if (this.detect.isWebkit() && clipboard.items.length > 1) {
                                                        file = clipboard.items[1].getAsFile();
                                                        cancelPaste = true;
-                                                       e.preventDefault();
+                                                       
+                                                       if (file !== null) {
+                                                               e.preventDefault();
+                                                       }
                                                }
                                                
                                                if (file === null) {
@@ -120,6 +123,8 @@ $.Redactor.prototype.WoltLabPaste = function() {
                        var transparentGif = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
                        var mpInsert = this.paste.insert;
                        this.paste.insert = (function(html, data) {
+                               if (isKbd) data.pre = true;
+                               
                                if (data.pre) {
                                        return mpInsert.call(this, html, data);
                                }