Skip to content

Commit

Permalink
Delete subtitle on save and process
Browse files Browse the repository at this point in the history
Change prepareSubtitles for WorklfowConfiguration to honor deleted
subtitles.
  • Loading branch information
geichelberger committed Dec 9, 2024
1 parent 493fe13 commit 6ace5c0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/Save.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const SaveButton: React.FC<{
return t("save.success-tooltip-aria");
}
};

const prepareSubtitles = () =>
Object.entries(subtitles).map(([id, { deleted, cues, tags }]) => ({
id,
Expand Down
2 changes: 1 addition & 1 deletion src/main/SubtitleEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const SubtitleEditor: React.FC = () => {
try {
dispatch(setSubtitle({
identifier: selectedId,
subtitles: { cues: parseSubtitle(captionTrack.subtitle), tags: captionTrack.tags },
subtitles: { cues: parseSubtitle(captionTrack.subtitle), tags: captionTrack.tags, deleted: false },
}));
} catch (error) {
if (error instanceof Error) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/SubtitleSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ const SubtitleAddButton: React.FC<{
const id = values.selectedSubtitle;
const relatedSubtitle = subtitlesForDropdown.find(tag => tag.id === id);
const tags = relatedSubtitle ? relatedSubtitle.tags : [];
dispatch(setSubtitle({ identifier: id, subtitles: { cues: [], tags: tags } }));
dispatch(setSubtitle({ identifier: id, subtitles: { cues: [], tags: tags, delete: false } }));

// Reset
setIsPlusDisplay(true);
Expand Down

0 comments on commit 6ace5c0

Please sign in to comment.