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

+5
View File
@@ -63,6 +63,11 @@ impl CadModule for BlockEditorModule {
"Close Block Editor",
include_bytes!("../../../assets/icons/mt_cancel.svg"),
),
command(
"BTESTBLOCK",
"Test Block",
include_bytes!("../../../assets/icons/edit_block.svg"),
),
],
},
RibbonGroup {
+10 -1
View File
@@ -15,7 +15,7 @@ mod report;
pub mod select;
pub mod units;
use crate::modules::{CadModule, RibbonGroup, RibbonItem};
use crate::modules::{CadModule, IconKind, ModuleEvent, RibbonGroup, RibbonItem, ToolDef};
pub struct DrawModule;
@@ -249,6 +249,15 @@ impl CadModule for DrawModule {
default: "DIST",
}],
},
RibbonGroup {
title: "Close",
tools: vec![RibbonItem::LargeTool(ToolDef {
id: "BCLOSETESTBLOCK",
label: "Close Test Block",
icon: IconKind::Svg(include_bytes!("../../../assets/icons/mt_ok.svg")),
event: ModuleEvent::Command("BCLOSETESTBLOCK".into()),
})],
},
// Support group lives on the Start tab now (see view.rs:
// start_page_view). Removed from the Draw ribbon to declutter.
]
+3
View File
@@ -119,3 +119,6 @@ inventory::submit!(crate::command::CommandRegistration {
inventory::submit!(crate::command::CommandRegistration {
names: &["BSAVE", "BSAVEAS", "BCLOSE"]
});
inventory::submit!(crate::command::CommandRegistration {
names: &["BTESTBLOCK", "BCLOSETESTBLOCK"]
});