Use shouldLinkifyMessage in MessageBody/ReadMore
This commit is contained in:
parent
8b0da36caa
commit
7969dd881e
2 changed files with 7 additions and 2 deletions
|
@ -6,6 +6,7 @@ import React from 'react';
|
|||
import type { Props as MessageBodyPropsType } from './MessageBody';
|
||||
import { MessageBody } from './MessageBody';
|
||||
import { graphemeAndLinkAwareSlice } from '../../util/graphemeAndLinkAwareSlice';
|
||||
import { shouldLinkifyMessage } from '../../types/LinkPreview';
|
||||
|
||||
export type Props = Pick<
|
||||
MessageBodyPropsType,
|
||||
|
@ -52,6 +53,7 @@ export function MessageBodyReadMore({
|
|||
}: Props): JSX.Element {
|
||||
const maxLength = displayLimit || INITIAL_LENGTH;
|
||||
|
||||
const shouldDisableLinks = disableLinks || !shouldLinkifyMessage(text);
|
||||
const { hasReadMore, text: slicedText } = graphemeAndLinkAwareSlice(
|
||||
text,
|
||||
maxLength,
|
||||
|
@ -71,7 +73,7 @@ export function MessageBodyReadMore({
|
|||
bodyRanges={bodyRanges}
|
||||
direction={direction}
|
||||
disableJumbomoji={disableJumbomoji}
|
||||
disableLinks={disableLinks}
|
||||
disableLinks={shouldDisableLinks}
|
||||
i18n={i18n}
|
||||
isSpoilerExpanded={isSpoilerExpanded}
|
||||
kickOffBodyDownload={kickOffBodyDownload}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue