From: Alexander Ebert Date: Mon, 20 Nov 2023 17:06:40 +0000 (+0100) Subject: Refresh the stored value when changing the language X-Git-Tag: 6.0.3_dev_1~18 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=079461807a4b22f083b42ed1f052a1ad397d3cb5;p=GitHub%2FWoltLab%2FWCF.git Refresh the stored value when changing the language Fixes #5712 --- diff --git a/ts/WoltLabSuite/Core/Language/Input.ts b/ts/WoltLabSuite/Core/Language/Input.ts index 81c0381f4e..b4eaf2601b 100644 --- a/ts/WoltLabSuite/Core/Language/Input.ts +++ b/ts/WoltLabSuite/Core/Language/Input.ts @@ -28,7 +28,7 @@ type Values = Map; export type InputOrTextarea = HTMLInputElement | HTMLTextAreaElement; -type CallbackEvent = "select" | "submit"; +type CallbackEvent = "beforeSelect" | "select" | "submit"; type Callback = (element: InputOrTextarea) => void; interface ElementData { @@ -194,6 +194,11 @@ function select(elementId: string, languageId: number, isInit: boolean): void { const values = _values.get(elementId)!; if (data.languageId) { + const beforeSelect = data.callbacks.get("beforeSelect"); + if (beforeSelect) { + beforeSelect(data.element); + } + values.set(data.languageId, data.element.value); } diff --git a/ts/WoltLabSuite/Core/Language/Text.ts b/ts/WoltLabSuite/Core/Language/Text.ts index 2755bfc53b..1b69af96a2 100644 --- a/ts/WoltLabSuite/Core/Language/Text.ts +++ b/ts/WoltLabSuite/Core/Language/Text.ts @@ -42,4 +42,7 @@ export function init( LanguageInput.registerCallback(elementId, "select", callbackSelect); LanguageInput.registerCallback(elementId, "submit", callbackSubmit); + + // CKEditor does not permanently mirror the contents to the