diff --git a/src/components/edit-menu/resize-document/messages.json b/src/components/edit-menu/resize-document/messages.json index fa27c6e..46cffe0 100644 --- a/src/components/edit-menu/resize-document/messages.json +++ b/src/components/edit-menu/resize-document/messages.json @@ -2,6 +2,8 @@ "en-US": { "resizeDocument": "Resize document", "maintainAspectRatio": "Maintain aspect ratio", + "areYouSure": "Are you sure?", + "resizeIsPermanent": "Resizing a document is permanent and cannot be undone.", "save": "Save", "cancel": "Cancel" } diff --git a/src/components/edit-menu/resize-document/resize-document.vue b/src/components/edit-menu/resize-document/resize-document.vue index bd1f2b3..80ea541 100644 --- a/src/components/edit-menu/resize-document/resize-document.vue +++ b/src/components/edit-menu/resize-document/resize-document.vue @@ -116,21 +116,31 @@ export default { "closeModal", "setActiveDocumentSize", "resizeActiveDocumentContent", + "openDialog", + "resetHistory" ]), - lockSync() { + async lockSync() { this.syncLock = true; - this.$nextTick(() => { - this.syncLock = false; - }); + await this.$nextTick(); + this.syncLock = false; }, - async save() { - const { width, height } = this.dimensions; - const scaleX = width / this.activeDocument.width; - const scaleY = height / this.activeDocument.height; + save() { + this.openDialog({ + type: "confirm", + title: this.$t( "areYouSure" ), + message: this.$t( "resizeIsPermanent" ), + confirm: async () => { + const { width, height } = this.dimensions; + const scaleX = width / this.activeDocument.width; + const scaleY = height / this.activeDocument.height; - await this.resizeActiveDocumentContent({ scaleX, scaleY }); - this.setActiveDocumentSize({ width: Math.round( width ), height: Math.round( height ) }); - this.closeModal(); + await this.resizeActiveDocumentContent({ scaleX, scaleY }); + this.setActiveDocumentSize({ width: Math.round( width ), height: Math.round( height ) }); + this.resetHistory(); + this.closeModal(); + }, + cancel: () => {}, + }); }, } };