From 1a954912fa30794bebf50eba825204b040c4aecf Mon Sep 17 00:00:00 2001 From: Agustin Falco Date: Fri, 2 Feb 2018 10:37:40 -0300 Subject: [PATCH] Removed findomnode which will be deprecated. --- lib/editor.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 }