Save edits before previewing

This commit is contained in:
Ajay Ramachandran
2020-04-01 20:24:50 -04:00
parent 242fbf8009
commit 7727cd56db

View File

@@ -161,14 +161,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
editing: false editing: false
}); });
// Save sponsorTimes this.saveEditTimes();
this.props.contentContainer().sponsorTimesSubmitting[this.props.index] =
[utils.getRawSeconds(this.state.sponsorTimeEdits[0][0], this.state.sponsorTimeEdits[0][1]),
utils.getRawSeconds(this.state.sponsorTimeEdits[1][0], this.state.sponsorTimeEdits[1][1])];
Config.config.sponsorTimes.set(this.props.contentContainer().sponsorVideoID, this.props.contentContainer().sponsorTimesSubmitting);
this.props.contentContainer().updatePreviewBar();
} else { } else {
let sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index]; let sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index];
@@ -180,20 +173,27 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
} }
} }
saveEditTimes() {
// Save sponsorTimes
this.props.contentContainer().sponsorTimesSubmitting[this.props.index] =
[utils.getRawSeconds(this.state.sponsorTimeEdits[0][0], this.state.sponsorTimeEdits[0][1]),
utils.getRawSeconds(this.state.sponsorTimeEdits[1][0], this.state.sponsorTimeEdits[1][1])];
Config.config.sponsorTimes.set(this.props.contentContainer().sponsorVideoID, this.props.contentContainer().sponsorTimesSubmitting);
this.props.contentContainer().updatePreviewBar();
}
previewTime(): void { previewTime(): void {
let sponsorTimes = this.props.contentContainer().sponsorTimesSubmitting; let sponsorTimes = this.props.contentContainer().sponsorTimesSubmitting;
let index = this.props.index; let index = this.props.index;
let skipTime = sponsorTimes[index][0]; let skipTime = sponsorTimes[index][0];
// if (document.getElementById("startTimeMinutes" + index) != null) { if (this.state.editing) {
// //edit is currently open, use that time // Save edits before previewing
this.saveEditTimes();
// skipTime = getSponsorTimeEditTimes("startTime", index); }
// //save the edit
// saveSponsorTimeEdit(index, false);
// }
this.props.contentContainer().previewTime(skipTime - 2); this.props.contentContainer().previewTime(skipTime - 2);
} }