Remove mailto: prefix automatically in the email field

This commit is contained in:
pietervdvn 2021-12-30 22:28:03 +01:00
parent 83641d2494
commit 9916371122

View file

@ -350,8 +350,19 @@ export default class ValidatedTextField {
ValidatedTextField.tp(
"email",
"An email adress",
(str) => EmailValidator.validate(str),
undefined,
(str) => {
if(str.startsWith("mailto:")){
str = str.substring("mailto:".length)
}
return EmailValidator.validate(str);
},
str => {
if(str === undefined){return undefined}
if(str.startsWith("mailto:")){
str = str.substring("mailto:".length)
}
return str;
},
undefined,
"email"),
ValidatedTextField.tp(