feat(wasm): web Save/Save As go through the dialog with a direct download

On the web, Save and Save As now open the in-app Save dialog (filename +
format) like the desktop, and the unsaved-changes prompt's Save routes
through it too — instead of an immediate rfd download. Confirm serializes
to bytes and downloads directly via a Blob + hidden `<a download>` click
(a user gesture), so there is no intermediate "click to download" link.

Replaces the rfd-based download_web / WebSaveResult round-trip with a
synchronous sys::download_bytes. Native save is unchanged.

Native + web build; 75 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-17 00:52:20 +03:00
commit fefae274d4
6 changed files with 99 additions and 107 deletions

View file

@ -82,8 +82,17 @@ ureq = { version = "3", default-features = false, features = ["rustls"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
# Opening external URLs (Donate / feedback / release notes) via window.open.
web-sys = { version = "0.3", features = ["Window"] }
wasm-bindgen = "0.2"
js-sys = "0.3"
# window.open (external URLs) + Blob/anchor file downloads (Save).
web-sys = { version = "0.3", features = [
"Window",
"Document",
"Element",
"HtmlAnchorElement",
"Blob",
"Url",
] }
# Browsers without WebGPU (e.g. Firefox by default) need wgpu's WebGL2 backend;
# `webgl` enables it. `fira-sans` embeds the default UI font — the web has no
# system fonts, so without it all iced text (ribbon labels, command line) is