feat: enhance mailto/tel link handling and streamline imports

- Introduced isMailOrTelLink utility function to validate mailto/tel links.
- Updated getPageProperties to properly handle mailto/tel links with target=_self, preventing unintended conversion to internal links by avoiding the addition of slashes.

Closes #3485
This commit is contained in:
anime
2025-07-08 22:59:08 +08:00
parent 5e6fa26c90
commit 645edd7ead
2 changed files with 15 additions and 6 deletions

View File

@@ -104,6 +104,15 @@ export function checkStartWithHttp(str) {
}
}
/**
* 检查是否是邮件或电话链接
* @param href
* @returns {boolean}
*/
export function isMailOrTelLink(href) {
return /^(mailto:|tel:)/i.test(href)
}
// 检查一个字符串是否UUID https://ihateregex.io/expr/uuid/
export function checkStrIsUuid(str) {
if (!str) {