mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 13:07:05 +03:00
Save edits before previewing
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user