From 2c5aae1a98314dc954861721377599967f4f5921 Mon Sep 17 00:00:00 2001 From: Sylvie Crowe <107814465+oneirocosm@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:10:19 -0800 Subject: [PATCH] fix: bound code editor font size (#1581) --- frontend/app/view/codeeditor/codeeditor.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/app/view/codeeditor/codeeditor.tsx b/frontend/app/view/codeeditor/codeeditor.tsx index aca418143..6eafb2b94 100644 --- a/frontend/app/view/codeeditor/codeeditor.tsx +++ b/frontend/app/view/codeeditor/codeeditor.tsx @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { useOverrideConfigAtom } from "@/app/store/global"; +import { boundNumber } from "@/util/util"; import loader from "@monaco-editor/loader"; import { Editor, Monaco } from "@monaco-editor/react"; import type * as MonacoTypes from "monaco-editor/esm/vs/editor/editor.api"; @@ -122,7 +123,7 @@ export function CodeEditor({ blockId, text, language, filename, meta, onChange, const minimapEnabled = useOverrideConfigAtom(blockId, "editor:minimapenabled") ?? false; const stickyScrollEnabled = useOverrideConfigAtom(blockId, "editor:stickyscrollenabled") ?? false; const wordWrap = useOverrideConfigAtom(blockId, "editor:wordwrap") ?? false; - const fontSize = useOverrideConfigAtom(blockId, "editor:fontsize"); + const fontSize = boundNumber(useOverrideConfigAtom(blockId, "editor:fontsize"), 6, 64); const theme = "wave-theme-dark"; React.useEffect(() => {