From 0f15e4ff56b88a788a0a9ee5af0aaf0547176374 Mon Sep 17 00:00:00 2001 From: Sylvie Crowe <107814465+oneirocosm@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:01:12 -0800 Subject: [PATCH] fix: bound custom fontsizes between 6 and 64 (#1577) Adds bounding for markdown (and AI) fontsize and fixedfontsize. --- frontend/app/element/markdown.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/app/element/markdown.tsx b/frontend/app/element/markdown.tsx index 5e6f596cf..a59fa877a 100644 --- a/frontend/app/element/markdown.tsx +++ b/frontend/app/element/markdown.tsx @@ -9,7 +9,7 @@ import { resolveSrcSet, transformBlocks, } from "@/app/element/markdown-util"; -import { useAtomValueSafe } from "@/util/util"; +import { boundNumber, useAtomValueSafe } from "@/util/util"; import { clsx } from "clsx"; import { Atom } from "jotai"; import { OverlayScrollbarsComponent, OverlayScrollbarsComponentRef } from "overlayscrollbars-react"; @@ -380,10 +380,10 @@ const Markdown = ({ const mergedStyle = { ...style }; if (fontSizeOverride != null) { - mergedStyle["--markdown-font-size"] = `${fontSizeOverride}px`; + mergedStyle["--markdown-font-size"] = `${boundNumber(fontSizeOverride, 6, 64)}px`; } if (fixedFontSizeOverride != null) { - mergedStyle["--markdown-fixed-font-size"] = `${fixedFontSizeOverride}px`; + mergedStyle["--markdown-fixed-font-size"] = `${boundNumber(fixedFontSizeOverride, 6, 64)}px`; } return (