title: How to save draft-js editorState data to Meteor?
body: <p>How to save the Data from draft-js to Meteor? </p>
  
  <p>I'm trying to...</p>
  
  <ul>
  <li><strong>save the data from Draft-js to the db</strong> </li>
  <li><strong>Using React + Meteor</strong></li>
  </ul>
  
  <p>Here is <a href="https://github.com/facebook/draft-js" rel="nofollow noreferrer">Draft.js</a>. Here's a <a href="https://github.com/AdamBrodzinski/meteor-react-boilerplate" rel="nofollow noreferrer">Meteor starter kit</a>. There's also <a href="https://forums.meteor.com/t/solved-how-to-save-editorstate-data-from-draftjs-in-meteor/33326/4" rel="nofollow noreferrer">this article</a> which seems relevant.</p>
  
  <p>But I can't apply the bits of information to the project.</p>
  
  <p>Considering my ~/imports/collections/bins.js to be</p>
  
  <pre><code>import { Mongo } from 'meteor/mongo';
  
  Meteor.methods({
    'bins.insert': function() {
      return Bins.insert({
        createdAt: new Date(),
        content: '',
        sharedWith: [],
        ownerId: this.userId
      });
    },
  
    'bins.remove': function(bin) {
      return Bins.remove(bin);
    },
  
    'bins.update': function(bin, content) {
      return Bins.update(bin._id, { $set: { content } });
    }
  });
  
  export const Bins = new Mongo.Collection('bins');
  </code></pre>
  
  <p>And considering the guidelines found in <a href="https://medium.com/@adrianli/a-beginner-s-guide-to-draft-js-d1823f58d8cc#.1d5nudgqs" rel="nofollow noreferrer">A Beginner’s Guide to Draft JS</a> to be</p>
  
  <pre><code>import React from ‘react’;
  import {Editor, EditorState, RichUtils} from ‘draft-js’;
  export default class App extends React.Component {
    constructor(props) {
      super(props);
      this.state = {editorState: EditorState.createEmpty()};
      this.onChange = (editorState) =&gt; this.setState({editorState});
    }
    _onBoldClick() {
      this.onChange(RichUtils.toggleInlineStyle(
        this.state.editorState,
        ‘BOLD’
      ));
    }
    render() {
      return (
        &lt;div id=”content”&gt;
          &lt;h1&gt;Draft.js Editor&lt;/h1&gt;
          &lt;button onClick={this._onBoldClick.bind(this)}&gt;Bold&lt;/button&gt;
          &lt;div className=”editor”&gt;
            &lt;Editor
              editorState={this.state.editorState}
              onChange={this.onChange}
            /&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      );
    }
  }
  </code></pre>