|
|
@ -16,12 +16,13 @@ interface Props {
|
|
|
|
disableJumbomoji?: boolean;
|
|
|
|
disableJumbomoji?: boolean;
|
|
|
|
/** If set, links will be left alone instead of turned into clickable `<a>` tags. */
|
|
|
|
/** If set, links will be left alone instead of turned into clickable `<a>` tags. */
|
|
|
|
disableLinks?: boolean;
|
|
|
|
disableLinks?: boolean;
|
|
|
|
isPublic?: boolean;
|
|
|
|
isGroup?: boolean;
|
|
|
|
i18n: LocalizerType;
|
|
|
|
i18n: LocalizerType;
|
|
|
|
|
|
|
|
convoId: string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// eslint-disable-next-line
|
|
|
|
const renderMentions: RenderTextCallbackType = ({ text, key }) => (
|
|
|
|
const renderMentions: RenderTextCallbackType = ({ text, key, convoId }) => (
|
|
|
|
<AddMentions key={key} text={text} />
|
|
|
|
<AddMentions key={key} text={text} convoId={convoId} />
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const renderDefault: RenderTextCallbackType = ({ text }) => text;
|
|
|
|
const renderDefault: RenderTextCallbackType = ({ text }) => text;
|
|
|
@ -29,15 +30,17 @@ const renderDefault: RenderTextCallbackType = ({ text }) => text;
|
|
|
|
const renderNewLines: RenderTextCallbackType = ({
|
|
|
|
const renderNewLines: RenderTextCallbackType = ({
|
|
|
|
text: textWithNewLines,
|
|
|
|
text: textWithNewLines,
|
|
|
|
key,
|
|
|
|
key,
|
|
|
|
isPublic,
|
|
|
|
isGroup,
|
|
|
|
|
|
|
|
convoId,
|
|
|
|
}) => {
|
|
|
|
}) => {
|
|
|
|
const renderOther = isPublic ? renderMentions : renderDefault;
|
|
|
|
const renderOther = isGroup ? renderMentions : renderDefault;
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<AddNewLines
|
|
|
|
<AddNewLines
|
|
|
|
key={key}
|
|
|
|
key={key}
|
|
|
|
text={textWithNewLines}
|
|
|
|
text={textWithNewLines}
|
|
|
|
renderNonNewLine={renderOther}
|
|
|
|
renderNonNewLine={renderOther}
|
|
|
|
|
|
|
|
convoId={convoId}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -48,14 +51,16 @@ const renderEmoji = ({
|
|
|
|
key,
|
|
|
|
key,
|
|
|
|
sizeClass,
|
|
|
|
sizeClass,
|
|
|
|
renderNonEmoji,
|
|
|
|
renderNonEmoji,
|
|
|
|
isPublic,
|
|
|
|
isGroup,
|
|
|
|
|
|
|
|
convoId,
|
|
|
|
}: {
|
|
|
|
}: {
|
|
|
|
i18n: LocalizerType;
|
|
|
|
i18n: LocalizerType;
|
|
|
|
text: string;
|
|
|
|
text: string;
|
|
|
|
key: number;
|
|
|
|
key: number;
|
|
|
|
sizeClass?: SizeClassType;
|
|
|
|
sizeClass?: SizeClassType;
|
|
|
|
renderNonEmoji: RenderTextCallbackType;
|
|
|
|
renderNonEmoji: RenderTextCallbackType;
|
|
|
|
isPublic?: boolean;
|
|
|
|
isGroup?: boolean;
|
|
|
|
|
|
|
|
convoId?: string;
|
|
|
|
}) => (
|
|
|
|
}) => (
|
|
|
|
<Emojify
|
|
|
|
<Emojify
|
|
|
|
i18n={i18n}
|
|
|
|
i18n={i18n}
|
|
|
@ -63,7 +68,8 @@ const renderEmoji = ({
|
|
|
|
text={text}
|
|
|
|
text={text}
|
|
|
|
sizeClass={sizeClass}
|
|
|
|
sizeClass={sizeClass}
|
|
|
|
renderNonEmoji={renderNonEmoji}
|
|
|
|
renderNonEmoji={renderNonEmoji}
|
|
|
|
isPublic={isPublic}
|
|
|
|
isGroup={isGroup}
|
|
|
|
|
|
|
|
convoId={convoId}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
@ -75,7 +81,7 @@ const renderEmoji = ({
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export class MessageBody extends React.Component<Props> {
|
|
|
|
export class MessageBody extends React.Component<Props> {
|
|
|
|
public static defaultProps: Partial<Props> = {
|
|
|
|
public static defaultProps: Partial<Props> = {
|
|
|
|
isPublic: false,
|
|
|
|
isGroup: false,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
public addDownloading(jsx: JSX.Element): JSX.Element {
|
|
|
|
public addDownloading(jsx: JSX.Element): JSX.Element {
|
|
|
@ -102,7 +108,8 @@ export class MessageBody extends React.Component<Props> {
|
|
|
|
disableLinks,
|
|
|
|
disableLinks,
|
|
|
|
isRss,
|
|
|
|
isRss,
|
|
|
|
i18n,
|
|
|
|
i18n,
|
|
|
|
isPublic,
|
|
|
|
isGroup,
|
|
|
|
|
|
|
|
convoId,
|
|
|
|
} = this.props;
|
|
|
|
} = this.props;
|
|
|
|
const sizeClass = disableJumbomoji ? undefined : getSizeClass(text);
|
|
|
|
const sizeClass = disableJumbomoji ? undefined : getSizeClass(text);
|
|
|
|
const textWithPending = textPending ? `${text}...` : text;
|
|
|
|
const textWithPending = textPending ? `${text}...` : text;
|
|
|
@ -115,7 +122,8 @@ export class MessageBody extends React.Component<Props> {
|
|
|
|
sizeClass,
|
|
|
|
sizeClass,
|
|
|
|
key: 0,
|
|
|
|
key: 0,
|
|
|
|
renderNonEmoji: renderNewLines,
|
|
|
|
renderNonEmoji: renderNewLines,
|
|
|
|
isPublic,
|
|
|
|
isGroup,
|
|
|
|
|
|
|
|
convoId,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -131,7 +139,8 @@ export class MessageBody extends React.Component<Props> {
|
|
|
|
sizeClass,
|
|
|
|
sizeClass,
|
|
|
|
key,
|
|
|
|
key,
|
|
|
|
renderNonEmoji: renderNewLines,
|
|
|
|
renderNonEmoji: renderNewLines,
|
|
|
|
isPublic,
|
|
|
|
isGroup,
|
|
|
|
|
|
|
|
convoId,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|