import React, { PropTypes } from 'react'; import RawEditor from './MarkdownControlElements/RawEditor'; import VisualEditor from './MarkdownControlElements/VisualEditor'; import { processEditorPlugins } from './richText'; import { connect } from 'react-redux'; import { switchVisualMode } from '../../actions/editor'; class MarkdownControl extends React.Component { constructor(props, context) { super(props, context); this.useVisualEditor = this.useVisualEditor.bind(this); this.useRawEditor = this.useRawEditor.bind(this); } componentWillMount() { processEditorPlugins(this.context.plugins.editor); } useVisualEditor() { this.props.switchVisualMode(true); } useRawEditor() { this.props.switchVisualMode(false); } renderEditor() { const { editor, onChange, onAddMedia, getMedia, value } = this.props; if (editor.get('useVisualMode')) { return (