Fixed pasting in Internet Explorer 11
authorAlexander Ebert <ebert@woltlab.com>
Sat, 13 Dec 2014 16:50:08 +0000 (17:50 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 13 Dec 2014 16:50:08 +0000 (17:50 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js

index 73d12e75ff784af299bf38401eacd0c869af3891..5e149c11d9555212fd1f52c23bc7020b89c61a71 100644 (file)
@@ -733,7 +733,8 @@ RedactorPlugins.wmonkeypatch = function() {
                /**
                 * Partially overwrites the 'paste' module.
                 * 
-                *  - prevent screwed up, pasted HTML from placing text nodes (and inline elements) in the editor's direct root 
+                *  - prevent screwed up, pasted HTML from placing text nodes (and inline elements) in the editor's direct root
+                *  - fixes text pasting in Internet Explorer 11 (#2040) 
                 */
                paste: function() {
                        var $fixDOM = (function() {
@@ -772,7 +773,15 @@ RedactorPlugins.wmonkeypatch = function() {
                        this.paste.insert = (function(html) {
                                $mpInsert.call(this, html);
                                
-                               setTimeout($fixDOM, 20);
+                               setTimeout((function() {
+                                       $fixDOM();
+                                       
+                                       if ($.browser.msie) {
+                                               getSelection().getRangeAt(0).collapse(true);
+                                       }
+                                       
+                                       this.wutil.saveSelection();
+                               }).bind(this), 20);
                        }).bind(this);
                },