SammyLin/redactor-rails

Redactor Rails renders multiple forms

Opened this issue · 16 comments

screen shot 2015-08-17 at 3 40 20 pm
screen shot 2015-08-17 at 3 37 52 pm

Creating or updating a post renders multiple forms at first, but if you refresh the view the problem is fixed.

I have also experienced this issue.

@jaymiejones86 Oh geesus, I spent 45 minutes trying to fix it earlier after following these steps for install, and got no where:

  1. Add 'redactor-rails' gem to Gemfile
  2. bundle install
  3. Include in application.js & application.css.scss
  4. = f.input :content, :input_html => { :class => "redactor" }

Again, the editor works and the view is fixed on refresh but it is still an error. Ended up tagging this as an Issue and wonder if there is a fix or a text editor that won't do this.

@tbcooney we had similar issues, only 2 instances of the editor though and the 2 instances showed pretty much all the time.

I would also note there was no issue back with 0.4.2

@jaymiejones86 I just reverted to 0.4.2 and I get only 2 instances of the editor, however, the extra instance will disappear on refresh, weird. When I reverted to 0.3.7 the issue was no longer present (not the best fix lol).

@tbcooney hmmm so odd. Ill need to find some spare time to look and maybe issue a PR, but hope someone else beats me to it.

Had the same issue and messed around with how the JavaScript was initalizing the editor. It worked fine in development but when deployed it would render two editors in production. I'll look back on my commit notes and try to find the fix for you guys.

Hi guys, I'm also having the same issue. It renders 2 instances of the editor, however even refreshing does not help.

I already revised the initialization code but not luck.

Anyone got any progress on this?

/cc @lucasklaassen @jaymiejones86 @tbcooney

@brunnogomes we found that you did not have to have initialisation code if you just want the defaults and are hooking into a class redactor.

If you do some initialisation, make sure the class name is not redactor.

This happened to me too... I realized that I added a class: "redactor" and initialized it in my javascript code. So if you're going to initialize it, use a different class.

No worries Brunno.
On Fri, 18 Dec 2015 at 5:30 AM, Brunno Gomes notifications@github.com
wrote:

Thanks @jaymiejones86 https://github.com/jaymiejones86!


Reply to this email directly or view it on GitHub
#151 (comment)
.

Jaymie Jones
@pixelstackcom
http://jaymiejonesphoto.com
http://codercatchup.com
https://devbase.io

Thanks for this info. I was really confused what the issue was. So I just changed the class name from .redactor to .redactor-row in the config.js and called that class in the text areas. Done! 💃

No worries @sankalpsingha
Happy redactoring.

bigos commented

Perhaps it's not exactly the right solution, but I have a quick fix in my fork.
https://github.com/bigos/redactor-rails
I have modified gem to use all the plug-ins and get rid of duplicate forms.

Gemfile:
gem 'redactor-rails', github: 'bigos/redactor-rails', branch: 'master'

application.js
//= require redactor-rails
//= require redactor-rails/plugins

application.css
*= require redactor-rails
*= redactor-rails/plugins

bigos commented

Link to the diff bigos@ac2cc62