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

Missing mechanism to prevent accidentally navigating away from editor #65

Open
jmuheim opened this issue Feb 25, 2015 · 2 comments
Open

Comments

@jmuheim
Copy link
Contributor

jmuheim commented Feb 25, 2015

When I accidentally navigate away from the editor, there's no mechanism which asks me whether I want to really leave the page and lose my edits.

I tried to drag&drop an image from my desktop to the editor, but because I didn't point exactly, the browser thought I wanted to open the image, and navigated away from the editor. After pressing the back-button, my edits were lost.

@qtnc
Copy link
Contributor

qtnc commented Feb 25, 2015

This problem has been partially solved with the "do you want to save"
dialog box, which appears when you click on a link in the editor
application.

For the rest such as the case you are mentionning, there is onunload
event, but at the time the event is sent, it don't allow such a dialog
box to appear and there is no way to prevent from navigating away. I
also tried to send an AJAX request to save the current document without
asking anything to the user when this event is fired, but it isn't
always desirable (what if I really want to go away without saving ?, and
it doesn't reliably work anyway:

  1. If the new page is faster to load than the AJAX request, then the
    AJAX request is cancelled before it arrives and thus nothing is saved.
  2. There is the synchrone mode to solve the problem above, i.e. the
    browser waits for the AJAX request to complete before navigating away.
    But in this case, sometimes the browser hangs if the AJAX request takes
    too long to complete. This is notably the case with IE.

If you have another suggestion, I would be happy to hear it.

@jmuheim
Copy link
Contributor Author

jmuheim commented Mar 4, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants