From 89b1195aa95f0841d173191cd84df873a50d9305 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 9 Mar 2026 11:38:07 +0800 Subject: [PATCH] chore: support \n to split text --- web/app/components/app/in-site-message.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/web/app/components/app/in-site-message.tsx b/web/app/components/app/in-site-message.tsx index e9c8972fe6..1b7ac65ff7 100644 --- a/web/app/components/app/in-site-message.tsx +++ b/web/app/components/app/in-site-message.tsx @@ -24,6 +24,10 @@ type InSiteMessageProps = { title: string } +function normalizeLineBreaks(text: string): string { + return text.replace(/\\n/g, '\n') +} + function normalizeLinkData(data: unknown): { href: string, rel?: string, target?: string } | null { if (typeof data === 'string') return { href: data, target: '_blank' } @@ -51,6 +55,8 @@ function InSiteMessage({ title, }: InSiteMessageProps) { const [visible, setVisible] = useState(true) + const normalizedTitle = normalizeLineBreaks(title) + const normalizedSubtitle = normalizeLineBreaks(subtitle) const headerStyle = useMemo(() => { return { @@ -88,11 +94,11 @@ function InSiteMessage({ )} >
-
- {title} +
+ {normalizedTitle}
-
- {subtitle} +
+ {normalizedSubtitle}