mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-13 07:40:56 +00:00
fix(web): render custom HTML and Markdown content consistently (#5760)
* fix(markdown): render announcement markdown consistently - support soft line breaks for announcement markdown without changing the default parser behavior. - add explicit markdown element styles so lists, tables, code blocks, and quotes render correctly when typography styles are unavailable. - apply the announcement markdown mode in both the popover and detail dialog for consistent display. * refactor(markdown): simplify fallback markdown styles - remove duplicate typography utility classes now covered by explicit markdown element fallbacks. - keep the markdown renderer behavior unchanged while reducing class noise. - modernize small helper expressions to satisfy targeted lint checks. * fix(content): render custom HTML consistently - add shared rich content rendering so custom HTML and Markdown use the same path across public pages and announcements. - reuse common URL and HTML detection instead of duplicating content format checks per page. - keep custom home content inside the standard public layout while preserving full-page iframe rendering for external URLs.
This commit is contained in:
+18
-15
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
import { Markdown } from '@/components/ui/markdown'
|
||||
import { RichContent } from '@/components/rich-content'
|
||||
import { PublicLayout } from '@/components/layout'
|
||||
import { Footer } from '@/components/layout/components/footer'
|
||||
import { CTA, Features, Hero, HowItWorks, Stats } from './components'
|
||||
@@ -41,21 +41,24 @@ export function Home() {
|
||||
}
|
||||
|
||||
if (content) {
|
||||
if (isUrl) {
|
||||
return (
|
||||
<PublicLayout showMainContainer={false}>
|
||||
<iframe
|
||||
src={content}
|
||||
className='h-screen w-full border-none'
|
||||
title={t('Custom Home Page')}
|
||||
sandbox='allow-forms allow-popups allow-popups-to-escape-sandbox allow-scripts'
|
||||
/>
|
||||
</PublicLayout>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<PublicLayout showMainContainer={false}>
|
||||
<main className='overflow-x-hidden'>
|
||||
{isUrl ? (
|
||||
<iframe
|
||||
src={content}
|
||||
className='h-screen w-full border-none'
|
||||
title={t('Custom Home Page')}
|
||||
/>
|
||||
) : (
|
||||
<div className='container mx-auto py-8'>
|
||||
<Markdown className='custom-home-content'>{content}</Markdown>
|
||||
</div>
|
||||
)}
|
||||
</main>
|
||||
<PublicLayout>
|
||||
<div className='mx-auto max-w-6xl px-4 py-8'>
|
||||
<RichContent content={content} className='custom-home-content' />
|
||||
</div>
|
||||
</PublicLayout>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user