Links: Fix word break (#5338)

This commit is contained in:
zubiden 2024-12-29 11:58:40 +01:00 committed by Alexander Zinchuk
parent 7e316db081
commit 3abd843dd5
4 changed files with 4 additions and 8 deletions

View File

@ -18,7 +18,6 @@ type OwnProps = {
text: string;
className?: string;
children?: TeactNode;
withNormalWordBreak?: boolean;
isRtl?: boolean;
};
@ -27,19 +26,18 @@ const SafeLink = ({
text,
className,
children,
withNormalWordBreak,
isRtl,
}: OwnProps) => {
const { openUrl } = getActions();
const content = children || text;
const isSafe = url === text;
const isRegularLink = url === text;
const handleClick = useLastCallback((e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
if (!url) return true;
e.preventDefault();
openUrl({ url, shouldSkipModal: isSafe });
openUrl({ url, shouldSkipModal: isRegularLink });
return false;
});
@ -50,7 +48,7 @@ const SafeLink = ({
const classNames = buildClassName(
className || 'text-entity-link',
!withNormalWordBreak && 'word-break-all',
isRegularLink && 'word-break-all',
);
return (

View File

@ -559,7 +559,6 @@ function processEntity({
<SafeLink
url={getLinkUrl(entityText, entity)}
text={entityText}
withNormalWordBreak
>
{renderNestedMessagePart()}
</SafeLink>

View File

@ -983,7 +983,7 @@
.text-entity-link {
color: var(--color-links) !important;
text-decoration: none !important;
word-break: break-word;
overflow-wrap: break-word;
cursor: var(--custom-cursor, pointer);
unicode-bidi: initial;

View File

@ -65,7 +65,6 @@ const ReportAdModal = ({
return [
parts[0],
<SafeLink
withNormalWordBreak
text={lang('lng_report_sponsored_reported_link')}
url={lang('ReportAd.Help_URL')}
/>,