@@ -112,13 +112,14 @@ interface CodeEditorProps {
112112 blockId : string ;
113113 text : string ;
114114 filename : string ;
115+ fileinfo : FileInfo ;
115116 language ?: string ;
116117 meta ?: MetaType ;
117118 onChange ?: ( text : string ) => void ;
118119 onMount ?: ( monacoPtr : MonacoTypes . editor . IStandaloneCodeEditor , monaco : Monaco ) => ( ) => void ;
119120}
120121
121- export function CodeEditor ( { blockId, text, language, filename, meta, onChange, onMount } : CodeEditorProps ) {
122+ export function CodeEditor ( { blockId, text, language, filename, fileinfo , meta, onChange, onMount } : CodeEditorProps ) {
122123 const divRef = useRef < HTMLDivElement > ( null ) ;
123124 const unmountRef = useRef < ( ) => void > ( null ) ;
124125 const minimapEnabled = useOverrideConfigAtom ( blockId , "editor:minimapenabled" ) ?? false ;
@@ -169,12 +170,13 @@ export function CodeEditor({ blockId, text, language, filename, meta, onChange,
169170
170171 const editorOpts = useMemo ( ( ) => {
171172 const opts = defaultEditorOptions ( ) ;
173+ opts . readOnly = fileinfo . readonly ;
172174 opts . minimap . enabled = minimapEnabled ;
173175 opts . stickyScroll . enabled = stickyScrollEnabled ;
174176 opts . wordWrap = wordWrap ? "on" : "off" ;
175177 opts . fontSize = fontSize ;
176178 return opts ;
177- } , [ minimapEnabled , stickyScrollEnabled , wordWrap , fontSize ] ) ;
179+ } , [ minimapEnabled , stickyScrollEnabled , wordWrap , fontSize , fileinfo . readonly ] ) ;
178180
179181 return (
180182 < div className = "code-editor-wrapper" >
0 commit comments