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

Issue with back button and turbolinks 5 #134

Closed
borisrorsvort opened this issue Aug 31, 2016 · 2 comments
Closed

Issue with back button and turbolinks 5 #134

borisrorsvort opened this issue Aug 31, 2016 · 2 comments

Comments

@borisrorsvort
Copy link

Everything seems to work fine except when hitting the back button after a Turbolink visit
Consider this code:

import $ from 'jquery'
import SimpleMDE from 'simplemde';

$.onmount('#markitup', function () {
  if ($("#markitup").length === 1) {
    var simplemde = new SimpleMDE({ element: $("#markitup")[0] });
  }
})

$(document).on('ready turbolinks:load', function () { $.onmount() })
$(document).on('turbolinks:before-render', function () { $.onmount.teardown() })

SimpleMDE is never triggered twice while changing the page (clicking on links) except when pressing the back button

@rstacruz
Copy link
Owner

rstacruz commented Sep 1, 2016

Would appreciate some help here. I'm not knee-deep into Turbolinks internals quite yet.

@rstacruz
Copy link
Owner

Oh I got this. You need an exit handler for that to clean up (undo) what SimpleMDE has done.

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

2 participants