mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-05 18:19:57 +00:00
Tables: Convert Cell to Graphic Cell… is dimmed without a table target (#2270)
The menu item was enabled whenever a document was open. With no table target it opened the file picker, and placing the image then failed because table.placeGraphic needs a table target. The item now takes the enablement of table.placeGraphic, as Justification… takes that of type.para.
This commit is contained in:
1 parent
e1910529a7
commit
f889d7c47b
2 files changed
+13
No files matched your search
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in new issue
Block a user