From d0706b376bd3c449b8cfc6a1492c2b1624c21973 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sun, 26 Jan 2020 13:29:17 -0500 Subject: [PATCH] feat: ctrl + click save in editor to save and close --- client/components/editor.vue | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/client/components/editor.vue b/client/components/editor.vue index 7a153427..77078ae8 100644 --- a/client/components/editor.vue +++ b/client/components/editor.vue @@ -9,7 +9,8 @@ v-btn.animated.fadeInDown( text color='green' - @click.native.stop='save' + @click='save' + @click.ctrl.exact='saveAndClose' :class='{ "is-icon": $vuetify.breakpoint.mdAndDown }' ) v-icon(color='green', :left='$vuetify.breakpoint.lgAndUp') mdi-check @@ -17,7 +18,7 @@ v-btn.animated.fadeInDown.wait-p1s( text color='blue' - @click.native.stop='openPropsModal' + @click='openPropsModal' :class='{ "is-icon": $vuetify.breakpoint.mdAndDown, "mx-0": !welcomeMode, "ml-0": welcomeMode }' ) v-icon(color='blue', :left='$vuetify.breakpoint.lgAndUp') mdi-tag-text-outline @@ -27,7 +28,7 @@ text color='red' :class='{ "is-icon": $vuetify.breakpoint.mdAndDown }' - @click.native.stop='exit' + @click='exit' ) v-icon(color='red', :left='$vuetify.breakpoint.lgAndUp') mdi-close span.white--text(v-if='$vuetify.breakpoint.lgAndUp') {{ $t('common:actions.close') }} @@ -270,9 +271,18 @@ export default { style: 'error', icon: 'warning' }) + throw err } this.hideProgressDialog() }, + async saveAndClose() { + try { + await this.save() + await this.exit() + } catch (err) { + // Error is already handled + } + }, async exit() { if (this.initContentParsed !== this.$store.get('editor/content')) { this.dialogUnsaved = true