mgreminger / EngineeringPaper.xyz

EngineeringPaper.xyz is a web app that makes it easy to create, save, and share engineering calculations.
https://EngineeringPaper.xyz
MIT License
126 stars 9 forks source link

Improve local save, add local auto save #238

Closed memtech3 closed 7 months ago

memtech3 commented 8 months ago

The current workflow for local save requires you to specify the filename and prompts the user about overwriting the previous version of the document each time you save.

I'd like to see the save feature just sort of take care of itself. By that I mean when you hit Ctrl + s or the save button if the document has already been stored locally the local file is automatically updated or overwritten without prompting the user about overwriting a file of the same name.

I'd also love to see auto save for local documents so that I don't have to worry as much about saving every few minutes.

This is a super cool project and I'm giving it a spin for my solid mechanics class, so far it's been pretty cool!

mgreminger commented 8 months ago

Good point on the repeated Ctrl-S behavior, the file should should just replaced, like you suggest, since the name has already been chosen. This shouldn't be too difficult of a change to make. This will only work on Chrome based browsers. Firefox and Safari will download the file instead, like they do currently, since these browsers don't support the File System Access API that this functionality depends on.

For the autosave request, this is already done, just not to the document file. If you're using EP in the browser, you'll notice the temp-checkpoint- URLS appear as you edit the document. These get saved every 10 seconds to local browser storage if changes have been made to the file. If you refresh a browser page, or navigate away and back to the checkpoint, your sheet will be restore to the previous checkpoint and you won't loose any of your work other than the last 10 seconds worth. This even works if your browser crashes and you restore your previous session's tabs. If you install EP as a standalone app, it's still doing this, but it's a little more difficult to restore the checkpoints since the URL is not accessible and the standalone app doesn't restore the previous session in the same way as the browser does with tabs.

memtech3 commented 8 months ago

I'd like to see the autosave happen to the file and so that it doesn't warn me about data loss every time I close a file

mgreminger commented 7 months ago

The repeated save behavior has been update to replace the file on repeated saves. I've also fixed the issue where it didn't recognized that a file was saved when you try to close the tab (will no longer warn about data loss in this situation).