Skip to content

Commit 702b859

Browse files
pilzthet
authored andcommitted
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
1 parent 1c0e402 commit 702b859

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130

131131
### Features
132132

133+
- pat-inject: Don't rebase for some additional known prefixes to avoid that the links break when contained in an injected page snippet.
133134
- pat-gallery: Allow adding images directly to the gallery.
134135
- pat-validation: Allow for HTML5 style `required` attributes without a value.
135136
- pat-validation: Added the possibility to check for fields equality

src/pat/inject/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ <h3>Inject and fix URLs of options</h3>
420420
class="pat-inject"
421421
data-pat-inject="url:./index.html#rebase-url-demo; target: self::element"
422422
>
423-
injection happens here!
423+
injection happens here! <a href="tel:3632347">Call for help</a>
424424
</button>
425425
</div>
426426
</section>

src/pat/inject/inject.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,11 @@ const inject = {
911911
value.slice(0, 2) !== "@@" &&
912912
value[0] !== "#" &&
913913
value.slice(0, 7) !== "mailto:" &&
914+
value.slice(0, 4) !== "tel:" &&
915+
value.slice(0, 4) !== "fax:" &&
916+
value.slice(0, 7) !== "callto:" &&
917+
value.slice(0, 10) !== "ts3server:" &&
918+
value.slice(0, 6) !== "teams:" &&
914919
value.slice(0, 11) !== "javascript:"
915920
) {
916921
value = utils.rebaseURL(base, value);

0 commit comments

Comments
 (0)