Avoid page scrolling on paste
authorAlexander Ebert <ebert@woltlab.com>
Tue, 24 Oct 2017 21:31:58 +0000 (23:31 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 24 Oct 2017 21:31:58 +0000 (23:31 +0200)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js

index cc9a7827af7892d0ba7464ba45412e2c9d920b35..5f810a4bba61082fa817c5ab053fd78f7375616c 100644 (file)
@@ -84,11 +84,11 @@ $.Redactor.prototype.WoltLabPaste = function() {
                        
                        var mpGetPasteBoxCode = this.paste.getPasteBoxCode;
                        this.paste.getPasteBoxCode = (function (pre) {
-                               if (pastedHtml !== null) {
-                                       return pastedHtml;
-                               }
-                               else if (pastedPlainText) {
-                                       return pastedPlainText;
+                               if (pastedHtml !== null || pastedPlainText !== null) {
+                                       // prevent page scrolling
+                                       this.tmpScrollTop = undefined;
+                                       
+                                       return pastedHtml || pastedPlainText;
                                }
                                
                                var returnValue = mpGetPasteBoxCode.call(this, pre);