Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Merge PR #6414: Web: a requested download no longer marks the document saved (#4962)

aiongge452f6ad806a
diff --cc crates/ui-egui/src/lib.rs
index e6685b9b7,4802fbe91..47e107102
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@@ -463,9 -453,10 +470,13 @@@ pub struct Services
pub file_dialog: Option<FileDialogFn>,
/// Write bytes to a path (native) or trigger a download (web).
pub write: Option<WriteFn>,
+ /// Size and modification time of a file (native); `None` on the web, where Save never
+ /// writes back to a file.
+ pub file_stamp: Option<FileStampFn>,
+ /// `write` only asks for the bytes to be kept (a browser download, which the user can
+ /// cancel and which reports nothing back), so a save through it names the document but
+ /// leaves its changes unsaved and the leave-page guard armed (#4962).
+ pub write_unconfirmed: bool,
/// Encode and write in one step on a worker thread, so a large save doesn't freeze the
/// window (#2017). With background jobs on, saves use it instead of `export` and `write`.
pub save_file: Option<SaveFileFn>,