mosaico icon indicating copy to clipboard operation
mosaico copied to clipboard

Detecting unsaved changes

Open ghost opened this issue 9 years ago • 1 comments

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

Writing some Javascript to alert the user upon navigation.

ghost avatar May 25 '16 15:05 ghost

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 avatar May 25 '16 16:05 bago