Links: Fix word break (#5338)
This commit is contained in:
parent
7e316db081
commit
3abd843dd5
@ -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 (
|
||||
|
||||
@ -559,7 +559,6 @@ function processEntity({
|
||||
<SafeLink
|
||||
url={getLinkUrl(entityText, entity)}
|
||||
text={entityText}
|
||||
withNormalWordBreak
|
||||
>
|
||||
{renderNestedMessagePart()}
|
||||
</SafeLink>
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -65,7 +65,6 @@ const ReportAdModal = ({
|
||||
return [
|
||||
parts[0],
|
||||
<SafeLink
|
||||
withNormalWordBreak
|
||||
text={lang('lng_report_sponsored_reported_link')}
|
||||
url={lang('ReportAd.Help_URL')}
|
||||
/>,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user