From e0388a9a233288683c7255034231c2632da99095 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 31 Aug 2016 13:49:43 +0200 Subject: [PATCH] Hide certain overlays on smartphones if editor is focused --- .../3rdParty/redactor2/plugins/WoltLabEvent.js | 18 ++++++++++++++++++ .../files/style/layout/pageHeaderSticky.scss | 6 ++++++ .../install/files/style/ui/pageAction.scss | 6 ++++++ 3 files changed, 30 insertions(+) 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; + } +} -- 2.20.1