11import React from 'react' ;
22
3- import { RadioButton , Switch , Text } from '@gravity-ui/uikit' ;
3+ import { RadioButton , Switch , Text , useTheme } from '@gravity-ui/uikit' ;
44import noop from 'lodash/noop' ;
55import { Form } from 'react-final-form' ;
66import MonacoEditor from 'react-monaco-editor' ;
@@ -32,6 +32,7 @@ export const Editor: React.FC<EditorProps> = ({spec: externalSpec, value, viewMo
3232 const [ ready , setReady ] = React . useState ( true ) ;
3333 const [ toggler , setToggler ] = React . useState < 'form' | 'view' | 'json' > ( 'form' ) ;
3434 const [ parseJson , setParseJson ] = React . useState ( false ) ;
35+ const theme = useTheme ( ) ;
3536
3637 const togglerItems = React . useMemo (
3738 ( ) => [
@@ -70,11 +71,16 @@ export const Editor: React.FC<EditorProps> = ({spec: externalSpec, value, viewMo
7071 } ,
7172 spec : { viewSpec : { monacoParams : { language : 'json' , fontSize : 11 } } } ,
7273 MonacoComponent : ( props : MonacoEditorProps ) => (
73- < MonacoEditor { ...props } width = "640px" height = "calc(100% - 49px)" />
74+ < MonacoEditor
75+ { ...props }
76+ width = "640px"
77+ height = "calc(100% - 49px)"
78+ theme = { `vs-${ theme . includes ( 'dark' ) ? 'dark' : 'light' } ` }
79+ />
7480 ) ,
7581 withoutDialog : true ,
7682 } ) as MonacoInputBaseProps ,
77- [ ] ,
83+ [ theme ] ,
7884 ) ;
7985
8086 const getValuesEditorProps = React . useCallback (
@@ -86,11 +92,16 @@ export const Editor: React.FC<EditorProps> = ({spec: externalSpec, value, viewMo
8692 } ,
8793 spec : { viewSpec : { monacoParams : { language : 'json' , fontSize : 11 } , disabled : true } } ,
8894 MonacoComponent : ( props : MonacoEditorProps ) => (
89- < MonacoEditor { ...props } width = "640px" height = "calc(100% - 49px)" />
95+ < MonacoEditor
96+ { ...props }
97+ width = "640px"
98+ height = "calc(100% - 49px)"
99+ theme = { `vs-${ theme . includes ( 'dark' ) ? 'dark' : 'light' } ` }
100+ />
90101 ) ,
91102 withoutDialog : true ,
92103 } ) as MonacoInputBaseProps ,
93- [ ] ,
104+ [ theme ] ,
94105 ) ;
95106
96107 const getViewProps = React . useCallback (
0 commit comments