Components/create-edit-modal: add validation to image controls

This commit is contained in:
Toast 2025-02-06 18:45:45 +01:00
parent b2cfda8c32
commit f839706d05

View file

@ -55,7 +55,8 @@ export class CreateEditModalComponent {
}
protected addImageControl() {
this.images.push(new FormControl(""))
const urlRegex: string = '(https?://)?([\\da-z.-]+)\\.([a-z.]{2,6})[/\\w .-]*/?'
this.images.push(new FormControl("", [Validators.required, Validators.pattern(urlRegex)]))
}
protected removeImageControl(index: number) {