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

Detecting unsaved changes #148

Open
ghost opened this issue May 25, 2016 · 1 comment
Open

Detecting unsaved changes #148

ghost opened this issue May 25, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented May 25, 2016

Is there a method to determine if there are unsaved changes?

Writing some Javascript to alert the user upon navigation.

@bago
Copy link
Member

bago commented May 25, 2016

Solutions:

A) saved state

  • change the save code so to store in memory the "latest saved json".
  • upon navigation run an "viewModel.exportJSON()" and compare it to the "last saved json".

B) dirty flag

  • add a "dirty" boolean to the viewModel
  • made dirty = false when you save
  • make dirty = true when you make any change (maybe in a plugin working like the "undomanager plugin".
  • upon navigation check the dirty flag.

Both could be made generic enough to be included in the main baseline... I don't plan to have time soon... maybe I can work on something similar in the next months. Contributions are welcome.

@bago bago added this to the 0.15 milestone May 25, 2016
@bago bago modified the milestones: 0.15, 0.16 Sep 5, 2016
@bago bago modified the milestones: 0.16, 0.17 Mar 20, 2017
@bago bago modified the milestones: 0.17, 0.18 Feb 28, 2018
@bago bago removed this from the 0.18 milestone Apr 27, 2022
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

1 participant