Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Im having a weird behavior #116

Closed
delacruzjames opened this issue Mar 30, 2015 · 6 comments
Closed

Im having a weird behavior #116

delacruzjames opened this issue Mar 30, 2015 · 6 comments

Comments

@delacruzjames
Copy link

Please check if i missed something. thanks in advance

  1. add gem 'bootstrap-wysihtml5-rails' to Gemfile

  2. *= require bootstrap-wysihtml5 to ../application.css.scss

  3. //= 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

@Nerian
Copy link
Owner

Nerian commented Apr 9, 2015

I don't see anything wrong. Did you solve it?

@binyamindavid
Copy link
Contributor

interesting, having the same problem; @delacruzjames how did you solve it?

@thotmx
Copy link

thotmx commented May 19, 2015

@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.

@delacruzjames
Copy link
Author

@thotmx already did it
= f.input :content, input_html: { class: 'wysihtml5'}

the output is the same.

@thotmx
Copy link

thotmx commented May 19, 2015

@delacruzjames
How many times are you executing the javascript code to set the wysihtml5?
$(elem).wysihtml5(); <- This kind of execution.

@moeabdol
Copy link

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.

@Nerian Nerian closed this as completed Feb 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants