Skip to content

Commit

Permalink
Merge pull request #410 from IshavSohal/issue-390
Browse files Browse the repository at this point in the history
Prevent removal of source content on panel type swap
  • Loading branch information
yileifeng authored Oct 25, 2024
2 parents 17398a4 + a6faf84 commit 416ec60
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/components/image-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ export default class ImageEditorV extends Vue {
// Check if the config file exists in the ZIP folder first.
const assetSrc = `${image.src.substring(image.src.indexOf('/') + 1)}`;
const filename = image.src.replace(/^.*[\\/]/, '');
const assetFile = this.configFileStructure.zip.file(assetSrc);
if (assetFile) {
this.imagePreviewPromises.push(
Expand Down
8 changes: 5 additions & 3 deletions src/components/slide-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -504,15 +504,17 @@ export default class SlideEditorV extends Vue {
}
};
// Before swapping panel type, update sources from the to-be-deleted config.
this.currentSlide.panel.forEach((panel: BasePanel) => this.removeSourceCounts(panel));
// When switching to a dynamic panel, remove the secondary panel.
if (newType === 'dynamic') {
// Remove source content of both panels
this.currentSlide.panel.forEach((panel: BasePanel) => this.removeSourceCounts(panel));
this.panelIndex = 0;
this.currentSlide['panel'] = [startingConfig[newType as keyof DefaultConfigs]];
this.dynamicSelected = true;
} else {
// Remove source content of panel having its type swapped
this.removeSourceCounts(this.currentSlide.panel[this.panelIndex]);
// Switching panel type when dynamic panels are not involved.
this.currentSlide.panel[this.panelIndex] = startingConfig[newType as keyof DefaultConfigs];
}
Expand Down
5 changes: 1 addition & 4 deletions src/components/video-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,7 @@ export default class VideoEditorV extends Vue {
onVideoEdited(): void {
this.edited = true;
this.$emit(
'slide-edit',
(this.videoPreview?.videoType || this.videoPreview?.title?.length) ? true : false
);
this.$emit('slide-edit', this.videoPreview?.videoType || this.videoPreview?.title?.length ? true : false);
}
}
</script>
Expand Down

0 comments on commit 416ec60

Please sign in to comment.