diff --git a/crates/ui-egui/src/menus/state.rs b/crates/ui-egui/src/menus/state.rs index edf7e1c6f..00749603e 100644 --- a/crates/ui-egui/src/menus/state.rs +++ b/crates/ui-egui/src/menus/state.rs @@ -169,6 +169,9 @@ pub fn menu_enabled(app: &DesignApp, id: &str) -> bool { if matches!(id, "app.justificationDialog" | "app.hyphenationDialog") { return enabled(app, "type.para"); } + if id == "app.graphicCell" { + return enabled(app, "table.placeGraphic"); + } if id.starts_with("fit.") { return enabled(app, "object.fit"); } diff --git a/crates/ui-egui/src/menus/tests.rs b/crates/ui-egui/src/menus/tests.rs index 3fbd56424..e977c6733 100644 --- a/crates/ui-egui/src/menus/tests.rs +++ b/crates/ui-egui/src/menus/tests.rs @@ -2382,6 +2382,16 @@ fn the_table_menu_follows_indesigns_order() { assert_eq!(ui_label("app.tablePanel").and_then(|c| c.1), Some("Shift+F9")); } +#[test] +fn convert_cell_to_graphic_cell_needs_a_table_target() { + let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default()); + app.run("file.new", json!({})).unwrap(); + app.run("frame.create", json!({"rect": [72, 72, 400, 400], "content": "text", "caret": true})).unwrap(); + assert!(!menu_enabled(&app, "app.graphicCell"), "without a table"); + app.run("table.insert", json!({"rows": 2, "cols": 2})).unwrap(); + assert!(menu_enabled(&app, "app.graphicCell"), "in a table"); +} + #[test] fn the_type_menu_follows_indesigns_order() { // InDesign's Type menu, as Chris Nielsen opens it in "Numbering Page Sections" (2:09).