Created
February 13, 2018 06:34
-
-
Save andrerpena/d0d7202ec61f730bb461cb99ad8341a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import * as ReduxForm from "redux-form"; | |
interface MarkdownEditorProps extends ReduxForm.WrappedFieldProps { | |
} | |
interface MarkdownEditorState { | |
} | |
export class MarkdownEditor extends React.Component<MarkdownEditorProps, MarkdownEditorState> { | |
handleValueChange = (value: ReactMdeTypes.Value) => { | |
const {onChange} = this.props.input; | |
onChange(value as any); | |
} | |
render() { | |
const {meta: {invalid, touched}, input: {name, value}} = this.props; | |
return ( | |
<div className={`markdown-editor ${invalid ? "invalid" : ""}`}> | |
<ReactMde | |
textAreaProps={{id: name, name, rows: 20}} | |
value={value} | |
onChange={this.handleValueChange} | |
commands={ReactMdeCommands.getDefaultCommands()} | |
visibility={{preview: false}} | |
/> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment