Add support for 'contact:email','contact:phone' and 'contact:website' (write to 'email', 'phone' and 'website' if changed) - fix #601; remove 'tel:' from phone addresses - fix #602; small fixes to tag preview in case of deletion

This commit is contained in:
Pieter Vander Vennet 2022-01-05 17:08:35 +01:00
parent a35b1d34f4
commit 4fd30d1a62
4 changed files with 39 additions and 7 deletions

View file

@ -406,9 +406,17 @@ export default class ValidatedTextField {
if (str === undefined) {
return false;
}
if(str.startsWith("tel:")){
str = str.substring("tel:".length)
}
return parsePhoneNumberFromString(str, (country())?.toUpperCase() as any)?.isValid() ?? false
},
(str, country: () => string) => parsePhoneNumberFromString(str, (country())?.toUpperCase() as any).formatInternational(),
(str, country: () => string) => {
if(str.startsWith("tel:")){
str = str.substring("tel:".length)
}
return parsePhoneNumberFromString(str, (country())?.toUpperCase() as any).formatInternational();
},
undefined,
"tel"
),