fix: editor discard prompt (#2990)
This commit is contained in:
parent
d49c3dfacf
commit
34a08170c8
|
@ -129,6 +129,7 @@ export default {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await api.put(this.$route.path, this.editor.getValue());
|
await api.put(this.$route.path, this.editor.getValue());
|
||||||
|
this.editor.session.getUndoManager().markClean();
|
||||||
buttons.success(button);
|
buttons.success(button);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
buttons.done(button);
|
buttons.done(button);
|
||||||
|
@ -136,9 +137,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
const originalContent = this.req.content;
|
if (!this.editor.session.getUndoManager().isClean()) {
|
||||||
const currentContent = this.editor.getValue();
|
|
||||||
if (originalContent !== currentContent) {
|
|
||||||
this.$store.commit("showHover", "discardEditorChanges");
|
this.$store.commit("showHover", "discardEditorChanges");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue