spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
812 stars 256 forks source link

tinymce does not load if upon loading the page I immediately click on the textfield #192

Open Nickk4 opened 8 years ago

Nickk4 commented 8 years ago

I have a pretty straightforward implementation of tinymce (see below). When I load the page that has a textfield that uses tinymce in it, and immediately quickly click on that textfield (before the page had a chance to load tinymce) then tinymce won't load. The textfield will then just be a regular textfield. So there seems a timing issue of some sorts going on. Is there a solution around this or is this a bug?

The problem particularly exists on my (slow) development server. On the production server there's hardly a chance to click the textfield before tinymce has been loaded, so there you need to be really quick with clicking that textfield to replicate the problem (but it is possible).

My form:

<%= tinymce_assets %> 
...Some text...
<%= form_for(@helptext, html: {class: "form-horizontal"}) do |f| %>
<%= render 'shared/error_messages', object: f.object %>
  <%= f.text_area :description, maxlength: 250, class: 'form-control input-md', rows: 2 %>
  <%= f.text_area :content, :required => true, :class => "form-control input-md tinymce", :rows => 10, :cols => 120 %>
  <%= f.submit "Save changes" %>
<% end %>
<%= tinymce %>

Gemfile

gem 'tinymce-rails'

I've customized config/tinymce.yml.

Nickk4 commented 8 years ago

I replaced gem 'tinymce-rails', '4.3.2' in my gemfile with gem 'tinymce-rails', :git => 'git://github.com/spohlenz/tinymce-rails.git'. Now the problem seems to be gone. Does that make sense? It seems to be still using the same 4.3.2 version...