forked from MapComplete/MapComplete
Remove mailto: prefix automatically in the email field
This commit is contained in:
parent
83641d2494
commit
9916371122
1 changed files with 13 additions and 2 deletions
|
@ -350,8 +350,19 @@ export default class ValidatedTextField {
|
||||||
ValidatedTextField.tp(
|
ValidatedTextField.tp(
|
||||||
"email",
|
"email",
|
||||||
"An email adress",
|
"An email adress",
|
||||||
(str) => EmailValidator.validate(str),
|
(str) => {
|
||||||
undefined,
|
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,
|
undefined,
|
||||||
"email"),
|
"email"),
|
||||||
ValidatedTextField.tp(
|
ValidatedTextField.tp(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue