ucfopen / Obojobo

Next generation course content for your LMS. Easy for beginners, but powerful enough for researchers.
https://ucfopen.github.io/Obojobo-Docs/
GNU Affero General Public License v3.0
70 stars 34 forks source link

WIP Auto Save #2135

Open Viggie1 opened 4 months ago

Viggie1 commented 4 months ago

This PR allows for auto saving the editor whilst a user is working on it. The way this works is that there is an interval set for every minute that compares the saved JSON to the page's current JSON, if different than it saves the current JSON into local storage. If editor is still not saved after the user refreshes the client, then the client will pop up with a modal asking if the user would like to overwrite their changes, to which they can either confirm or deny. Additionally, this PR implements a "Last saved Xm ago" text in the file toolbar after the user saves, indicating to the user that it has been X amount of time since they have saved the module. The reasons for this PR being a WIP are: 1.) Testing was not complete 2.) A browser alert still pops up even after confirming to overwrite changes that indicates "changes may not be saved". This code lies within the checIfSaved function that would need a conditional to fix it.

All of the code written for this branch are in the visual-editor.js, editor-app.js, and their corresponding test files.