mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
4bf0189ffc
* Added code editor indent settings (#145) * Added default indent size (4) in code editor (#145)
55 lines
1.2 KiB
JavaScript
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;
|