Skip to content

Commit 4ee7597

Browse files
Merge pull request #1633 from devtron-labs/code_editor_inline_diff_fix
fix: inline diff issue fix
2 parents 1f65f25 + ea8801d commit 4ee7597

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/components/CodeEditor/CodeEditor.tsx

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -237,19 +237,19 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
237237
if (!validatorSchema) {
238238
return
239239
}
240-
const config= configureMonacoYaml(monaco, {
241-
enableSchemaRequest: true,
242-
isKubernetes,
243-
schemas: [
244-
{
245-
uri: `https://github.com/devtron-labs/devtron/tree/main/scripts/devtron-reference-helm-charts/reference-chart_${chartVersion}/schema.json`, // id of the first schema
246-
fileMatch: ['*'], // associate with our model
247-
schema: validatorSchema,
248-
},
249-
],
240+
const config = configureMonacoYaml(monaco, {
241+
enableSchemaRequest: true,
242+
isKubernetes,
243+
schemas: [
244+
{
245+
uri: `https://github.com/devtron-labs/devtron/tree/main/scripts/devtron-reference-helm-charts/reference-chart_${chartVersion}/schema.json`, // id of the first schema
246+
fileMatch: ['*'], // associate with our model
247+
schema: validatorSchema,
248+
},
249+
],
250250
})
251-
return ()=>{
252-
config.dispose()
251+
return () => {
252+
config.dispose()
253253
}
254254
// eslint-disable-next-line react-hooks/exhaustive-deps
255255
}, [validatorSchema, chartVersion])
@@ -334,6 +334,12 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
334334
return `<span style="padding-right:6px">${lineNumber}</span>`
335335
},
336336
}
337+
338+
const diffViewOptions: monaco.editor.IDiffEditorConstructionOptions = {
339+
...options,
340+
useInlineViewWhenSpaceIsLimited: false,
341+
}
342+
337343
return (
338344
<CodeEditorContext.Provider value={{ dispatch, state, handleLanguageChange, error, defaultValue, height }}>
339345
{children}
@@ -348,7 +354,7 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
348354
value={state.code}
349355
language={state.mode}
350356
onChange={handleOnChange}
351-
options={options}
357+
options={diffViewOptions}
352358
theme={state.theme.toLowerCase().split(' ').join('-')}
353359
editorDidMount={editorDidMount}
354360
height={height}

0 commit comments

Comments
 (0)