fix(Markdown): Conditionally apply MarkdownShadowDOMRenderer for style components based on message content
This commit is contained in:
parent
7284679907
commit
e02c967f5b
@ -67,8 +67,7 @@ const Markdown: FC<Props> = ({ message, citationsData }) => {
|
||||
},
|
||||
code: CodeBlock,
|
||||
img: ImagePreview,
|
||||
pre: (props: any) => <pre style={{ overflow: 'visible' }} {...props} />,
|
||||
style: MarkdownShadowDOMRenderer as any
|
||||
pre: (props: any) => <pre style={{ overflow: 'visible' }} {...props} />
|
||||
} as Partial<Components>
|
||||
return baseComponents
|
||||
}, [citationsData])
|
||||
@ -77,6 +76,10 @@ const Markdown: FC<Props> = ({ message, citationsData }) => {
|
||||
return <p style={{ marginBottom: 5, whiteSpace: 'pre-wrap' }}>{messageContent}</p>
|
||||
}
|
||||
|
||||
if (messageContent.includes('<style>')) {
|
||||
components.style = MarkdownShadowDOMRenderer as any
|
||||
}
|
||||
|
||||
return (
|
||||
<ReactMarkdown
|
||||
rehypePlugins={rehypePlugins}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user