From: Alexander Ebert Date: Wed, 31 Aug 2016 11:49:43 +0000 (+0200) Subject: Hide certain overlays on smartphones if editor is focused X-Git-Tag: 3.0.0_Beta_1~372^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e0388a9a233288683c7255034231c2632da99095;p=GitHub%2FWoltLab%2FWCF.git Hide certain overlays on smartphones if editor is focused --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js index 323f0aab7f..f2930f04a3 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js @@ -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) { diff --git a/wcfsetup/install/files/style/layout/pageHeaderSticky.scss b/wcfsetup/install/files/style/layout/pageHeaderSticky.scss index 9c046dfb78..cc34cee9f6 100644 --- a/wcfsetup/install/files/style/layout/pageHeaderSticky.scss +++ b/wcfsetup/install/files/style/layout/pageHeaderSticky.scss @@ -167,6 +167,12 @@ } } +@include screen-xs { + .redactorActive .pageHeaderContainer { + visibility: hidden !important; + } +} + @include screen-md-down { .pageHeaderSearch.open { left: 0; diff --git a/wcfsetup/install/files/style/ui/pageAction.scss b/wcfsetup/install/files/style/ui/pageAction.scss index 8c7ff31b6f..eecad93c7b 100644 --- a/wcfsetup/install/files/style/ui/pageAction.scss +++ b/wcfsetup/install/files/style/ui/pageAction.scss @@ -72,3 +72,9 @@ .pageOverlayActive .pageAction { display: none; } + +@include screen-xs { + .redactorActive .pageAction { + display: none !important; + } +}