From 34a08170c894321d49bb843e259a0e59e2245998 Mon Sep 17 00:00:00 2001 From: zoui <56403136+Zouizoui78@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:01:41 +0100 Subject: [PATCH] fix: editor discard prompt (#2990) --- frontend/src/views/files/Editor.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/files/Editor.vue b/frontend/src/views/files/Editor.vue index e85ffa3b..bf0d47e2 100644 --- a/frontend/src/views/files/Editor.vue +++ b/frontend/src/views/files/Editor.vue @@ -129,6 +129,7 @@ export default { try { await api.put(this.$route.path, this.editor.getValue()); + this.editor.session.getUndoManager().markClean(); buttons.success(button); } catch (e) { buttons.done(button); @@ -136,9 +137,7 @@ export default { } }, close() { - const originalContent = this.req.content; - const currentContent = this.editor.getValue(); - if (originalContent !== currentContent) { + if (!this.editor.session.getUndoManager().isClean()) { this.$store.commit("showHover", "discardEditorChanges"); return; }