1
+ import { ViewerBox , ViewerBoxProps } from '@content-ui/md-mui/ViewerBox'
1
2
import { useContentSelection } from '@content-ui/react/ContentSelectionContext'
2
- import React from 'react'
3
+ import { ComponentType , CSSProperties , MutableRefObject , useMemo } from 'react'
3
4
import { CodeMirrorComponentProps } from '@ui-schema/kit-codemirror/CodeMirror'
4
5
import { Extension } from '@codemirror/state'
5
6
import Box from '@mui/material/Box'
@@ -13,23 +14,23 @@ import IcAutoProcess from '@mui/icons-material/ModelTraining'
13
14
import { CodeMirrorOnChange } from '@ui-schema/kit-codemirror/useCodeMirror'
14
15
import { useContentContext } from '@content-ui/react/ContentFileContext'
15
16
import { WithContent } from '@content-ui/react/useContent'
16
- import { Viewer , ViewerProps } from '@content-ui/md-mui/Viewer'
17
17
18
18
export interface ViewEditorProps extends Pick < WithContentEditor , 'autoProcess' | 'setAutoProcess' > , Omit < WithContent , 'file' | 'root' > {
19
- CodeMirror : React . FC < CodeMirrorComponentProps >
19
+ CodeMirror : ComponentType < CodeMirrorComponentProps >
20
20
extensions ?: Extension [ ]
21
21
preview ?: boolean
22
- refWarningBox ?: React . MutableRefObject < HTMLDivElement | null >
22
+ refWarningBox ?: MutableRefObject < HTMLDivElement | null >
23
23
onChange ?: CodeMirrorOnChange
24
24
valid ?: boolean
25
25
textValue : string
26
26
bigSize ?: boolean
27
27
noLint ?: boolean
28
+ ViewerBox ?: ComponentType < ViewerBoxProps >
28
29
// passed to the `CodeMirror` component
29
- editorStyle ?: React . CSSProperties
30
+ editorStyle ?: CSSProperties
30
31
}
31
32
32
- export const ContentInput : React . ComponentType < ViewEditorProps & Omit < ViewerProps , 'needsProcessing' | 'editorSelection' > > = (
33
+ export const ContentInput = (
33
34
{
34
35
valid,
35
36
preview,
@@ -41,17 +42,18 @@ export const ContentInput: React.ComponentType<ViewEditorProps & Omit<ViewerProp
41
42
processing, noLint, outdated,
42
43
autoProcess, setAutoProcess,
43
44
bigSize,
45
+ ViewerBox : ViewerBoxProp = ViewerBox ,
44
46
...props
45
- } ,
47
+ } : ViewEditorProps & Omit < ViewerBoxProps , 'needsProcessing' | 'editorSelection' | 'onChange' > ,
46
48
) => {
47
49
const { file} = useContentContext ( )
48
50
const editorSelection = useContentSelection ( )
49
51
50
- const classNamesContent = React . useMemo ( ( ) => ( valid === false ? [ 'invalid' ] : undefined ) , [ valid ] )
52
+ const classNamesContent = useMemo ( ( ) => ( valid === false ? [ 'invalid' ] : undefined ) , [ valid ] )
51
53
52
54
return < >
53
55
{ preview ?
54
- < Viewer
56
+ < ViewerBoxProp
55
57
outdated = { outdated }
56
58
processing = { processing }
57
59
{ ...props }
0 commit comments