From 6ace5c0eb9966d2bec25ff5a744448adc8c9f8fa Mon Sep 17 00:00:00 2001 From: Gregor Eichelberger Date: Thu, 5 Dec 2024 12:14:44 +0100 Subject: [PATCH] Delete subtitle on save and process Change prepareSubtitles for WorklfowConfiguration to honor deleted subtitles. --- src/main/Save.tsx | 1 + src/main/SubtitleEditor.tsx | 2 +- src/main/SubtitleSelect.tsx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/Save.tsx b/src/main/Save.tsx index 88da45893..75ecc09e9 100644 --- a/src/main/Save.tsx +++ b/src/main/Save.tsx @@ -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, diff --git a/src/main/SubtitleEditor.tsx b/src/main/SubtitleEditor.tsx index 87ece4ed5..ac3be666c 100644 --- a/src/main/SubtitleEditor.tsx +++ b/src/main/SubtitleEditor.tsx @@ -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) { diff --git a/src/main/SubtitleSelect.tsx b/src/main/SubtitleSelect.tsx index 1d3b29243..173919455 100644 --- a/src/main/SubtitleSelect.tsx +++ b/src/main/SubtitleSelect.tsx @@ -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);