@@ -109,27 +109,29 @@ export const CodeDisplay: FC<CodeDisplayProps> = ({ data, className, readOnly =
109109 const model = editorRef . current . getModel ( )
110110 if ( ! model ) return
111111
112- const markers : monaco . editor . IMarkerData [ ] = [ ]
113-
114- try {
115- yaml . parse ( value )
116- } catch ( e ) {
117- const yamlError = e as { message : string ; linePos : { line : number ; col : number } [ ] }
118- if ( yamlError . linePos && yamlError . linePos . length > 0 ) {
119- const line = yamlError . linePos [ 0 ] . line
120- const column = yamlError . linePos [ 0 ] . col
121- markers . push ( {
122- startLineNumber : line ,
123- endLineNumber : line ,
124- startColumn : column ,
125- endColumn : model . getLineMaxColumn ( line ) ,
126- message : yamlError . message ,
127- severity : monacoInstance . MarkerSeverity . Error ,
128- } )
112+ if ( ! readOnly ) {
113+ const markers : monaco . editor . IMarkerData [ ] = [ ]
114+
115+ try {
116+ yaml . parse ( value )
117+ } catch ( e ) {
118+ const yamlError = e as { message : string ; linePos : { line : number ; col : number } [ ] }
119+ if ( yamlError . linePos && yamlError . linePos . length > 0 ) {
120+ const line = yamlError . linePos [ 0 ] . line
121+ const column = yamlError . linePos [ 0 ] . col
122+ markers . push ( {
123+ startLineNumber : line ,
124+ endLineNumber : line ,
125+ startColumn : column ,
126+ endColumn : model . getLineMaxColumn ( line ) ,
127+ message : yamlError . message ,
128+ severity : monacoInstance . MarkerSeverity . Error ,
129+ } )
130+ }
129131 }
130- }
131132
132- monacoInstance . editor . setModelMarkers ( model , 'yaml-validator' , markers )
133+ monacoInstance . editor . setModelMarkers ( model , 'yaml-validator' , markers )
134+ }
133135
134136 highlightErrorLogs ( value )
135137
0 commit comments