From 23ce8f0927afe8f72da27a8240f99dc965bcf4a3 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Sat, 28 Jan 2023 02:15:53 +0100 Subject: [PATCH] Safe Link: Fix opening search-highlighted links (#2368) --- src/components/common/SafeLink.tsx | 3 ++- src/components/common/WebLink.tsx | 8 ++++---- src/components/payment/Checkout.tsx | 6 ++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/common/SafeLink.tsx b/src/components/common/SafeLink.tsx index c9792658f..faf5be892 100644 --- a/src/components/common/SafeLink.tsx +++ b/src/components/common/SafeLink.tsx @@ -29,10 +29,11 @@ const SafeLink: FC = ({ const { openUrl } = getActions(); const content = children || text; - const isSafe = url === content; + const isSafe = url === text; const handleClick = useCallback((e: React.MouseEvent) => { if (!url) return true; + e.preventDefault(); openUrl({ url, shouldSkipModal: isSafe }); diff --git a/src/components/common/WebLink.tsx b/src/components/common/WebLink.tsx index 36ebc3453..b4d7a895c 100644 --- a/src/components/common/WebLink.tsx +++ b/src/components/common/WebLink.tsx @@ -84,6 +84,8 @@ const WebLink: FC = ({ (!photo && !video) && 'without-media', ); + const safeLinkContent = url.replace('mailto:', '') || displayUrl; + return (
= ({ - {url.replace('mailto:', '') || displayUrl} - + /> {senderTitle &&
{renderText(senderTitle)}
}
{senderTitle && ( diff --git a/src/components/payment/Checkout.tsx b/src/components/payment/Checkout.tsx index aed2560e8..335be29b6 100644 --- a/src/components/payment/Checkout.tsx +++ b/src/components/payment/Checkout.tsx @@ -131,11 +131,9 @@ const Checkout: FC = ({ {langStringSplit[0]} - {langStringSplit[1]} - + /> {langStringSplit.slice(2)} );