Skip to content

Commit df9df47

Browse files
committed
Revert "feat: add support for width in CodeEditor"
This reverts commit 5599bd7.
1 parent b505672 commit df9df47

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/Common/CodeEditor/CodeEditor.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
7575
tabSize = 2,
7676
lineDecorationsWidth = 0,
7777
height = 450,
78-
width = '100%',
7978
inline = false,
8079
shebang = '',
8180
onChange,
@@ -99,7 +98,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
9998

10099
const editorRef = useRef(null)
101100
const monacoRef = useRef(null)
102-
const { width: windowWidth, height: windowHeight } = useWindowSize()
101+
const { width, height: windowHeight } = useWindowSize()
103102
const memoisedReducer = React.useCallback(CodeEditorReducer, [])
104103
const [state, dispatch] = useReducer(memoisedReducer, initialState({mode, theme, value, diffView, noParsing}))
105104
const [, json, yamlCode, error] = useJsonYaml(state.code, tabSize, state.mode, !state.noParsing)
@@ -192,7 +191,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
192191
return
193192
}
194193
editorRef.current.layout()
195-
}, [windowWidth, windowHeight])
194+
}, [width, windowHeight])
196195

197196
useEffect(() => {
198197
if (onChange) {
@@ -268,7 +267,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
268267
}
269268

270269
return (
271-
<CodeEditorContext.Provider value={{ dispatch, state, handleLanguageChange, error, defaultValue, height, width }}>
270+
<CodeEditorContext.Provider value={{ dispatch, state, handleLanguageChange, error, defaultValue, height }}>
272271
{children}
273272
{loading ? (
274273
<CodeEditorPlaceholder customLoader={customLoader} />
@@ -287,7 +286,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
287286
theme={state.theme.toLowerCase().split(' ').join('-')}
288287
editorDidMount={editorDidMount}
289288
height={height}
290-
width={width}
289+
width="100%"
291290
/>
292291
) : (
293292
<MonacoEditor
@@ -298,7 +297,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
298297
onChange={handleOnChange}
299298
editorDidMount={editorDidMount}
300299
height={height}
301-
width={width}
300+
width="100%"
302301
/>
303302
)}
304303
</>

src/Common/CodeEditor/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export interface CodeEditorInterface {
3737
noParsing?: boolean
3838
inline?: boolean
3939
height?: number | string
40-
width?: number | string
4140
shebang?: string | JSX.Element
4241
diffView?: boolean
4342
loading?: boolean

0 commit comments

Comments
 (0)