From 90f1188c8f0451434737f124363293173eec0953 Mon Sep 17 00:00:00 2001 From: frostime Date: Sat, 25 May 2024 16:13:54 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(config):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E5=AF=B9=E5=AD=97=E4=BD=93=20font-family=20=E7=9A=84?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/chat.tsx | 3 +++ app/components/exporter.tsx | 1 + app/components/markdown.tsx | 2 ++ app/components/settings.tsx | 13 +++++++++++++ app/store/config.ts | 1 + app/utils.ts | 1 + 6 files changed, 21 insertions(+) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 06119250465..50ac9caa918 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -670,6 +670,7 @@ function _Chat() { const session = chatStore.currentSession(); const config = useAppConfig(); const fontSize = config.fontSize; + const fontFamily = config.fontFamily; const [showExport, setShowExport] = useState(false); @@ -1420,6 +1421,7 @@ function _Chat() { setUserInput(getMessageTextContent(message)); }} fontSize={fontSize} + fontFamily={fontFamily} parentRef={scrollRef} defaultShow={i >= messages.length - 6} /> @@ -1514,6 +1516,7 @@ function _Chat() { autoFocus={autoFocus} style={{ fontSize: config.fontSize, + fontFamily: config.fontFamily, }} /> {attachImages.length != 0 && ( diff --git a/app/components/exporter.tsx b/app/components/exporter.tsx index 20e240d93b0..ea1585d2cb1 100644 --- a/app/components/exporter.tsx +++ b/app/components/exporter.tsx @@ -591,6 +591,7 @@ export function ImagePreviewer(props: { {getMessageImages(m).length == 1 && ( diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx index 1afd7de3b45..f9b8fb030f5 100644 --- a/app/components/markdown.tsx +++ b/app/components/markdown.tsx @@ -175,6 +175,7 @@ export function Markdown( content: string; loading?: boolean; fontSize?: number; + fontFamily?: string; parentRef?: RefObject; defaultShow?: boolean; } & React.DOMAttributes, @@ -186,6 +187,7 @@ export function Markdown( className="markdown-body" style={{ fontSize: `${props.fontSize ?? 14}px`, + fontFamily: props.fontFamily ?? "inherit", }} ref={mdRef} onContextMenu={props.onContextMenu} diff --git a/app/components/settings.tsx b/app/components/settings.tsx index db08b48a9ff..e1b97f4a6fe 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -797,6 +797,19 @@ export function Settings() { > + + + updateConfig( + (config) => (config.fontFamily = e.currentTarget.value), + ) + } + > + +