Refresh the stored value when changing the language
authorAlexander Ebert <ebert@woltlab.com>
Mon, 20 Nov 2023 17:06:58 +0000 (18:06 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 20 Nov 2023 17:06:58 +0000 (18:06 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Language/Input.js
wcfsetup/install/files/js/WoltLabSuite/Core/Language/Text.js

index 5e2c1961db33fb37091b79f2ba2d31fc15cdee2b..d06721abcebdd71d4baa8d20460e14649640918f 100644 (file)
@@ -130,6 +130,10 @@ define(["require", "exports", "tslib", "../Dom/Util", "../Language", "../Ui/Drop
         if (data.languageId !== languageId) {
             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);
             }
             if (languageId === 0) {
index 7facfc3782dc6667c12bb1a43600f0add0505517..f63c62cac4b2674a73a35afd096340e646d5faa8 100644 (file)
@@ -33,6 +33,8 @@ define(["require", "exports", "tslib", "./Input", "../Component/Ckeditor"], func
         LanguageInput.init(elementId, values, availableLanguages, forceSelection);
         LanguageInput.registerCallback(elementId, "select", callbackSelect);
         LanguageInput.registerCallback(elementId, "submit", callbackSubmit);
+        // CKEditor does not permanently mirror the contents to the <textarea>.
+        LanguageInput.registerCallback(elementId, "beforeSelect", callbackSubmit);
     }
     exports.init = init;
 });