Skip to content

Instantly share code, notes, and snippets.

@hadijahkyampeire
Created March 30, 2020 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadijahkyampeire/bdb035bf89707eef55a984c89cc9b940 to your computer and use it in GitHub Desktop.
Save hadijahkyampeire/bdb035bf89707eef55a984c89cc9b940 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import { EditorState } from 'draft-js';
import { Editor } from 'react-draft-wysiwyg';
class MyEditor extends Component {
constructor(props) {
super(props);
this.state = {
editorState: EditorState.createEmpty()
};
}
onEditorStateChange = editorState => {
this.setState({
editorState
});
};
render() {
const { editorState } = this.state;
return (
<div>
<Editor
editorState={editorState}
wrapperClassName="rich-editor demo-wrapper"
editorClassName="demo-editor"
onEditorStateChange={this.onEditorStateChange}
placeholder="The message goes here..."
/>
</div>
);
}
}
export { MyEditor };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment