Work-around for iOS 8 zoom bug on first tap
authorAlexander Ebert <ebert@woltlab.com>
Thu, 27 Aug 2015 14:16:17 +0000 (16:16 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 27 Aug 2015 14:16:17 +0000 (16:16 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index ac02fb6be67f2f7d8c844f861b705c798479cf4d..a924a619c883908adbf7c74f9bc1a61d901e4684 100644 (file)
@@ -43,6 +43,16 @@ RedactorPlugins.wbbcode = function() {
                                
                                $(document).trigger('resize');
                                this.wutil.saveSelection();
+                               
+                               var editor = this.$editor[0], textarea = this.$textarea[0];
+                               setTimeout(function() {
+                                       if ($.browser.iOS && editor.scrollHeight === 0) {
+                                               // work-around for iOS 8 bug causing the browser to zoom in on tap
+                                               if (document.activeElement === editor || document.activeElement === textarea) {
+                                                       document.activeElement.blur();
+                                               }
+                                       }
+                               }, 10);
                        }).bind(this);
                        
                        this.opts.pasteBeforeCallback = $.proxy(this.wbbcode._pasteBeforeCallback, this);