gutenberg
gutenberg copied to clipboard
Add `tel:` when linking phone numbers
What problem does this address?
When adding a link to email addresses, we automatically apply the mailto: for the link. It would be great to do this for telephone numbers too.
What is your proposed solution?
Follow the same route as https://github.com/WordPress/gutenberg/pull/14857. The biggest hurdle would be getting the regex for phone numbers.
Hi @jeryj I have raised a PR for the same.
Phone Number Regex: ^\+?(\d{1,3})?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$
- Optional country code: With or without + (e.g., +1, 1, +44).
- Area code: 3 digits, with or without parentheses (e.g., 123, (123)).
- Separators: Optional hyphen, dot, or space between parts.
- Local number: 3 digits
- Separators: Optional hyphen, dot, or space between parts.
- Local number: 4 digits