perf: markdown more wrap (#365)

This commit is contained in:
Archer
2023-10-02 20:19:09 +08:00
committed by GitHub
parent 36f5648cae
commit bf172fab81
31 changed files with 657 additions and 560 deletions

View File

@@ -62,6 +62,8 @@ const Markdown = ({ source, isChatting = false }: { source: string; isChatting?:
[]
);
const formatSource = source.replace(/\\n/g, '\n ');
return (
<ReactMarkdown
className={`markdown ${styles.markdown}
@@ -73,9 +75,9 @@ const Markdown = ({ source, isChatting = false }: { source: string; isChatting?:
components={components}
linkTarget={'_blank'}
>
{source}
{formatSource}
</ReactMarkdown>
);
};
export default Markdown;
export default React.memo(Markdown);