From 1219a2410d724a8f6a78aeb8dc2254a12e8c1029 Mon Sep 17 00:00:00 2001 From: Cyperghost Date: Tue, 17 Dec 2024 13:55:00 +0100 Subject: [PATCH] Don't accept template to render the quote container content --- ts/WoltLabSuite/Core/Component/Quote/List.ts | 16 ++++++---------- .../js/WoltLabSuite/Core/Component/Quote/List.js | 15 ++++++--------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/ts/WoltLabSuite/Core/Component/Quote/List.ts b/ts/WoltLabSuite/Core/Component/Quote/List.ts index 27604f26b6..2af4d50bc0 100644 --- a/ts/WoltLabSuite/Core/Component/Quote/List.ts +++ b/ts/WoltLabSuite/Core/Component/Quote/List.ts @@ -28,21 +28,17 @@ class QuoteList { throw new Error(`The quotes container for '${editorId}' does not exist.`); } - window.addEventListener("storage", (event) => { - if (event.key !== STORAGE_KEY) { - return; - } - - this.renderQuotes(event.newValue); + window.addEventListener("storage", () => { + this.renderQuotes(); }); - this.renderQuotes(window.localStorage.getItem(STORAGE_KEY)); + this.renderQuotes(); } - public renderQuotes(template: string | null): void { - this.#container.innerHTML = template || ""; + public renderQuotes(): void { + this.#container.innerHTML = window.localStorage.getItem(STORAGE_KEY) || ""; - if (template) { + if (this.#container.hasChildNodes()) { getTabMenu(this.#editorId)?.showTab( "quotes", getPhrase("wcf.message.quote.showQuotes", { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Quote/List.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Quote/List.js index c00ea38c31..39105e436a 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Quote/List.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Quote/List.js @@ -18,17 +18,14 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Core", "WoltLabSuite/C if (this.#container === null) { throw new Error(`The quotes container for '${editorId}' does not exist.`); } - window.addEventListener("storage", (event) => { - if (event.key !== exports.STORAGE_KEY) { - return; - } - this.renderQuotes(event.newValue); + window.addEventListener("storage", () => { + this.renderQuotes(); }); - this.renderQuotes(window.localStorage.getItem(exports.STORAGE_KEY)); + this.renderQuotes(); } - renderQuotes(template) { - this.#container.innerHTML = template || ""; - if (template) { + renderQuotes() { + this.#container.innerHTML = window.localStorage.getItem(exports.STORAGE_KEY) || ""; + if (this.#container.hasChildNodes()) { (0, MessageTabMenu_1.getTabMenu)(this.#editorId)?.showTab("quotes", (0, Language_1.getPhrase)("wcf.message.quote.showQuotes", { count: this.#container.childElementCount, })); -- 2.20.1