diff --git a/frontend/src/components/prompts/DiscardEditorChanges.vue b/frontend/src/components/prompts/DiscardEditorChanges.vue
index 4c1e5faa..bd6bc49a 100644
--- a/frontend/src/components/prompts/DiscardEditorChanges.vue
+++ b/frontend/src/components/prompts/DiscardEditorChanges.vue
@@ -11,17 +11,26 @@
@click="closeHovers"
:aria-label="$t('buttons.cancel')"
:title="$t('buttons.cancel')"
- tabindex="2"
+ tabindex="3"
>
{{ $t("buttons.cancel") }}
+
@@ -40,6 +49,12 @@ export default {
},
methods: {
...mapActions(useLayoutStore, ["closeHovers"]),
+ saveAndClose() {
+ if (this.currentPrompt?.saveAction) {
+ this.currentPrompt.saveAction();
+ }
+ this.closeHovers();
+ },
},
};
diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json
index 7de128ed..4070619d 100644
--- a/frontend/src/i18n/en.json
+++ b/frontend/src/i18n/en.json
@@ -42,7 +42,8 @@
"update": "Update",
"upload": "Upload",
"openFile": "Open file",
- "discardChanges": "Discard"
+ "discardChanges": "Discard",
+ "saveChanges": "Save changes"
},
"download": {
"downloadFile": "Download File",
diff --git a/frontend/src/stores/layout.ts b/frontend/src/stores/layout.ts
index faf8bca7..372fca06 100644
--- a/frontend/src/stores/layout.ts
+++ b/frontend/src/stores/layout.ts
@@ -41,6 +41,7 @@ export const useLayoutStore = defineStore("layout", {
prompt: value,
confirm: null,
action: undefined,
+ saveAction: undefined,
props: null,
close: null,
});
@@ -51,6 +52,7 @@ export const useLayoutStore = defineStore("layout", {
prompt: value.prompt,
confirm: value?.confirm,
action: value?.action,
+ saveAction: value?.saveAction,
props: value?.props,
close: value?.close,
});
diff --git a/frontend/src/types/layout.d.ts b/frontend/src/types/layout.d.ts
index b625cc07..a5c3f160 100644
--- a/frontend/src/types/layout.d.ts
+++ b/frontend/src/types/layout.d.ts
@@ -2,6 +2,7 @@ interface PopupProps {
prompt: string;
confirm?: any;
action?: PopupAction;
+ saveAction?: () => void;
props?: any;
close?: (() => Promise) | null;
}
diff --git a/frontend/src/views/files/Editor.vue b/frontend/src/views/files/Editor.vue
index 8db6252b..13013a9f 100644
--- a/frontend/src/views/files/Editor.vue
+++ b/frontend/src/views/files/Editor.vue
@@ -157,6 +157,10 @@ onBeforeRouteUpdate((to, from, next) => {
event.preventDefault();
next();
},
+ saveAction: async () => {
+ await save();
+ next();
+ },
});
});