From 3e18db8c39b77399e5c0148147f319f28166d273 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 28 Apr 2023 15:56:23 +0200 Subject: [PATCH] Discard the draft before destroying the editor instance Fixes #5462 --- ts/WoltLabSuite/Core/Ui/Message/InlineEditor.ts | 4 ++-- .../files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ts/WoltLabSuite/Core/Ui/Message/InlineEditor.ts b/ts/WoltLabSuite/Core/Ui/Message/InlineEditor.ts index 063a9b02fc..3ff9de746d 100644 --- a/ts/WoltLabSuite/Core/Ui/Message/InlineEditor.ts +++ b/ts/WoltLabSuite/Core/Ui/Message/InlineEditor.ts @@ -577,12 +577,12 @@ class UiMessageInlineEditor implements AjaxCallbackObject { } } + getCkeditorById(this._getEditorId())!.discardDraft(); + this._restoreMessage(); this._updateHistory(this._getHash(this._getObjectId(activeElement))); - getCkeditorById(this._getEditorId())!.discardDraft(); - UiNotification.show(); if (this._options.quoteManager) { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js index afac8a09c9..cfd1eec30f 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js @@ -452,9 +452,9 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Component/Ckeditor/Eve elementData.messageBody.insertAdjacentElement("afterbegin", pollContainer); } } + (0, Ckeditor_1.getCkeditorById)(this._getEditorId()).discardDraft(); this._restoreMessage(); this._updateHistory(this._getHash(this._getObjectId(activeElement))); - (0, Ckeditor_1.getCkeditorById)(this._getEditorId()).discardDraft(); UiNotification.show(); if (this._options.quoteManager) { this._options.quoteManager.clearAlternativeEditor(); -- 2.20.1