ruby-on-railstinymcereactjstinymce-rails

TinyMCE loads only on refresh in ReactJS


I'm rendering my submit form via ReactJS using tinymce-rails gem for Rails app. Followed this tutorial to install tinymce: https://github.com/spohlenz/tinymce-rails

Render code:

render: function() {
  <textarea
       ref="body"
       value={this.state.data.body}
       onChange={this.handleBodyChange}
       className="tinymce form-control"
       placeholder="Body"
       rows="10"
       cols="5"
       required
  />
}

The problem is that it renders only on page refresh, without it we have regular textarea. Turbolinks are disabled. Tried to add tinymce.init({selector:'textarea'}) to the componentDidMount:, but it's not working.


Solution

  • As I figured it out I cant do this, I have to add React mixin TinyMCE.