feat: prompt to confirm discard editor changes (#2948)

* chore: update he.json

* feat: prompt to confirm discard editor changes

---------

Co-authored-by: Oleg Lobanov <oleg@lobanov.me>
This commit is contained in:
Shlomo
2024-01-30 11:48:03 +02:00
committed by GitHub
parent b19710efca
commit fb1a09c7c1
5 changed files with 63 additions and 9 deletions

View File

@@ -107,10 +107,6 @@ export default {
this.editor.focus();
},
methods: {
back() {
let uri = url.removeLastDir(this.$route.path) + "/";
this.$router.push({ path: uri });
},
keyEvent(event) {
if (event.code === "Escape") {
this.close();
@@ -140,6 +136,13 @@ export default {
}
},
close() {
const originalContent = this.req.content;
const currentContent = this.editor.getValue();
if (originalContent !== currentContent) {
this.$store.commit("showHover", "discardEditorChanges");
return;
}
this.$store.commit("updateRequest", {});
let uri = url.removeLastDir(this.$route.path) + "/";