mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 05:27:03 +03:00
Submission notice now saves on submission
This commit is contained in:
@@ -26,6 +26,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
|
|||||||
callback: () => any;
|
callback: () => any;
|
||||||
|
|
||||||
noticeRef: React.MutableRefObject<NoticeComponent>;
|
noticeRef: React.MutableRefObject<NoticeComponent>;
|
||||||
|
timeEditRefs: React.RefObject<SponsorTimeEditComponent>[];
|
||||||
|
|
||||||
constructor(props: SubmissionNoticeProps) {
|
constructor(props: SubmissionNoticeProps) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -95,18 +96,24 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
|
|||||||
|
|
||||||
getSponsorTimeMessages(): JSX.Element[] | JSX.Element {
|
getSponsorTimeMessages(): JSX.Element[] | JSX.Element {
|
||||||
let elements: JSX.Element[] = [];
|
let elements: JSX.Element[] = [];
|
||||||
|
this.timeEditRefs = [];
|
||||||
|
|
||||||
let sponsorTimes = this.props.contentContainer().sponsorTimesSubmitting;
|
let sponsorTimes = this.props.contentContainer().sponsorTimesSubmitting;
|
||||||
|
|
||||||
for (let i = 0; i < sponsorTimes.length; i++) {
|
for (let i = 0; i < sponsorTimes.length; i++) {
|
||||||
|
let timeRef = React.createRef<SponsorTimeEditComponent>();
|
||||||
|
|
||||||
elements.push(
|
elements.push(
|
||||||
<SponsorTimeEditComponent key={i}
|
<SponsorTimeEditComponent key={i}
|
||||||
idSuffix={this.state.idSuffix}
|
idSuffix={this.state.idSuffix}
|
||||||
index={i}
|
index={i}
|
||||||
contentContainer={this.props.contentContainer}
|
contentContainer={this.props.contentContainer}
|
||||||
submissionNotice={this}>
|
submissionNotice={this}
|
||||||
|
ref={timeRef}>
|
||||||
</SponsorTimeEditComponent>
|
</SponsorTimeEditComponent>
|
||||||
)
|
);
|
||||||
|
|
||||||
|
this.timeEditRefs.push(timeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
return elements;
|
return elements;
|
||||||
@@ -134,6 +141,11 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
|
|||||||
}
|
}
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
|
// save all items
|
||||||
|
for (const ref of this.timeEditRefs) {
|
||||||
|
ref.current.saveEditTimes();
|
||||||
|
}
|
||||||
|
|
||||||
this.props.callback();
|
this.props.callback();
|
||||||
|
|
||||||
this.cancel();
|
this.cancel();
|
||||||
|
|||||||
Reference in New Issue
Block a user