mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
b198e6170b
* Removed some unnecessary rendering * Only PureComponents and some other stuff * Removed all functional components * Only deal with nunjucks marks * Remove ref assign functions in modals * Lots of tweaks * A bit snappier * A bit snappier
48 lines
1000 B
JavaScript
48 lines
1000 B
JavaScript
import React, {PropTypes, PureComponent} from 'react';
|
|
import Editor from '../../codemirror/Editor';
|
|
|
|
class RawEditor extends PureComponent {
|
|
render () {
|
|
const {
|
|
contentType,
|
|
content,
|
|
fontSize,
|
|
keyMap,
|
|
render,
|
|
lineWrapping,
|
|
onChange,
|
|
className
|
|
} = this.props;
|
|
|
|
return (
|
|
<Editor
|
|
manualPrettify={true}
|
|
fontSize={fontSize}
|
|
keyMap={keyMap}
|
|
value={content}
|
|
className={className}
|
|
render={render}
|
|
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,
|
|
keyMap: PropTypes.string.isRequired,
|
|
lineWrapping: PropTypes.bool.isRequired,
|
|
|
|
// Optional
|
|
render: PropTypes.func,
|
|
};
|
|
|
|
export default RawEditor;
|