@@ -75,7 +75,6 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
75
75
tabSize = 2 ,
76
76
lineDecorationsWidth = 0 ,
77
77
height = 450 ,
78
- width = '100%' ,
79
78
inline = false ,
80
79
shebang = '' ,
81
80
onChange,
@@ -99,7 +98,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
99
98
100
99
const editorRef = useRef ( null )
101
100
const monacoRef = useRef ( null )
102
- const { width : windowWidth , height : windowHeight } = useWindowSize ( )
101
+ const { width, height : windowHeight } = useWindowSize ( )
103
102
const memoisedReducer = React . useCallback ( CodeEditorReducer , [ ] )
104
103
const [ state , dispatch ] = useReducer ( memoisedReducer , initialState ( { mode, theme, value, diffView, noParsing} ) )
105
104
const [ , json , yamlCode , error ] = useJsonYaml ( state . code , tabSize , state . mode , ! state . noParsing )
@@ -192,7 +191,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
192
191
return
193
192
}
194
193
editorRef . current . layout ( )
195
- } , [ windowWidth , windowHeight ] )
194
+ } , [ width , windowHeight ] )
196
195
197
196
useEffect ( ( ) => {
198
197
if ( onChange ) {
@@ -268,7 +267,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
268
267
}
269
268
270
269
return (
271
- < CodeEditorContext . Provider value = { { dispatch, state, handleLanguageChange, error, defaultValue, height, width } } >
270
+ < CodeEditorContext . Provider value = { { dispatch, state, handleLanguageChange, error, defaultValue, height } } >
272
271
{ children }
273
272
{ loading ? (
274
273
< CodeEditorPlaceholder customLoader = { customLoader } />
@@ -287,7 +286,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
287
286
theme = { state . theme . toLowerCase ( ) . split ( ' ' ) . join ( '-' ) }
288
287
editorDidMount = { editorDidMount }
289
288
height = { height }
290
- width = { width }
289
+ width = "100%"
291
290
/>
292
291
) : (
293
292
< MonacoEditor
@@ -298,7 +297,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
298
297
onChange = { handleOnChange }
299
298
editorDidMount = { editorDidMount }
300
299
height = { height }
301
- width = { width }
300
+ width = "100%"
302
301
/>
303
302
) }
304
303
</ >
0 commit comments