From 73d414c1f9a24ddde161c8139bfe89637c6b5d3c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 6 Apr 2023 15:49:13 +0200 Subject: [PATCH] Fix the stacking of notification messages Fixes #5396 --- ts/WoltLabSuite/Core/Ui/Notification.ts | 7 ++++--- .../install/files/js/WoltLabSuite/Core/Ui/Notification.js | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ts/WoltLabSuite/Core/Ui/Notification.ts b/ts/WoltLabSuite/Core/Ui/Notification.ts index b858d2914e..c61f9913ff 100644 --- a/ts/WoltLabSuite/Core/Ui/Notification.ts +++ b/ts/WoltLabSuite/Core/Ui/Notification.ts @@ -6,7 +6,8 @@ * @license GNU Lesser General Public License */ -import * as Language from "../Language"; +import { getPageOverlayContainer } from "../Helper/PageOverlay"; +import { getPhrase } from "../Language"; type Callback = () => void; @@ -30,7 +31,7 @@ function init() { _message.addEventListener("click", hide); _notificationElement.appendChild(_message); - document.body.appendChild(_notificationElement); + getPageOverlayContainer().appendChild(_notificationElement); } /** @@ -61,7 +62,7 @@ export function show(message?: string, callback?: Callback | null, cssClassName? _callback = typeof callback === "function" ? callback : null; _message.className = cssClassName || "success"; - _message.textContent = Language.get(message || "wcf.global.success"); + _message.textContent = getPhrase(message || "wcf.global.success"); _notificationElement.classList.add("active"); _timeout = setTimeout(hide, 2000); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Notification.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Notification.js index 71456a37e9..bbce221e90 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Notification.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Notification.js @@ -5,11 +5,10 @@ * @copyright 2001-2019 WoltLab GmbH * @license GNU Lesser General Public License */ -define(["require", "exports", "tslib", "../Language"], function (require, exports, tslib_1, Language) { +define(["require", "exports", "../Helper/PageOverlay", "../Language"], function (require, exports, PageOverlay_1, Language_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.show = void 0; - Language = tslib_1.__importStar(Language); let _busy = false; let _callback = null; let _didInit = false; @@ -26,7 +25,7 @@ define(["require", "exports", "tslib", "../Language"], function (require, export _message = document.createElement("p"); _message.addEventListener("click", hide); _notificationElement.appendChild(_message); - document.body.appendChild(_notificationElement); + (0, PageOverlay_1.getPageOverlayContainer)().appendChild(_notificationElement); } /** * Hides the notification and invokes the callback if provided. @@ -50,7 +49,7 @@ define(["require", "exports", "tslib", "../Language"], function (require, export init(); _callback = typeof callback === "function" ? callback : null; _message.className = cssClassName || "success"; - _message.textContent = Language.get(message || "wcf.global.success"); + _message.textContent = (0, Language_1.getPhrase)(message || "wcf.global.success"); _notificationElement.classList.add("active"); _timeout = setTimeout(hide, 2000); } -- 2.20.1