Ben Downey
Ben Downey

Reputation: 2665

TinyMCE: using maxchars plugin in Rails

I've got a Rails app that is using TinyMCE, via the TinyMCE-Rails gem. I'm trying to use the maxchars plugin to get word count going. I've added the plugin to config/tinymce.yml

plugins:
  - fullscreen
  - maxchars

And I've added the max_chars and max_chars_indicators to my view.

<%= simple_form_for @project |f| %>
  <%= f.input :overview, input_html: { :class => "tinymce", :rows => 70, :cols => 140 } %>
  <%= tinymce max_chars: 6000, max_chars_indicator: "characterCounter" %>
  <div id="characterCounter">

   </div>

   <div class="form-actions add-top">
     <hr>
     <p>
       <%= f.button :submit, :class => 'inline-block large_button add-bottom' %>
     </p>
    </div>
<% end %>        

But now the editor doesn't even appear. Is there something I'm missing when it comes to adding this plugin?

Upvotes: 1

Views: 498

Answers (1)

Ben Downey
Ben Downey

Reputation: 2665

Complex solution for this problem: had to actually read the documentation! (Outrageous, right?!)

I had neglected to actually download the plugin files. I created a directory, app/assets/javascripts/tinymce/plugins/ and popped in the folder containing the necessary JS files. Once I started my server, everything worked great.

Upvotes: 1

Related Questions