| 1 |
import React from 'react'; |
| 2 |
import PropTypes from 'prop-types'; |
| 3 |
import CodeMirror from 'react-codemirror'; |
| 4 |
require('codemirror/lib/codemirror.css'); |
| 5 |
require('codemirror/mode/css/css'); |
| 6 |
|
| 7 |
const SettingCode = (props) => { |
| 8 |
return ( |
| 9 |
<CodeMirror |
| 10 |
className="bvs-setting-input" |
| 11 |
value={props.value} |
| 12 |
onChange={(value) => props.onValueChange(value)} |
| 13 |
options={{ |
| 14 |
lineNumbers: true, |
| 15 |
mode: props.setting.code, |
| 16 |
}} |
| 17 |
/> |
| 18 |
); |
| 19 |
} |
| 20 |
|
| 21 |
SettingCode.propTypes = { |
| 22 |
setting: PropTypes.object.isRequired, |
| 23 |
value: PropTypes.any.isRequired, |
| 24 |
onValueChange: PropTypes.func.isRequired, |
| 25 |
} |
| 26 |
|
| 27 |
export default SettingCode; |