diff --git a/lib/editor.js b/lib/editor.js index b109fb3d..e5cb1284 100644 --- a/lib/editor.js +++ b/lib/editor.js @@ -1,7 +1,6 @@ import assign from 'object-assign'; import blacklist from 'blacklist'; import React from 'react'; -import ReactDOM from 'react-dom'; if (typeof document !== 'undefined') { var MediumEditor = require('medium-editor'); @@ -21,12 +20,10 @@ export default class ReactMediumEditor extends React.Component { } componentDidMount() { - const dom = ReactDOM.findDOMNode(this); - - this.medium = new MediumEditor(dom, this.props.options); + this.medium = new MediumEditor(this.dom, this.props.options); this.medium.subscribe('editableInput', (e) => { this._updated = true; - this.change(dom.innerHTML); + this.change(this.dom.innerHTML); }); } @@ -49,6 +46,7 @@ export default class ReactMediumEditor extends React.Component { render() { const tag = this.props.tag; const props = blacklist(this.props, 'options', 'text', 'tag', 'contentEditable', 'dangerouslySetInnerHTML'); + props.ref = node => this.dom = node assign(props, { dangerouslySetInnerHTML: { __html: this.state.text }