Im having a weird behavior
delacruzjames opened this issue · comments
Please check if i missed something. thanks in advance
-
add
gem 'bootstrap-wysihtml5-rails'
to Gemfile -
*= require bootstrap-wysihtml5
to ../application.css.scss -
//= require bootstrap-wysihtml5
to ../application.js
4
$(document).ready(function(){$('.wysihtml5').each(function(i, elem) {
$(elem).wysihtml5();
});})
5, <%= f.input :content, as: :wysihtml5 %>
and im having something like this
http://gyazo.com/60be773da04ab721db2dbbf92856d69a
I don't see anything wrong. Did you solve it?
interesting, having the same problem; @delacruzjames how did you solve it?
@delacruzjames This problem is a little strange, and the reason is because you're activating the plugin twice.
The simplest way to solve it:
= f.input :content, input_html: { class: 'wysihtml5'}
The origin: https://github.com/Nerian/bootstrap-wysihtml5-rails/blob/master/lib/bootstrap-wysihtml5-rails/simple_form/wysihtml5_input.rb
@benjaminsigidi, The way to solve it permanently is only setting the .wysihtml5 class on the input, instead of adding javascript code.
@thotmx already did it
= f.input :content, input_html: { class: 'wysihtml5'}
the output is the same.
@delacruzjames
How many times are you executing the javascript code to set the wysihtml5?
$(elem).wysihtml5(); <- This kind of execution.
The problem occurs when Turbolink is enabled in your application. Sometimes turbolinks fires a javascript call twice. I'm yet to solve this issue myself, but atleast we can pinpoint the issue for the time being.