Save work periodically to reduce loss from crashes (#1580)

* Add auto saving

* Fix autosave dispatching message but not saving document

* Clamp set_timeout delay

* Auto save all documents instead of only the active

* Add with_editor to simplify code

* Update consts

* Simplify some more

* Fix typo

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Comeza
2024-02-20 03:23:25 +00:00
committed by GitHub
co-authored by Keavon Chambers
parent f265fa693e
commit dc7de4d973
5 changed files with 110 additions and 46 deletions
+1
View File
@@ -76,3 +76,4 @@ pub const DEFAULT_FONT_STYLE: &str = "Normal (400)";
pub const DEFAULT_DOCUMENT_NAME: &str = "Untitled Document";
pub const FILE_SAVE_SUFFIX: &str = ".graphite";
pub const MAX_UNDO_HISTORY_LEN: usize = 100; // TODO: Add this to user preferences
pub const AUTO_SAVE_TIMEOUT_SECONDS: u64 = 15;