Update the JS artifacts
authorAlexander Ebert <ebert@woltlab.com>
Mon, 22 Jan 2024 12:17:26 +0000 (13:17 +0100)
committerOlaf Braun <info@braun-development.de>
Thu, 7 Mar 2024 15:36:44 +0000 (16:36 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor.js
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Event.js

index abdd6c17b596a78c4be90ae553f95d7362e3f870..86d1372fbaa2d9417c4daf523603627c037627b2 100644 (file)
@@ -187,6 +187,11 @@ define(["require", "exports", "tslib", "./Ckeditor/Attachment", "./Ckeditor/Medi
         }
         return false;
     }
+    function notifyOfDataChanges(editor, element) {
+        editor.model.document.on("change:data", () => {
+            (0, Event_1.dispatchToCkeditor)(element).changeData();
+        });
+    }
     async function setupCkeditor(element, features, bbcodes, codeBlockLanguages, licenseKey) {
         if (instances.has(element)) {
             throw new TypeError(`Cannot initialize the editor for '${element.id}' twice.`);
@@ -228,6 +233,7 @@ define(["require", "exports", "tslib", "./Ckeditor/Attachment", "./Ckeditor/Medi
             (0, Event_1.dispatchToCkeditor)(element).discardRecoveredData();
         }
         (0, Keyboard_1.setupSubmitShortcut)(ckeditor);
+        notifyOfDataChanges(cke, element);
         const enableDebug = window.ENABLE_DEBUG_MODE && window.ENABLE_DEVELOPER_TOOLS;
         if (enableDebug && Devtools_1.default._internal_.editorInspector()) {
             void new Promise((resolve_2, reject_2) => { require(["@ckeditor/ckeditor5-inspector"], resolve_2, reject_2); }).then(tslib_1.__importStar).then((inspector) => {
index db3d3ede9cd1748a15e04eb382ffae3d8e6297c3..7cb97273b35cd7aa1285556b543c09d26d2f20f5 100644 (file)
@@ -21,6 +21,9 @@ define(["require", "exports"], function (require, exports) {
                 detail: payload,
             }));
         }
+        changeData() {
+            this.#element.dispatchEvent(new CustomEvent("ckeditor5:change-data" /* EventNames.ChangeData */));
+        }
         destroy() {
             this.#element.dispatchEvent(new CustomEvent("ckeditor5:destroy" /* EventNames.Destroy */));
         }
@@ -100,6 +103,12 @@ define(["require", "exports"], function (require, exports) {
             });
             return this;
         }
+        changeData(callback) {
+            this.#element.addEventListener("ckeditor5:change-data" /* EventNames.ChangeData */, () => {
+                callback();
+            });
+            return this;
+        }
         collectMetaData(callback) {
             this.#element.addEventListener("ckeditor5:collect-meta-data" /* EventNames.CollectMetaData */, (event) => {
                 callback(event.detail);