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

+14 -6
View File
@@ -434,6 +434,9 @@ const CODES: &[(&str, &str, &str)] = &[
("block_editor", "Open and Save", "BO"),
("block_editor", "BEDIT", "BE"),
("block_editor", "BSAVE", "BS"),
("block_editor", "BTESTBLOCK", "TB"),
("draw", "Close", "TC"),
("draw", "BCLOSETESTBLOCK", "CT"),
("block_editor", "ATTDEF", "AD"),
("block_editor", "AUTOCONSTRAIN", "AC"),
("block_editor", "CCONSTRAINT", "CI"),
@@ -631,7 +634,7 @@ impl Ribbon {
};
let scope = module.id();
let mut tips = Vec::new();
for group in module.ribbon_groups() {
for group in self.groups_for(index) {
for item in &group.tools {
match item {
RibbonItem::Tool(tool)
@@ -709,11 +712,16 @@ impl Ribbon {
fn item_tips(&self, index: usize, open: &str) -> Vec<Tip> {
let mut items = draw_panel::keytip_items(open);
if items.is_empty() {
let groups = self.modules.get(index).map(|m| m.ribbon_groups()).unwrap_or(&[]);
for item in groups.iter().flat_map(|group| &group.tools) {
if let RibbonItem::Dropdown { id, items: list, .. }
| RibbonItem::LabeledDropdown { id, items: list, .. }
| RibbonItem::LargeDropdown { id, items: list, .. } = item
for item in self.groups_for(index).flat_map(|group| &group.tools) {
if let RibbonItem::Dropdown {
id, items: list, ..
}
| RibbonItem::LabeledDropdown {
id, items: list, ..
}
| RibbonItem::LargeDropdown {
id, items: list, ..
} = item
{
if *id == open {
items = list