Don't linkify when certain unicode formatting characters are present
This commit is contained in:
parent
e62606361d
commit
006de5b1a5
3 changed files with 50 additions and 1 deletions
|
@ -6,7 +6,7 @@ import React from 'react';
|
|||
import LinkifyIt from 'linkify-it';
|
||||
|
||||
import type { RenderTextCallbackType } from '../../types/Util';
|
||||
import { isLinkSneaky } from '../../types/LinkPreview';
|
||||
import { isLinkSneaky, shouldLinkifyMessage } from '../../types/LinkPreview';
|
||||
import { splitByEmoji } from '../../util/emoji';
|
||||
import { missingCaseError } from '../../util/missingCaseError';
|
||||
|
||||
|
@ -333,6 +333,10 @@ export class Linkify extends React.Component<Props> {
|
|||
| Array<JSX.Element | string | null> {
|
||||
const { text, renderNonLink } = this.props;
|
||||
|
||||
if (!shouldLinkifyMessage(text)) {
|
||||
return text;
|
||||
}
|
||||
|
||||
// We have to do this, because renderNonLink is not required in our Props object,
|
||||
// but it is always provided via defaultProps.
|
||||
if (!renderNonLink) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue