11import React from 'react' ;
22
3- import { RadioButton } from '@gravity-ui/uikit' ;
3+ import { RadioButton , Switch , Text } from '@gravity-ui/uikit' ;
44import _ from 'lodash' ;
55import { Form } from 'react-final-form' ;
66import MonacoEditor from 'react-monaco-editor' ;
@@ -31,6 +31,7 @@ export const Editor: React.FC<EditorProps> = ({spec: externalSpec, value, viewMo
3131 const [ spec , setSpec ] = React . useState ( externalSpec ) ;
3232 const [ ready , setReady ] = React . useState ( true ) ;
3333 const [ toggler , setToggler ] = React . useState < 'form' | 'view' | 'json' > ( 'form' ) ;
34+ const [ parseJson , setParseJson ] = React . useState ( false ) ;
3435
3536 const togglerItems = React . useMemo (
3637 ( ) => [
@@ -113,6 +114,10 @@ export const Editor: React.FC<EditorProps> = ({spec: externalSpec, value, viewMo
113114 return (
114115 < div className = { b ( { docs : viewMode === 'docs' } ) } >
115116 < div className = { b ( 'options' ) } >
117+ < div className = { b ( 'parse-json' ) } >
118+ < Text variant = "body-2" > Parse default values like json</ Text >
119+ < Switch onChange = { ( ) => setParseJson ( ( v ) => ! v ) } className = { b ( 'switch' ) } />
120+ </ div >
116121 < div className = { b ( 'monaco' ) } >
117122 < MonacoInput { ...specEditorProps } />
118123 </ div >
@@ -137,7 +142,7 @@ export const Editor: React.FC<EditorProps> = ({spec: externalSpec, value, viewMo
137142 < DynamicField
138143 name = "input"
139144 spec = { spec }
140- parseJsonDefaultValue = { false }
145+ parseJsonDefaultValue = { parseJson }
141146 />
142147 </ div >
143148 ) : null }
0 commit comments