feat(ui): external dictionary lookup link on the word-check tool
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 48s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 56s
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 48s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 56s
When a checked word is found, show a 'look it up' text link beside the complaint button that opens an external reference dictionary in a new tab: gramota.ru for the Russian variants, scrabblewordfinder.org for English (word lower-cased and percent-encoded). The link hides for a word that is not found. Inside Telegram it routes through the Mini App SDK's openLink, so Telegram opens it directly instead of the WebView's 'open this link?' confirmation; in a browser the anchor's own target=_blank handles it. Relabel the complaint button to 'Возражаю' (ru); English stays 'Disagree'.
This commit is contained in:
@@ -18,6 +18,7 @@ interface TelegramWebApp {
|
||||
expand?: () => void;
|
||||
requestFullscreen?: () => void;
|
||||
openTelegramLink?: (url: string) => void;
|
||||
openLink?: (url: string) => void;
|
||||
onEvent?: (event: string, handler: () => void) => void;
|
||||
setHeaderColor?: (color: string) => void;
|
||||
setBackgroundColor?: (color: string) => void;
|
||||
@@ -65,6 +66,20 @@ export function telegramOpenLink(url: string): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* telegramOpenExternalLink opens an arbitrary external URL through the Mini App SDK's openLink,
|
||||
* so Telegram opens it directly in its in-app browser instead of the WebView's generic "open
|
||||
* this link?" confirmation that a plain target=_blank navigation triggers. Returns false
|
||||
* outside Telegram or when the SDK lacks the method, so the caller can fall back to a normal
|
||||
* anchor.
|
||||
*/
|
||||
export function telegramOpenExternalLink(url: string): boolean {
|
||||
const w = webApp();
|
||||
if (!w?.openLink) return false;
|
||||
w.openLink(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* shareTelegramLink opens Telegram's native "share to a chat" picker for url with a
|
||||
* caption, through the Mini App SDK (https://t.me/share/url). Returns false outside
|
||||
|
||||
Reference in New Issue
Block a user