fix(web): 修复自定义 HTML 样式被过滤及排版间距异常的问题 (#5795)
* fix(web): 修复自定义 HTML 样式被过滤及排版间距异常的问题 * fix(web): isolate custom HTML rendering --------- Co-authored-by: CaIon <i@caion.me>
This commit is contained in:
+15
-1
@@ -122,6 +122,7 @@ export function About() {
|
||||
const rawContent = data?.data?.trim() ?? ''
|
||||
const hasContent = rawContent.length > 0
|
||||
const isUrl = hasContent && isHttpUrl(rawContent)
|
||||
const contentIsHtml = hasContent && isLikelyHtml(rawContent)
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
@@ -157,11 +158,24 @@ export function About() {
|
||||
)
|
||||
}
|
||||
|
||||
if (contentIsHtml) {
|
||||
return (
|
||||
<PublicLayout showMainContainer={false}>
|
||||
<RichContent
|
||||
mode='html'
|
||||
htmlVariant='isolated'
|
||||
content={rawContent}
|
||||
className='prose-neutral dark:prose-invert max-w-none'
|
||||
/>
|
||||
</PublicLayout>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<PublicLayout>
|
||||
<div className='mx-auto max-w-6xl px-4 py-8'>
|
||||
<RichContent
|
||||
mode={isLikelyHtml(rawContent) ? 'html' : 'markdown'}
|
||||
mode='markdown'
|
||||
content={rawContent}
|
||||
className='prose-neutral dark:prose-invert max-w-none'
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user