export type InputOrTextarea = HTMLInputElement | HTMLTextAreaElement;
-type CallbackEvent = "select" | "submit";
+type CallbackEvent = "beforeSelect" | "select" | "submit";
type Callback = (element: InputOrTextarea) => void;
interface ElementData {
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);
}
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);
}