mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-27 01:51:34 +08:00
feat(time_selector): add minimumSeconds handling
This commit is contained in:
parent
0332ade13c
commit
bb4c3ae6ff
@ -74,7 +74,8 @@ export default class TimeSelector extends OptionsWidget {
|
|||||||
|
|
||||||
if (!this.handleTimeValidation() || typeof timeScale !== "string" || !time) return;
|
if (!this.handleTimeValidation() || typeof timeScale !== "string" || !time) return;
|
||||||
|
|
||||||
this.internalTimeInSeconds = this.convertTime(time, timeScale).toOption();
|
this.setInternalTimeInSeconds(this.convertTime(time, timeScale).toOption());
|
||||||
|
|
||||||
this.updateOption(this.optionValueId, this.internalTimeInSeconds);
|
this.updateOption(this.optionValueId, this.internalTimeInSeconds);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -122,4 +123,13 @@ export default class TimeSelector extends OptionsWidget {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private setInternalTimeInSeconds(time: number) {
|
||||||
|
if (time < this.minimumSeconds) {
|
||||||
|
toastService.showError(`Entered time needs to be at least ${this.minimumSeconds} seconds.`);
|
||||||
|
return this.internalTimeInSeconds = this.minimumSeconds;
|
||||||
|
}
|
||||||
|
return this.internalTimeInSeconds = time;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user