From b8c1d70a669f354757272dbdf5b76dfb63683f6c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 9 May 2023 15:44:07 +0200 Subject: [PATCH] Reset the poll editor on editor reset Fixes #5492 --- ts/WoltLabSuite/Core/Ui/Poll/Editor.ts | 8 +++++--- .../install/files/js/WoltLabSuite/Core/Ui/Poll/Editor.js | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ts/WoltLabSuite/Core/Ui/Poll/Editor.ts b/ts/WoltLabSuite/Core/Ui/Poll/Editor.ts index 1d0afc3973..df6e9bc344 100644 --- a/ts/WoltLabSuite/Core/Ui/Poll/Editor.ts +++ b/ts/WoltLabSuite/Core/Ui/Poll/Editor.ts @@ -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[]) => diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Poll/Editor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Poll/Editor.js index 7d31f1da76..be710d406f 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Poll/Editor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Poll/Editor.js @@ -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)); }); -- 2.20.1