Open lperry65 opened 10 years ago
Are you using turbolinks? This sounds like it could be related to that. I'll need to look into what is required for full compatibility with turbolinks.
Hi Pohlenz, thanks for getting back to me. Yes and I can confirm that the problem goes away if I disable turbolinks. I'm also using jquery.turbolinks by kossnocorp.
Thanks,
Lee.
I'm also having this issue, it seems some dev are just disablink turbolinks for the incriminating pages.
Instead, I'm sure there is some call to do, maybe to clean up the DOM, will have to search :-)
The following could have been a solution, but it didn't work for me: http://blog.gbinghan.com/2012/04/reintialize-tinymce-after-jquery-load.html
Solution trouvée \o/ (solution found).
You just need to delete existing editors before init new one. The command I use in my "ready" handler:
$(document).ready ->
tinymce.remove()
After some testing, I recommand using this event instead
$(document).on 'page:receive', ->
tinymce.remove()
Thanks @echarp. I will add some info to the readme, or if possible, see if I can make it work seamlessly.
Thanks @echarp. I had some error. But it is "ReferenceError: Can't find variable: safari" js error only safari, in chrome it works.
Thanks @echarp
this helps tinymce.remove()
but I will also try out second option
Thank you that worked:
$(document).on 'page:receive', ->
tinymce.remove()"
Also confirming that this works:
$(document).on "page:receive", ->
tinymce.remove()
$(document).on "ready page:load", ->
tinymce.init({ selector: "selector" })
I'm using TinyMCE via the CDN and not the tinymce-rails
gem, but this solution solved my issue with TurboLinks.
Rails 4.2, TinyMCE 4
Only for reference... For Turbolinks 5:
$(document).on('turbolinks:request-end', function() {
if (tinyMCE) { tinyMCE.remove(); }
});
@caiotarifa not click... bug
document.addEventListener('turbolinks:load', function() {
tinymce.remove();
tinymce.init(config);
});
just works.
But, I do not know where to put this script? Anybody help me?
@ohyoungjooung2 You can put that JavaScript code in any JS file that is included in your Rails application.
By default, Rails has an app/assets/javascripts/application.js
file which is a manifest file, meaning it essentially is an index or listing of other loaded JS files. This is done in order to combine all your JS files into a single file, which is more efficient to send across the web rather than having 30+ smaller files (overhead of requests is big compared to transferring data).
I would personally put the snippet into a file at app/assets/javascripts/global.js
and then in your app/assets/javascripts/application.js
file add a line for //= require global
.
The //= require ...
is relative to the current folder your file is in.
dlegr250. Thanks for your kindness. I created Nginx+Unicorn+Mysql+rails 4.2.10. With turbolink no data setting, it was fine on development mode, but with nginx..blabla setting with docker run image, it is not successful. Sometimes it is ok when I click Edit, but sometimes NOT OK.
Well,,,it is not working yet.
Im using tinymce-rails 4.1.0 with rails rails 4.1.4
I've followed the setup instruction and the first time I go to the page the editor shows, however if I navigate away and the back I just see a textarea. If I refresh the browser the editor shows again ?