Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions app/components/monaco-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface MonacoEditorProps {
value: string
onChange: (value: string) => void
theme?: "light" | "dark"
/** Receives the editor instance on mount, and `null` on unmount. */
fontSize?: number
onEditorReady?: (editor: monaco.editor.IStandaloneCodeEditor | null) => void
}

Expand All @@ -47,6 +47,7 @@ export default function MonacoEditor({
value,
onChange,
theme,
fontSize = 14,
onEditorReady,
}: MonacoEditorProps) {
const editorRef = useRef<HTMLDivElement>(null)
Expand All @@ -68,6 +69,7 @@ export default function MonacoEditor({
},
})


monaco.editor.defineTheme("custom-light", {
base: "vs",
inherit: true,
Expand All @@ -85,7 +87,7 @@ export default function MonacoEditor({
theme: theme === "dark" ? "custom-dark" : "custom-light",
automaticLayout: true,
minimap: { enabled: false },
fontSize: 14,
fontSize: fontSize,
lineNumbers: "on",
roundedSelection: false,
scrollBeyondLastLine: false,
Expand Down Expand Up @@ -193,6 +195,12 @@ export default function MonacoEditor({
}
}, [theme])

useEffect(() => {
if (monacoRef.current) {
monacoRef.current.updateOptions({ fontSize })
}
}, [fontSize])

// Helper: compute and render status text
const updateStatusBar = (text: string) => {
try {
Expand Down
Loading
Loading