feat(ui): route all in-app external links through Telegram openLink
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 49s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 59s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 49s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 59s
Extend the openLink routing from the dictionary lookup to every external
link shown inside the Mini App, so none triggers the WebView's 'open this
link?' confirmation. A shared onExternalLinkClick handler resolves the anchor
via closest() (so it also works delegated on {@html} content), backed by a
pure routeExternalLinkInTelegram decision: only inside Telegram, only an
external http(s) target=_blank link, excluding same-origin/in-app and t.me
links (t.me keeps openTelegramLink). Applied to the word-check lookup, the
About rules link, the Feedback operator-reply links, and the feature-gated
announcement banner.
Outside Telegram every anchor keeps its native target=_blank.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import { t } from '../lib/i18n/index.svelte';
|
||||
import { alphabetLetters } from '../lib/alphabet';
|
||||
import { canCheckWord, dictionaryLookupUrl, sanitizeCheckWord } from '../lib/checkword';
|
||||
import { telegramOpenExternalLink } from '../lib/telegram';
|
||||
import { onExternalLinkClick } from '../lib/telegram';
|
||||
import type { Variant } from '../lib/model';
|
||||
|
||||
// Word-check on its own screen: unlimited dictionary lookups, each with a
|
||||
@@ -58,12 +58,6 @@
|
||||
handleError(e);
|
||||
}
|
||||
}
|
||||
// Inside Telegram, route the dictionary link through the Mini App SDK so Telegram opens it in
|
||||
// its in-app browser instead of the WebView's "open this link?" confirmation; in a plain
|
||||
// browser the anchor's own target=_blank handles it.
|
||||
function openLookup(e: MouseEvent) {
|
||||
if (telegramOpenExternalLink((e.currentTarget as HTMLAnchorElement).href)) e.preventDefault();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="wrap">
|
||||
@@ -90,7 +84,7 @@
|
||||
href={dictionaryLookupUrl(result.word, variant)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onclick={openLookup}>{t('game.lookup')}</a>
|
||||
onclick={onExternalLinkClick}>{t('game.lookup')}</a>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user