From 0e1bbfb71354c21b978e4f71551de00674b83603 Mon Sep 17 00:00:00 2001 From: Yi Lei Feng Date: Tue, 17 Oct 2023 11:52:33 -0400 Subject: [PATCH] undo changes made to save slide changes --- src/components/editor/dynamic-editor.vue | 14 ++++++-------- src/components/editor/editor.vue | 19 ++++++++++++------- src/components/editor/slide-editor.vue | 14 ++++++-------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/components/editor/dynamic-editor.vue b/src/components/editor/dynamic-editor.vue index 1fc66ecd..afb31877 100644 --- a/src/components/editor/dynamic-editor.vue +++ b/src/components/editor/dynamic-editor.vue @@ -250,14 +250,12 @@ export default class DynamicEditorV extends Vue { } saveChanges(): void { - this.$nextTick(() => { - if ( - this.$refs.slide !== undefined && - typeof (this.$refs.slide as ImageEditorV | ChartEditorV).saveChanges === 'function' - ) { - (this.$refs.slide as ImageEditorV | ChartEditorV).saveChanges(); - } - }); + if ( + this.$refs.slide !== undefined && + typeof (this.$refs.slide as ImageEditorV | ChartEditorV).saveChanges === 'function' + ) { + (this.$refs.slide as ImageEditorV | ChartEditorV).saveChanges(); + } } } diff --git a/src/components/editor/editor.vue b/src/components/editor/editor.vue index 74a1d050..07f05409 100644 --- a/src/components/editor/editor.vue +++ b/src/components/editor/editor.vue @@ -242,14 +242,19 @@ export default class EditorV extends Vue { preview(): void { // save current slide final changes before previewing product if (this.$refs.slide !== undefined) { - (this.$refs.slide as SlideEditorV).saveChanges(); + this.$nextTick(() => { + (this.$refs.slide as SlideEditorV).saveChanges(); + }); } - const routeData = this.$router.resolve({ name: 'preview' }); - const previewTab = window.open(routeData.href, '_blank'); - (previewTab as Window).props = { - config: JSON.parse(JSON.stringify(this.configs[this.configLang])), - configFileStructure: this.configFileStructure - }; + + setTimeout(() => { + const routeData = this.$router.resolve({ name: 'preview' }); + const previewTab = window.open(routeData.href, '_blank'); + (previewTab as Window).props = { + config: JSON.parse(JSON.stringify(this.configs[this.configLang])), + configFileStructure: this.configFileStructure + }; + }, 5); } saveChanges(): void { diff --git a/src/components/editor/slide-editor.vue b/src/components/editor/slide-editor.vue index 855d05a5..67972de4 100644 --- a/src/components/editor/slide-editor.vue +++ b/src/components/editor/slide-editor.vue @@ -397,14 +397,12 @@ export default class SlideEditorV extends Vue { } saveChanges(): void { - this.$nextTick(() => { - if ( - this.$refs.editor !== undefined && - typeof (this.$refs.editor as ImageEditorV | ChartEditorV).saveChanges === 'function' - ) { - (this.$refs.editor as ImageEditorV | ChartEditorV).saveChanges(); - } - }); + if ( + this.$refs.editor !== undefined && + typeof (this.$refs.editor as ImageEditorV | ChartEditorV).saveChanges === 'function' + ) { + (this.$refs.editor as ImageEditorV | ChartEditorV).saveChanges(); + } } selectSlide(index: number): void {