fix: bound code editor font size ()

This commit is contained in:
Sylvie Crowe 2024-12-19 14:10:19 -08:00 committed by GitHub
parent caa98b471c
commit 2c5aae1a98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import { useOverrideConfigAtom } from "@/app/store/global"; import { useOverrideConfigAtom } from "@/app/store/global";
import { boundNumber } from "@/util/util";
import loader from "@monaco-editor/loader"; import loader from "@monaco-editor/loader";
import { Editor, Monaco } from "@monaco-editor/react"; import { Editor, Monaco } from "@monaco-editor/react";
import type * as MonacoTypes from "monaco-editor/esm/vs/editor/editor.api"; 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 minimapEnabled = useOverrideConfigAtom(blockId, "editor:minimapenabled") ?? false;
const stickyScrollEnabled = useOverrideConfigAtom(blockId, "editor:stickyscrollenabled") ?? false; const stickyScrollEnabled = useOverrideConfigAtom(blockId, "editor:stickyscrollenabled") ?? false;
const wordWrap = useOverrideConfigAtom(blockId, "editor:wordwrap") ?? 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"; const theme = "wave-theme-dark";
React.useEffect(() => { React.useEffect(() => {