Safe Link: Fix word break in message text (#4954)

This commit is contained in:
zubiden 2024-09-06 15:43:37 +02:00 committed by Alexander Zinchuk
parent a7ecd74fa4
commit b9041b8fc3
3 changed files with 5 additions and 2 deletions

View File

@ -18,6 +18,7 @@ type OwnProps = {
text: string; text: string;
className?: string; className?: string;
children?: TeactNode; children?: TeactNode;
withNormalWordBreak?: boolean;
isRtl?: boolean; isRtl?: boolean;
}; };
@ -26,6 +27,7 @@ const SafeLink = ({
text, text,
className, className,
children, children,
withNormalWordBreak,
isRtl, isRtl,
}: OwnProps) => { }: OwnProps) => {
const { openUrl } = getActions(); const { openUrl } = getActions();
@ -48,7 +50,7 @@ const SafeLink = ({
const classNames = buildClassName( const classNames = buildClassName(
className || 'text-entity-link', className || 'text-entity-link',
text.length > 50 && 'long-word-break-all', !withNormalWordBreak && 'word-break-all',
); );
return ( return (

View File

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

View File

@ -940,7 +940,7 @@
} }
} }
.long-word-break-all { .word-break-all {
word-break: break-all; word-break: break-all;
} }