feat(block-editor): add Test Block preview

Preview the current unsaved block in a disposable drawing with independent history. Keep normal Draw tools available, append Close Test Block, and return to the original editor without saving. Guard persistence paths and handle refresh and parent-close lifecycle by stable document identity.
This commit is contained in:
Karim Jerbi committed 2026-10-14 14:44:58 +01:00
1 parent 0a29be07f7
commit 9632979d09
22 files changed
+801 -65

No files matched your search

+16 -2
View File
@@ -346,7 +346,17 @@ impl OpenCADStudio {
.tabs
.get(self.active_tab)
.is_some_and(|tab| tab.active_block_edit.is_some());
self.ribbon.set_block_editing(block_editing);
let testing = self
.tabs
.get(self.active_tab)
.is_some_and(|tab| tab.block_test.is_some());
if testing {
self.ribbon.set_block_editing(false);
self.ribbon.set_block_testing(true);
} else {
self.ribbon.set_block_testing(false);
self.ribbon.set_block_editing(block_editing);
}
task
}
@@ -595,7 +605,11 @@ impl OpenCADStudio {
}
}
#[cfg(target_arch = "wasm32")]
crate::sys::set_unsaved_changes_warning(self.tabs.iter().any(|tab| tab.dirty));
crate::sys::set_unsaved_changes_warning(
self.tabs
.iter()
.any(|tab| tab.dirty && tab.block_test.is_none()),
);
if self.tabs[i].active_cmd.is_none() {
self.block_palette.placing = None;
}