Skip to content

Commit 128e358

Browse files
committed
fix bug when deleting captions
1 parent 3022cc6 commit 128e358

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/renderer/class/CaptionManager.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ class CaptionManager {
7474
store.dispatch('setIsUnsavedChanges', { isUnsavedChanges: true });
7575
}
7676

77+
// reset the data obect everytime the JSON updates rather than just update the captions that need it
78+
// because otherwise when the editor is in "code" mode, any deletions will get overwritten
79+
this.data = {};
80+
7781
Object.keys($event).forEach((key) => {
7882
$event[key].forEach((caption, index) => {
7983

src/renderer/components/caption-studio/JsonPreview.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export default {
8686
currentMode: 'form',
8787
options: {
8888
onChangeText: this.onEdit,
89-
modes: [ 'form', 'code'],
89+
modes: [ 'form', 'code' ],
9090
onEvent: this.onEvent,
9191
onModeChange: this.onModeChange,
9292
},
@@ -153,7 +153,9 @@ export default {
153153
} catch {
154154
return;
155155
}
156+
156157
this.checkErrors(parsed, this.origin);
158+
157159
if (this.jsonErrors) {
158160
return;
159161
}

0 commit comments

Comments
 (0)