Reset the poll editor on editor reset
authorAlexander Ebert <ebert@woltlab.com>
Tue, 9 May 2023 13:44:07 +0000 (15:44 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 9 May 2023 13:44:07 +0000 (15:44 +0200)
Fixes #5492

ts/WoltLabSuite/Core/Ui/Poll/Editor.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Poll/Editor.js

index 1d0afc39736cdc959e30a39dd85b492fa0221a82..df6e9bc344b683a09f65eab77bde5ad8ef478c17 100644 (file)
@@ -132,9 +132,11 @@ class UiPollEditor {
         this.reset();
       });
 
-      listenToCkeditor(element).collectMetaData((payload) => {
-        payload.metaData.poll = this.#getPollData();
-      });
+      listenToCkeditor(element)
+        .collectMetaData((payload) => {
+          payload.metaData.poll = this.#getPollData();
+        })
+        .reset(() => this.reset());
 
       ["handleError", "submit", "validate"].forEach((event) => {
         EventHandler.add("com.woltlab.wcf.ckeditor5", event + "_" + this.wysiwygId, (...args: unknown[]) =>
index 7d31f1da76bfb79f99e3be4646c86ce996430409..be710d406f5d6f7844981d33679dc58dabd46092 100644 (file)
@@ -73,9 +73,11 @@ define(["require", "exports", "tslib", "../../Core", "../../Language", "../Sorta
                 element.addEventListener("reset", () => {
                     this.reset();
                 });
-                (0, Event_1.listenToCkeditor)(element).collectMetaData((payload) => {
+                (0, Event_1.listenToCkeditor)(element)
+                    .collectMetaData((payload) => {
                     payload.metaData.poll = this.#getPollData();
-                });
+                })
+                    .reset(() => this.reset());
                 ["handleError", "submit", "validate"].forEach((event) => {
                     EventHandler.add("com.woltlab.wcf.ckeditor5", event + "_" + this.wysiwygId, (...args) => this[event](...args));
                 });