Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.