fix: editor discard prompt doesn't save nor discard
Co-authored-by: Ryan Miller <ryan.miller@infinitetactics.com>pull/5470/head^2
parent
d0039afbb7
commit
a397e7305d
|
|
@ -17,7 +17,7 @@
|
|||
</button>
|
||||
<button
|
||||
class="button button--flat button--blue"
|
||||
@click="saveAndClose"
|
||||
@click="currentPrompt.saveAction"
|
||||
:aria-label="$t('buttons.saveChanges')"
|
||||
:title="$t('buttons.saveChanges')"
|
||||
tabindex="1"
|
||||
|
|
@ -39,8 +39,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useLayoutStore } from "@/stores/layout";
|
||||
import { mapActions, mapState } from "pinia";
|
||||
|
||||
export default {
|
||||
name: "discardEditorChanges",
|
||||
|
|
@ -49,12 +49,6 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
...mapActions(useLayoutStore, ["closeHovers"]),
|
||||
saveAndClose() {
|
||||
if (this.currentPrompt?.saveAction) {
|
||||
this.currentPrompt.saveAction();
|
||||
}
|
||||
this.closeHovers();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -216,12 +216,24 @@ const decreaseFontSize = () => {
|
|||
|
||||
const close = () => {
|
||||
if (!editor.value?.session.getUndoManager().isClean()) {
|
||||
layoutStore.showHover("discardEditorChanges");
|
||||
layoutStore.showHover({
|
||||
prompt: "discardEditorChanges",
|
||||
confirm: (event: Event) => {
|
||||
event.preventDefault();
|
||||
finishClose();
|
||||
},
|
||||
saveAction: async () => {
|
||||
await save();
|
||||
finishClose();
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
finishClose();
|
||||
};
|
||||
|
||||
const finishClose = () => {
|
||||
fileStore.updateRequest(null);
|
||||
|
||||
const uri = url.removeLastDir(route.path) + "/";
|
||||
router.push({ path: uri });
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue