From 9910d4b969f8c78d5e14efa7cc22548692157b7e Mon Sep 17 00:00:00 2001 From: Tiago Cerqueira Date: Wed, 2 May 2018 11:15:56 +0200 Subject: [PATCH] Fix tel links, no more .html when you are using it --- lib/default-theme/NavLink.vue | 9 +++++---- lib/default-theme/util.js | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/default-theme/NavLink.vue b/lib/default-theme/NavLink.vue index 63104cce26..c172e37520 100644 --- a/lib/default-theme/NavLink.vue +++ b/lib/default-theme/NavLink.vue @@ -9,13 +9,13 @@ v-else :href="link" class="nav-link" - :target="isMailto(link) ? null : '_blank'" - :rel="isMailto(link) ? null : 'noopener noreferrer'" + :target="isMailto(link) || isTel(link) ? null : '_blank'" + :rel="isMailto(link) || isTel(link) ? null : 'noopener noreferrer'" >{{ item.text }} diff --git a/lib/default-theme/util.js b/lib/default-theme/util.js index 5aafb431bb..22192591bb 100644 --- a/lib/default-theme/util.js +++ b/lib/default-theme/util.js @@ -1,7 +1,7 @@ export const hashRE = /#.*$/ export const extRE = /\.(md|html)$/ export const endingSlashRE = /\/$/ -export const outboundRE = /^(https?:|mailto:)/ +export const outboundRE = /^(https?:|mailto:|tel:)/ export function normalize (path) { return path @@ -24,6 +24,10 @@ export function isMailto (path) { return /^mailto:/.test(path) } +export function isTel (path) { + return /^tel:/.test(path) +} + export function ensureExt (path) { if (isExternal(path)) { return path