This commit is contained in:
Thomas Nordquist
2019-06-17 12:12:22 +02:00
parent 90e5336c5c
commit fcb61b563c
6 changed files with 174 additions and 123 deletions

View File

@@ -0,0 +1,39 @@
import * as React from 'react'
import { default as AceEditor } from 'react-ace'
import { Theme, withTheme } from '@material-ui/core'
import 'brace/mode/json'
import 'brace/theme/dawn'
import 'brace/theme/monokai'
import 'brace/mode/xml'
import 'brace/mode/text'
import 'react-ace'
function Editor(props: {
editorMode: string
theme: Theme
value: string | undefined
onChange: (value: string) => void
}) {
const editorOptions = {
showLineNumbers: false,
tabSize: 2,
}
return (
<AceEditor
style={{}}
mode={props.editorMode}
theme={props.theme.palette.type === 'dark' ? 'monokai' : 'dawn'}
name="UNIQUE_ID_OF_DIV"
width="100%"
height="200px"
showGutter={true}
value={props.value}
onChange={props.onChange}
setOptions={editorOptions}
editorProps={{ $blockScrolling: true }}
/>
)
}
export default withTheme(Editor)