Fix for weird paste bug on iOS Safari
authorAlexander Ebert <ebert@woltlab.com>
Sat, 7 Feb 2015 17:37:28 +0000 (18:37 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 7 Feb 2015 17:37:28 +0000 (18:37 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js

index 89d12fbb0573075f64311e2cabae4a97a283375c..29bfc4fe7ae6c52437acb7ee6397beb1831d26af 100644 (file)
@@ -1031,6 +1031,20 @@ RedactorPlugins.wmonkeypatch = function() {
                 *  - fixes text pasting in Internet Explorer 11 (#2040) 
                 */
                paste: function() {
+                       // paste.createPasteBox
+                       var $mpCreatePasteBox = this.paste.createPasteBox;
+                       this.paste.createPasteBox = (function() {
+                               if ($.browser.iOS) {
+                                       this.$pasteBox = $('<div>').html('').attr('contenteditable', 'true').css({ position: 'absolute', visibility: 'hidden' });
+                                       
+                                       this.$box.parent().append(this.$pasteBox);
+                                       this.$pasteBox.focus();
+                               }
+                               else {
+                                       $mpCreatePasteBox.call(this);
+                               }
+                       }).bind(this);
+                       
                        // paste.insert
                        var $mpInsert = this.paste.insert;
                        this.paste.insert = (function(html) {