ubsicap / sltt-app

0 stars 0 forks source link

fix(sltt-app): handle passage document saving when closing window #30

Open ericpyle opened 2 months ago

ericpyle commented 2 months ago

Basically we need better support for saving passage documents during closing sltt-app window as we did for https://github.com/ubsicap/sltt/issues/914).

This react electron-agnostic approach seems promising. Start here: https://stackoverflow.com/a/71339813/24056785

Alternatively, perhaps in sltt-app on close we can just have a dialog that says "Saving changes..." which stays up until the changes are saved, then the app is allowed to close? How does the main process know when the app is ready to close? (We could use ipc communication.)

See other suggestions in https://stackoverflow.com/questions/45827709/confirm-beforeunload-in-electron

EllisBenus commented 2 weeks ago

Fixed this by adding a showMessageBox tied to the will-prevent-unload action.

https://github.com/user-attachments/assets/c072cd9a-a18d-438c-9651-4281520fedbb