Tuesday, March 22, 2016

turbolinks 5 and ckeditor

turbolinks 5 gives some pretty neat features.
it no longer needs turbolinks-jquery.

but in some way, it doesnt work properly due to cache within turbolinks.
a work around this issue would be calling:

jQuery(document).on('turbolinks:load', (e)->
    #do your initialize here
    if Turbolinks

calling turbolinks cache helps to keep the rendered form intact.
but for some reason, this doesn't work with ckeditor.

the work around is to add this in the turbolinks:load function

    if $(this).css('visibility') != 'hidden'
      # console.log(this)

hope it helps :)

No comments: