Discard the draft before destroying the editor instance
authorAlexander Ebert <ebert@woltlab.com>
Fri, 28 Apr 2023 13:56:23 +0000 (15:56 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 28 Apr 2023 13:56:23 +0000 (15:56 +0200)
Fixes #5462

ts/WoltLabSuite/Core/Ui/Message/InlineEditor.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js

index 063a9b02fc41668d1d303d76df908c15e4fa024e..3ff9de746d5001d92f0235ade227f1d53eb6c996 100644 (file)
@@ -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) {
index afac8a09c9d80a2831ccd7b1ca54198f379d55e2..cfd1eec30fdd04121dc933d38a796c611c3e8cfe 100644 (file)
@@ -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();