@@ -13,6 +13,7 @@ import {
1313 OutlinedSelectProps ,
1414 Select ,
1515 Stack ,
16+ styled ,
1617 Tab ,
1718 Table ,
1819 TableBody ,
@@ -142,6 +143,38 @@ const M2MSelect: Field = ErrorBoundary.with(
142143 } )
143144) ;
144145
146+ const MUIStyledFieldset = styled ( "fieldset" ) ( ( { theme } ) => ( {
147+ color : theme . palette . text . secondary ,
148+ margin : 0 ,
149+
150+ border : `1px solid ${ theme . palette . info } ` ,
151+ borderRadius : theme . shape . borderRadius ,
152+ } ) ) ;
153+
154+ const MDEditorField : Field = ErrorBoundary . with (
155+ { fallback : Common . Components . ErrorFallback } ,
156+ ( { disabled, formData, name, onChange : rawOnChange } ) => {
157+ const [ valueState , setValueState ] = React . useState < string | undefined > ( formData ?. toString ( ) || "" ) ;
158+ const onChange = ( value ?: string ) => {
159+ setValueState ( value ) ;
160+ rawOnChange ( value , undefined , name ) ;
161+ } ;
162+ return (
163+ < MUIStyledFieldset >
164+ < Typography variant = "subtitle2" component = "legend" children = { name } />
165+ < Stack direction = "row" spacing = { 2 } sx = { { width : "100%" , height : "100%" , minHeight : "100%" , maxHeight : "100%" , flexGrow : 1 , py : 2 } } >
166+ < Box sx = { { width : "50%" , maxWidth : "50%" } } >
167+ < Common . Components . MarkdownEditor disabled = { disabled } name = { name } value = { valueState } onChange = { onChange } extraCommands = { [ ] } />
168+ </ Box >
169+ < Box sx = { { width : "50%" , maxWidth : "50%" , backgroundColor : "#fff" } } >
170+ < Common . Components . MDXRenderer text = { valueState || "" } format = "md" />
171+ </ Box >
172+ </ Stack >
173+ </ MUIStyledFieldset >
174+ ) ;
175+ }
176+ ) ;
177+
145178type ReadOnlyValueFieldStateType = {
146179 loading : boolean ;
147180 blob : Blob | null ;
@@ -369,7 +402,7 @@ const InnerAdminEditor: React.FC<AppResourceIdType & AdminEditorPropsType> = Err
369402 onSubmit = { onSubmitFunc }
370403 disabled = { disabled }
371404 showErrorList = { false }
372- fields = { { file : FileField , m2m_select : M2MSelect } }
405+ fields = { { file : FileField , m2m_select : M2MSelect , markdown : MDEditorField } }
373406 />
374407 </ Box >
375408 </ Stack >
0 commit comments