From f8b342dc9fc5d66980e4326b4e0d95e5cd01d01c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 20 Nov 2024 15:29:29 +0100 Subject: [PATCH] Hide the quote/reaction overlay on window resize See https://www.woltlab.com/community/thread/309553-%C3%A4nderung-der-fenstergr%C3%B6%C3%9Fe-zitate-reaktionen/ --- ts/WoltLabSuite/Core/Ui/Message/Quote.ts | 8 ++++++++ ts/WoltLabSuite/Core/Ui/Reaction/Handler.ts | 8 ++++++++ .../files/js/WoltLabSuite/Core/Ui/Message/Quote.js | 3 +++ .../files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js | 3 +++ 4 files changed, 22 insertions(+) diff --git a/ts/WoltLabSuite/Core/Ui/Message/Quote.ts b/ts/WoltLabSuite/Core/Ui/Message/Quote.ts index d62f7c43fd..0487723d93 100644 --- a/ts/WoltLabSuite/Core/Ui/Message/Quote.ts +++ b/ts/WoltLabSuite/Core/Ui/Message/Quote.ts @@ -105,6 +105,14 @@ export class UiMessageQuote implements AjaxCallbackObject { }, { passive: false }, ); + + window.addEventListener( + "resize", + () => { + this.copyQuote.classList.remove("active"); + }, + { passive: true }, + ); } /** diff --git a/ts/WoltLabSuite/Core/Ui/Reaction/Handler.ts b/ts/WoltLabSuite/Core/Ui/Reaction/Handler.ts index b4fb00e27d..6c3de17677 100644 --- a/ts/WoltLabSuite/Core/Ui/Reaction/Handler.ts +++ b/ts/WoltLabSuite/Core/Ui/Reaction/Handler.ts @@ -99,6 +99,14 @@ class UiReactionHandler { DomChangeListener.add(`WoltLabSuite/Core/Ui/Reaction/Handler-${objectType}`, () => this.initReactButtons()); UiCloseOverlay.add("WoltLabSuite/Core/Ui/Reaction/Handler", () => this._closePopover()); + + window.addEventListener( + "resize", + () => { + this._closePopover(); + }, + { passive: true }, + ); } /** diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Quote.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Quote.js index 431db62448..b094092560 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Quote.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Quote.js @@ -49,6 +49,9 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Event/ }, { once: true, passive: false }); } }, { passive: false }); + window.addEventListener("resize", () => { + this.copyQuote.classList.remove("active"); + }, { passive: true }); } /** * Initializes message containers. diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js index 95dd7ab9f9..570f80ac07 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js @@ -51,6 +51,9 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Dom/Ch this.initReactButtons(); Listener_1.default.add(`WoltLabSuite/Core/Ui/Reaction/Handler-${objectType}`, () => this.initReactButtons()); CloseOverlay_1.default.add("WoltLabSuite/Core/Ui/Reaction/Handler", () => this._closePopover()); + window.addEventListener("resize", () => { + this._closePopover(); + }, { passive: true }); } /** * Initializes all applicable react buttons with the given selector. -- 2.20.1