Links: Fix word break (#5338)
This commit is contained in:
parent
7e316db081
commit
3abd843dd5
@ -18,7 +18,6 @@ type OwnProps = {
|
|||||||
text: string;
|
text: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
children?: TeactNode;
|
children?: TeactNode;
|
||||||
withNormalWordBreak?: boolean;
|
|
||||||
isRtl?: boolean;
|
isRtl?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -27,19 +26,18 @@ const SafeLink = ({
|
|||||||
text,
|
text,
|
||||||
className,
|
className,
|
||||||
children,
|
children,
|
||||||
withNormalWordBreak,
|
|
||||||
isRtl,
|
isRtl,
|
||||||
}: OwnProps) => {
|
}: OwnProps) => {
|
||||||
const { openUrl } = getActions();
|
const { openUrl } = getActions();
|
||||||
|
|
||||||
const content = children || text;
|
const content = children || text;
|
||||||
const isSafe = url === text;
|
const isRegularLink = url === text;
|
||||||
|
|
||||||
const handleClick = useLastCallback((e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
|
const handleClick = useLastCallback((e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
|
||||||
if (!url) return true;
|
if (!url) return true;
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
openUrl({ url, shouldSkipModal: isSafe });
|
openUrl({ url, shouldSkipModal: isRegularLink });
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -50,7 +48,7 @@ const SafeLink = ({
|
|||||||
|
|
||||||
const classNames = buildClassName(
|
const classNames = buildClassName(
|
||||||
className || 'text-entity-link',
|
className || 'text-entity-link',
|
||||||
!withNormalWordBreak && 'word-break-all',
|
isRegularLink && 'word-break-all',
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -559,7 +559,6 @@ function processEntity({
|
|||||||
<SafeLink
|
<SafeLink
|
||||||
url={getLinkUrl(entityText, entity)}
|
url={getLinkUrl(entityText, entity)}
|
||||||
text={entityText}
|
text={entityText}
|
||||||
withNormalWordBreak
|
|
||||||
>
|
>
|
||||||
{renderNestedMessagePart()}
|
{renderNestedMessagePart()}
|
||||||
</SafeLink>
|
</SafeLink>
|
||||||
|
|||||||
@ -983,7 +983,7 @@
|
|||||||
.text-entity-link {
|
.text-entity-link {
|
||||||
color: var(--color-links) !important;
|
color: var(--color-links) !important;
|
||||||
text-decoration: none !important;
|
text-decoration: none !important;
|
||||||
word-break: break-word;
|
overflow-wrap: break-word;
|
||||||
cursor: var(--custom-cursor, pointer);
|
cursor: var(--custom-cursor, pointer);
|
||||||
unicode-bidi: initial;
|
unicode-bidi: initial;
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,6 @@ const ReportAdModal = ({
|
|||||||
return [
|
return [
|
||||||
parts[0],
|
parts[0],
|
||||||
<SafeLink
|
<SafeLink
|
||||||
withNormalWordBreak
|
|
||||||
text={lang('lng_report_sponsored_reported_link')}
|
text={lang('lng_report_sponsored_reported_link')}
|
||||||
url={lang('ReportAd.Help_URL')}
|
url={lang('ReportAd.Help_URL')}
|
||||||
/>,
|
/>,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user