jrm2k6/react-markdown-editor

View on GitHub
Example/components/ExampleWithOnChangeContent.js

Summary

Maintainability
A
0 mins
Test Coverage
var React = require('react');
var createClass = require('create-react-class');
var ReactMarkdownEditor = require('react-markdown-editor');
var MarkdownEditor = ReactMarkdownEditor.MarkdownEditor;

var ExampleWithOnChangeContent = createClass({
  getInitialState: function() {
    return {
      content: null
    };
  },

  render: function() {
    return (
      <div>
        <div style={{'border': '1px solid #ddd', 'padding': '10px', 'marginBottom': '30px'}}>{this.state.content}</div>
        <MarkdownEditor
          initialContent='My initial content'
          iconsSet='materialize-ui'
          onContentChange={this._onContentChange} />
      </div>
    );
  },

  _onContentChange: function(_content) {
    this.setState({content: _content});
  }
});

module.exports = ExampleWithOnChangeContent;