{"size": 861, "ext": "js", "max_stars_repo_path": "example/EditorRefExample.js", "max_stars_repo_name": "BSTester/react-neditor", "max_stars_repo_stars_event_min_datetime": "2019-06-04T01:43:53.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-15T03:02:33.000Z", "max_issues_repo_path": "example/EditorRefExample.js", "max_issues_repo_name": "BSTester/react-neditor", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "example/EditorRefExample.js", "max_forks_repo_name": "BSTester/react-neditor", "max_forks_repo_forks_event_min_datetime": "2020-03-03T10:07:01.000Z", "max_forks_repo_forks_event_max_datetime": "2020-03-03T10:07:01.000Z"}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 18.3191489362, "max_line_length": 62, "alphanum_fraction": 0.5737514518}
import React from 'react'
import ReactNeditor from '../src'

class EditorRefExample extends React.Component {
  constructor() {
    super()
    this.ueditorRef = null
    this.state = {
      content: '',
    }
  }

  getUeditor = ref => {
    this.ueditorRef = ref
  }

  getUeditorContent = ref => {
    this.setState({
      content: this.ueditorRef.getContent(),
    })
  }

  handleReady = () => {
    this.ueditorRef.setHeight(200)
  }

  render() {
    let {content} = this.state

    return (
      <div>
        <ReactNeditor
          debug
          neditorPath='../neditor'
          getRef={this.getUeditor}
          onChange={this.updateEditorContent}
          onReady={this.handleReady}
        />
        <button onClick={this.getUeditorContent}>获取内容</button>
        <p>{content}</p>
      </div>
    )
  }
}

export default EditorRefExample
