Hide certain overlays on smartphones if editor is focused
authorAlexander Ebert <ebert@woltlab.com>
Wed, 31 Aug 2016 11:49:43 +0000 (13:49 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 31 Aug 2016 11:49:43 +0000 (13:49 +0200)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js
wcfsetup/install/files/style/layout/pageHeaderSticky.scss
wcfsetup/install/files/style/ui/pageAction.scss

index 323f0aab7f46c9060825b5fa3df3963b3dd9b35f..f2930f04a327239d307637611714cd70b783ec08 100644 (file)
@@ -1,6 +1,8 @@
 $.Redactor.prototype.WoltLabEvent = function() {
        "use strict";
        
+       var _activeInstances = 0;
+       
        return {
                init: function() {
                        this._callbacks = [];
@@ -13,6 +15,22 @@ $.Redactor.prototype.WoltLabEvent = function() {
                                        
                                }).bind(this))
                        }).bind(this));
+                       
+                       this.$editor[0].addEventListener('focus', function () {
+                               _activeInstances++;
+                               
+                               document.documentElement.classList.add('redactorActive');
+                       });
+                       this.$editor[0].addEventListener('blur', function () {
+                               _activeInstances--;
+                               
+                               // short delay to prevent flickering when switching focus between editors
+                               window.setTimeout(function () {
+                                       if (_activeInstances === 0) {
+                                               document.documentElement.classList.remove('redactorActive');
+                                       }
+                               }, 100);
+                       })
                },
                
                _setEvents: function(EventHandler) {
index 9c046dfb78f34b20e39672e359d04fcc9e4ac099..cc34cee9f6aa92ef619b7e43c7db2d3d4f57ba6e 100644 (file)
        }
 }
 
+@include screen-xs {
+       .redactorActive .pageHeaderContainer {
+               visibility: hidden !important;
+       }
+}
+
 @include screen-md-down {
        .pageHeaderSearch.open {
                left: 0;
index 8c7ff31b6faf09b103939f93ab0fdabc18b818c7..eecad93c7bab2c7488eafb250996543ea2602415 100644 (file)
@@ -72,3 +72,9 @@
 .pageOverlayActive .pageAction {
        display: none;
 }
+
+@include screen-xs {
+       .redactorActive .pageAction {
+               display: none !important;
+       }
+}