@@ -3,45 +3,45 @@ import { useRef } from 'react';
33import MonacoEditor , { type OnMount } from '@monaco-editor/react' ;
44
55interface CodeEditorProps {
6- initialValue : string ;
7- language : string ;
8- onChange ?: ( value : string | undefined ) => void ;
9- theme ?: 'vs-dark' | 'light' ;
10- readOnly ?: boolean ;
6+ initialValue : string ;
7+ language : string ;
8+ onChange ?: ( value : string | undefined ) => void ;
9+ theme ?: 'vs-dark' | 'light' ;
10+ readOnly ?: boolean ;
1111}
1212
1313export function CodeEditor ( {
14- initialValue,
15- language,
16- onChange,
17- theme = 'vs-dark' ,
18- readOnly = false ,
14+ initialValue,
15+ language,
16+ onChange,
17+ theme = 'vs-dark' ,
18+ readOnly = false ,
1919} : CodeEditorProps ) {
20- // eslint-disable-next-line @typescript-eslint/no-explicit-any
21- const editorRef = useRef < any > ( null ) ;
20+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21+ const editorRef = useRef < any > ( null ) ;
2222
23- const handleEditorDidMount : OnMount = ( editor , _monaco ) => {
24- editorRef . current = editor ;
25- } ;
23+ const handleEditorDidMount : OnMount = ( editor , _monaco ) => {
24+ editorRef . current = editor ;
25+ } ;
2626
27- return (
28- < div className = "h-full w-full rounded-md overflow-hidden border border-border" >
29- < MonacoEditor
30- height = "100%"
31- width = "100%"
32- language = { language }
33- value = { initialValue }
34- theme = { theme }
35- onChange = { onChange }
36- onMount = { handleEditorDidMount }
37- options = { {
38- readOnly,
39- minimap : { enabled : false } ,
40- scrollBeyondLastLine : false ,
41- fontSize : 14 ,
42- padding : { top : 16 , bottom : 16 } ,
43- } }
44- />
45- </ div >
46- ) ;
27+ return (
28+ < div className = "h-full w-full rounded-md overflow-hidden border border-border" >
29+ < MonacoEditor
30+ height = "100%"
31+ width = "100%"
32+ language = { language }
33+ value = { initialValue }
34+ theme = { theme }
35+ onChange = { onChange }
36+ onMount = { handleEditorDidMount }
37+ options = { {
38+ readOnly,
39+ minimap : { enabled : false } ,
40+ scrollBeyondLastLine : false ,
41+ fontSize : 14 ,
42+ padding : { top : 16 , bottom : 16 } ,
43+ } }
44+ />
45+ </ div >
46+ ) ;
4747}
0 commit comments