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.
Overview
Implements basic autosave functionality.
The builder now logs all document edits to
localStorage
. If the builder closes with unsaved changes, the unsaved changes can be recovered via the Open Recovered Files submenu. This menu is only visible when there exist documents with unsaved changes.Simply click on a recovered file to begin editing it. Once saved, the recovered file will disappear from the Open Recovered Files submenu.
You can also clear the recovered files list at any time by clicking Delete Recovered Files under the Open Recovered Files submenu.
Implementation Notes
The original plan involved leveraging the File System Access API. Unfortunately, the
FileSystemWritableFileStream
construct, required to write changes back to the file system, is still not fully supported by all 5 of the major internet browsers. In order to achieve the greatest level of compatibility,localStorage
was chosen instead.⚠ IMPORTANT:
Accessing the application from a webserver will not present issues for autosave. The same cannot be said when opening the application locally via the compiled
index.html
file. In this case, the behavior oflocalStorage
varies from browser to browser.Per Mozilla: