insomnia/app/ui/components/editors/body/raw-editor.js
Renaud LITTOLFF 4bf0189ffc Added code editor indent settings (#147)
* Added code editor indent settings (#145)

* Added default indent size (4) in code editor (#145)
2017-04-14 14:47:15 -07:00

55 lines
1.2 KiB
JavaScript

import React, {PropTypes, PureComponent} from 'react';
import CodeEditor from '../../codemirror/code-editor';
class RawEditor extends PureComponent {
render () {
const {
contentType,
content,
fontSize,
indentSize,
keyMap,
render,
getRenderContext,
lineWrapping,
onChange,
className
} = this.props;
return (
<CodeEditor
manualPrettify
fontSize={fontSize}
indentSize={indentSize}
keyMap={keyMap}
defaultValue={content}
className={className}
render={render}
getRenderContext={getRenderContext}
onChange={onChange}
mode={contentType}
lineWrapping={lineWrapping}
placeholder="..."
/>
);
}
}
RawEditor.propTypes = {
// Required
onChange: PropTypes.func.isRequired,
content: PropTypes.string.isRequired,
contentType: PropTypes.string.isRequired,
fontSize: PropTypes.number.isRequired,
indentSize: PropTypes.number.isRequired,
keyMap: PropTypes.string.isRequired,
lineWrapping: PropTypes.bool.isRequired,
// Optional
className: PropTypes.string,
render: PropTypes.func,
getRenderContext: PropTypes.func
};
export default RawEditor;