From 4020dfc9123aaf4e561830964e2bf80d8eff59dd Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Tue, 27 Sep 2016 13:07:52 +0200 Subject: [PATCH] Refactored MarkdownControl to not use constructor and simplified render method --- src/components/Widgets/MarkdownControl.js | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/components/Widgets/MarkdownControl.js b/src/components/Widgets/MarkdownControl.js index 483be419..e010abd9 100644 --- a/src/components/Widgets/MarkdownControl.js +++ b/src/components/Widgets/MarkdownControl.js @@ -7,26 +7,21 @@ 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() { this.useRawEditor(); processEditorPlugins(registry.getEditorComponents()); } - useVisualEditor() { + useVisualEditor = () => { this.props.switchVisualMode(true); } - useRawEditor() { + useRawEditor = () => { this.props.switchVisualMode(false); } - renderEditor() { + render() { const { editor, onChange, onAddMedia, getMedia, value } = this.props; if (editor.get('useVisualMode')) { return ( @@ -55,15 +50,6 @@ class MarkdownControl extends React.Component { ); } } - - render() { - return ( -
- - {this.renderEditor()} -
- ); - } } MarkdownControl.propTypes = {