feat(web): return saved drawings to an embedding page

The web control channel gains a save operation that serializes the
active drawing in the requested format and returns it as base64 in the
reply, clearing the dirty flag, the counterpart of opening from bytes.
A host page can also define window.openCadStudioSaveFile(name, bytes)
to receive every saved or exported file in place of a browser
download; while it is set no file picker opens.

Fixes #1704
Fixes #1705

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-13 10:12:07 +03:00
1 parent d1a2e9db64
commit 85627ebc8a
4 files changed
+91 -2

No files matched your search

+3 -1
View File
@@ -3882,8 +3882,10 @@ impl OpenCADStudio {
// handle is secured at this gesture moment (or reused from a
// previous pick — retained handles need no activation to write)
// and only the write happens later.
// A registered host save hook takes the bytes through the
// download path, so no file picker opens.
let route = crate::io::fs_access::save_route(
crate::io::fs_access::supported(),
crate::io::fs_access::supported() && crate::sys::save_hook().is_none(),
self.save_plain_reuse_fs_handle,
crate::io::fs_access::handle_ext(tab_id).as_deref(),
ext,