From 702b8593f444f55471307f11f86b9a7e419e4428 Mon Sep 17 00:00:00 2001 From: Alexander Pilz Date: Fri, 12 Mar 2021 10:47:39 +0100 Subject: [PATCH] Don't rebase for some additional known prefixes to avoid that the links break when contained in an injected page snippet. This can certainly be made more generic, but for now, it hurts only for the tel links and is a good enough fix for me --- CHANGES.md | 1 + src/pat/inject/index.html | 2 +- src/pat/inject/inject.js | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index b9bf17528..8a9bf4a40 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -130,6 +130,7 @@ ### Features +- pat-inject: Don't rebase for some additional known prefixes to avoid that the links break when contained in an injected page snippet. - pat-gallery: Allow adding images directly to the gallery. - pat-validation: Allow for HTML5 style `required` attributes without a value. - pat-validation: Added the possibility to check for fields equality diff --git a/src/pat/inject/index.html b/src/pat/inject/index.html index 80791967d..31085e2a8 100644 --- a/src/pat/inject/index.html +++ b/src/pat/inject/index.html @@ -420,7 +420,7 @@

Inject and fix URLs of options

class="pat-inject" data-pat-inject="url:./index.html#rebase-url-demo; target: self::element" > - injection happens here! + injection happens here! Call for help diff --git a/src/pat/inject/inject.js b/src/pat/inject/inject.js index 17fffe0f9..c1af09a7e 100644 --- a/src/pat/inject/inject.js +++ b/src/pat/inject/inject.js @@ -911,6 +911,11 @@ const inject = { value.slice(0, 2) !== "@@" && value[0] !== "#" && value.slice(0, 7) !== "mailto:" && + value.slice(0, 4) !== "tel:" && + value.slice(0, 4) !== "fax:" && + value.slice(0, 7) !== "callto:" && + value.slice(0, 10) !== "ts3server:" && + value.slice(0, 6) !== "teams:" && value.slice(0, 11) !== "javascript:" ) { value = utils.rebaseURL(base, value);