Fix for pasting on iOS
authorAlexander Ebert <ebert@woltlab.com>
Fri, 25 Sep 2015 11:11:21 +0000 (13:11 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 25 Sep 2015 11:11:21 +0000 (13:11 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js

index 0ebcb2c6e63c99d399ec2873d403f0a428ff4c3f..92531a965591652a3986b8b91b8356ee35e0db51 100644 (file)
@@ -1210,7 +1210,13 @@ RedactorPlugins.wmonkeypatch = function() {
                                        $node = marker.previousSibling;
                                }
                                
-                               $(marker).remove();
+                               // iOS sometimes pastes right into the marker, this work-around will unwrap the pasted content
+                               if (marker.innerHTML.length) {
+                                       marker.outerHTML = marker.innerHTML;
+                               }
+                               else {
+                                       marker.parentNode.removeChild(marker);
+                               }
                                
                                if ($node !== null) {
                                        this.selection.implicitRange = document.createRange();