DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Table menu in InDesign's order; Insert Table dialog laid out as InDesign's
moppeeer10cd0cac3c22
diff --git a/ROADMAP.md b/ROADMAP.mdindex d3ef17e47..03691beec 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -349,6 +349,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.mNewest first.- **2026-10-16** · Edit › Keyboard Shortcuts imports a set saved by InDesign's Show Set (.txt, Windows or Mac key names, UTF-8 or UTF-16): matched commands take its Default shortcuts or lose theirs, other commands give up keys it takes, and a report lists what it changed and the items it could not match (`window.importShortcuts`, #1180). Tool keys stay fixed. No readiness percentage change.+- **2026-10-23** · Tables: the Table menu follows InDesign's order (Cell Options before Insert, Delete and Select; Merge, Unmerge and Split before Convert Cell Type and Convert Rows; Distribute Rows Evenly before Distribute Columns Evenly), and its first item is Insert Table… with InDesign's Cmd+Alt+Shift+T, which opens the dialog (the shortcut ran `table.insert` with its defaults, behind the dialog). The Table panel stays in Window › Type & Tables (Shift+F9). The Insert Table dialog is laid out as InDesign's: Body Rows and Columns, then Header and Footer Rows, as numbers with spinners and right-aligned labels, and a Table Style applied to the new table. No readiness percentage change.- **2026-10-22** · A ruler guide dragged with the Selection tools, out of a ruler, on its own or with other selected guides, snaps along its axis as objects do (#1221): to other ruler guides, margins, columns, bleed, page and object edges and centers (with the smart-guide mark) and the document grid, within the snap zone and following Snap to Guides and Smart Guides. Shift snaps to the ruler's ticks and Cmd suspends snapping. The preview line, the position readout and the drop use the same snapped position. No readiness percentage change.- **2026-10-22** · macOS: the app menu has a Language submenu after Settings… with each interface language in its own name and the current one checked, as in the suite's other apps; Preferences › General › Interface Language stays. No readiness percentage change.- **2026-10-22** · macOS menu bar: the menus keep working after the interface language or Show CJK Features changes (a rebuilt menu bar lost every click, Quit included), and its key equivalents are the shortcuts in effect, so a shortcut moved in the Keyboard Shortcuts editor leaves its old menu item. No readiness percentage change.diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rsindex 7049c2f39..09f433723 100644--- a/crates/engine/src/cmd/table.rs+++ b/crates/engine/src/cmd/table.rs@@ -88,7 +88,8 @@ fn table_specs() -> Vec<CommandSpec> {"table.insert","Create Table",[],- Some("Cmd+Alt+Shift+T"),+ // InDesign's Cmd+Alt+Shift+T opens the Insert Table dialog (`app.insertTableDialog`).+ None,"{rows?: body rows (4), cols? | columns? (4), headerRows? (0), footerRows? (0), width?} — at the text insertion point",has_text,insertdiff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rsindex 40787954f..de490a157 100644--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@ -137,6 +137,49 @@ fn text_field(ui: &mut egui::Ui, d: &mut Dialog, key: &str, w: f32) {}}+/// Table › Insert Table, laid out as InDesign's: Table Dimensions (body rows and columns, then+/// header and footer rows, each a number with a spinner, labels on the right edge of their+/// column) and the Table Style to apply.+fn insert_table_dialog(app: &DesignApp, ui: &mut egui::Ui, d: &mut Dialog) {+ let lang = &app.ui.language;+ crate::rtl::label(ui, egui::RichText::new(crate::i18n::tr(lang, "Table Dimensions")).font(semibold(12.0)));+ let rows = [+ ("bodyRows", crate::i18n::tr(lang, "Body Rows"), 1.0),+ ("columns", crate::i18n::tr_context(lang, "Columns", "table"), 1.0),+ ("headerRows", crate::i18n::tr(lang, "Header Rows"), 0.0),+ ("footerRows", crate::i18n::tr(lang, "Footer Rows"), 0.0),+ ];+ // Body rows and columns, then (after a gap) header and footer rows; one label width for both.+ for (g, pair) in rows.chunks(2).enumerate() {+ if g > 0 {+ ui.add_space(8.0);+ }+ egui::Grid::new(("ins_table", g)).num_columns(2).min_col_width(100.0).spacing([8.0, 6.0]).show(ui, |ui| {+ for (key, label, min) in pair {+ ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| crate::rtl::label(ui, format!("{label}:")));+ let field = crate::widgets::NumField::number(key, d.n(key), "", 0).width(70.0).range(*min, 10_000.0).spinner();+ if let Some(v) = field.show(ui) {+ d.fields.insert((*key).into(), json!(v.round()));+ }+ ui.end_row();+ }+ });+ }+ ui.add_space(8.0);+ let names: Vec<String> = app.session.active().map(|st| st.doc.styles.table.iter().map(|s| s.name.clone()).collect()).unwrap_or_default();+ let cur = Some(d.s("tableStyle")).filter(|s| !s.is_empty()).unwrap_or_else(|| designcraft_doc::BASIC_TABLE.to_string());+ ui.horizontal(|ui| {+ crate::rtl::label(ui, format!("{}:", crate::i18n::tr(lang, "Table Style")));+ egui::ComboBox::from_id_salt("ins_table_style").selected_text(&cur).width(160.0).show_ui(ui, |ui| {+ for n in &names {+ if ui.selectable_label(*n == cur, n).clicked() {+ d.fields.insert("tableStyle".into(), json!(n));+ }+ }+ });+ });+}+/// Extract once when opened. Cancel is read-only; confirmation adds exactly these colours.pub(crate) fn open_color_theme(app: &mut DesignApp, params: Value) {match app.run("color.extractTheme", params) {@@ -2044,7 +2087,7 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {"newDocument" => crate::i18n::tr(&app.ui.language, "New Document"),"frameSize" => crate::i18n::tr(&app.ui.language, "Rectangle"),"goToPage" => crate::i18n::tr(&app.ui.language, "Go to Page"),- "insertTable" => crate::i18n::tr(&app.ui.language, "Create Table"),+ "insertTable" => crate::i18n::tr(&app.ui.language, "Insert Table…").trim_end_matches('…').trim_end(),"cellOptions" => crate::i18n::tr(&app.ui.language, "Cell Options"),"createGuides" => crate::i18n::tr(&app.ui.language, "Create Guides"),"marginsAndColumns" => crate::i18n::tr(&app.ui.language, "Margins and Columns"),@@ -2107,7 +2150,7 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {let available = (ctx.content_rect().size() - frame_margin - egui::vec2(16.0, 16.0)).max(egui::Vec2::splat(1.0));let preferred_width: f32 = match d.id.as_str() {"alert" => 440.0,- "closeDocument" | "updateLink" | "deletePages" | "newWorkspace" | "pagesPanelOptions" => 380.0,+ "closeDocument" | "updateLink" | "deletePages" | "newWorkspace" | "pagesPanelOptions" | "insertTable" => 380.0,"newDocument" => 960.0,"numberingSection" => 560.0,crate::effects_dialog::ID => 720.0,@@ -2773,21 +2816,7 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {});}"ruby" => style_cjk::ruby_dialog(app, ui, &mut d),- "insertTable" => {- crate::rtl::label(ui, egui::RichText::new(crate::i18n::tr(&app.ui.language, "Table Dimensions")).font(semibold(12.0)));- egui::Grid::new("ins_table").num_columns(4).spacing([8.0, 6.0]).show(ui, |ui| {- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Body Rows"));- text_field(ui, &mut d, "bodyRows", 60.0);- crate::rtl::label(ui, crate::i18n::tr_context(&app.ui.language, "Columns", "table"));- text_field(ui, &mut d, "columns", 60.0);- ui.end_row();- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Header Rows"));- text_field(ui, &mut d, "headerRows", 60.0);- crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Footer Rows"));- text_field(ui, &mut d, "footerRows", 60.0);- ui.end_row();- });- }+ "insertTable" => insert_table_dialog(app, ui, &mut d),"cellOptions" => cell_options(app, ui, &mut d),"createGuides" => create_guides_dialog(app, ui, &mut d),"marginsAndColumns" => margins_and_columns_dialog(app, ui, &mut d),@@ -3099,11 +3128,20 @@ pub fn confirm(app: &mut DesignApp) -> Result<Value, String> {None => Err(format!("no page \"{typed}\"")),}}- "insertTable" => app.run(- "table.insert",- json!({"rows": d.n("bodyRows").unwrap_or(4.0).max(1.0) as u64, "cols": d.n("columns").unwrap_or(4.0).max(1.0) as u64,- "headerRows": d.n("headerRows").unwrap_or(0.0).max(0.0) as u64, "footerRows": d.n("footerRows").unwrap_or(0.0).max(0.0) as u64}),- ),+ "insertTable" => app+ .run(+ "table.insert",+ json!({"rows": d.n("bodyRows").unwrap_or(4.0).max(1.0) as u64, "cols": d.n("columns").unwrap_or(4.0).max(1.0) as u64,+ "headerRows": d.n("headerRows").unwrap_or(0.0).max(0.0) as u64, "footerRows": d.n("footerRows").unwrap_or(0.0).max(0.0) as u64}),+ )+ .and_then(|r| {+ // A table style other than [Basic Table] (which a new table has) is applied after.+ let style = d.s("tableStyle");+ if style.is_empty() || style == designcraft_doc::BASIC_TABLE {+ return Ok(r);+ }+ app.run("style.table.apply", json!({"name": style, "story": r["story"], "table": r["table"]})).map(|_| r)+ }),"numberingSection" => {// On an error the dialog stays open to be corrected.let r = crate::section_options::confirm(app, &d);@@ -9608,6 +9646,27 @@ mod tests {app.session.active().and_then(|st| st.doc.styles.char_style(name).cloned())}+ /// Insert Table: the dimensions as typed, and the Table Style chosen is applied to the new+ /// table; [Basic Table] (the default) leaves it unstyled.+ #[test]+ fn insert_table_applies_its_dimensions_and_table_style() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ app.run("style.table.create", json!({"name": "Grid"})).unwrap();+ for (style, expected) in [("Grid", "Grid"), (designcraft_doc::BASIC_TABLE, "")] {+ app.run("frame.create", json!({"rect": [72, 72, 372, 372], "content": "text"})).unwrap();+ assert_eq!(app.run("app.insertTableDialog", json!({})).unwrap(), Value::Null);+ for (field, value) in [("bodyRows", json!(5)), ("columns", json!(3)), ("headerRows", json!(1)), ("tableStyle", json!(style))] {+ ctl(&mut app, "ui.dialog.set", json!({"field": field, "value": value}));+ }+ assert_eq!(ctl(&mut app, "ui.dialog.confirm", json!({}))["ok"], true);+ let t = app.run("table.get", json!({})).unwrap();+ let len = |k: &str| t[k].as_array().map_or(0, Vec::len);+ assert_eq!((len("rows"), len("columns"), t["headerRows"].as_u64()), (6, 3, Some(1)), "{t}");+ assert_eq!(t["style"].as_str().unwrap_or(""), expected, "{t}");+ }+ }+#[test]fn character_style_options_set_exactly_the_edited_attributes() {let mut app = styled_app();@@ -9782,7 +9841,7 @@ mod tests {assert!((centred.center() - egui::pos2(600.0, 400.0)).length() < 1.0, "{centred:?}");assert!(centred.width() < 1000.0 && centred.height() < 700.0, "the area is the dialog, not the backdrop: {centred:?}");- let title = h.get_by_label("Create Table").rect().center();+ let title = h.get_by_label("Insert Table").rect().center();drag(&mut h, title, title + vec2(100.0, 60.0));let moved = rect(&h);assert!((moved.min - centred.min - vec2(100.0, 60.0)).length() < 2.0, "{centred:?} -> {moved:?}");@@ -9792,7 +9851,7 @@ mod tests {assert_eq!(rect(&h), moved, "a drag in the body leaves the dialog in place");// The title row stays inside the top edge.- let title = h.get_by_label("Create Table").rect().center();+ let title = h.get_by_label("Insert Table").rect().center();drag(&mut h, title, title - vec2(0.0, 1000.0));assert!(rect(&h).top().abs() < 1.0, "{:?}", rect(&h));@@ -9804,7 +9863,7 @@ mod tests {assert!((rect(&h).center() - centred.center()).length() < 1.0, "{:?}", rect(&h));// Past the left edge, about 100 px of the title row stays inside.- let title = h.get_by_label("Create Table").rect().center();+ let title = h.get_by_label("Insert Table").rect().center();drag(&mut h, title, title - vec2(900.0, 0.0));assert!((rect(&h).right() - 100.0).abs() < 2.0, "{:?}", rect(&h));}diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rsindex 87537abd7..f6c8bd02a 100644--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@ -92,7 +92,7 @@ pub const UI_COMMANDS: &[(&str, &str, Option<&str>, &str)] = &["{path | text} — a set saved by InDesign's Show Set (.txt): matched commands take its Default shortcuts (or none), other commands lose keys it takes → {set, imported, changed, conflictsCleared, skipped (an earlier item whose keys a later one took), unmatched, unmatchedWithoutShortcut, unreadable}",),("app.findChange", "Find/Change…", Some("Cmd+F"), "{}"),- ("app.insertTableDialog", "Create Table…", None, "{} — Insert Table dialog (body/header/footer rows, columns)"),+ ("app.insertTableDialog", "Insert Table…", Some("Cmd+Alt+Shift+T"), "{} — Insert Table dialog (body/header/footer rows, columns, table style)"),("app.cellOptionsDialog","Strokes and Fills…",@@ -713,12 +713,17 @@ pub const MENUS: &[(&str, &[&str])] = &[],),(+ // InDesign's order. The Table panel is in Window › Type & Tables (Shift+F9)."Table",&["ui:app.insertTableDialog","cmd:table.convertFromText","cmd:table.convertToText","-",+ ">Cell Options",+ "ui:app.cellOptionsDialog",+ "<",+ "-",">Insert","cmd:table.insertRowAbove","cmd:table.insertRowBelow",@@ -736,11 +741,10 @@ pub const MENUS: &[(&str, &[&str])] = &["cmd:table.selectTable","<","-",- ">Cell Options",- "ui:app.cellOptionsDialog",- "<","cmd:table.merge","cmd:table.unmerge",+ "cmd:table.splitHorizontally",+ "cmd:table.splitVertically",">Convert Cell Type","ui:app.graphicCell|Convert Cell to Graphic Cell…","cmd:table.textCell",@@ -750,12 +754,9 @@ pub const MENUS: &[(&str, &[&str])] = &["cmd:table.convertRowsToBody","cmd:table.convertRowsToFooter","<",- "cmd:table.splitHorizontally",- "cmd:table.splitVertically",- "cmd:table.distributeColumns",- "cmd:table.distributeRows","-",- "ui:app.tablePanel",+ "cmd:table.distributeRows",+ "cmd:table.distributeColumns",],),(@@ -4944,6 +4945,47 @@ mod tests {}}+ #[test]+ fn the_table_menu_follows_indesigns_order() {+ // InDesign's Table menu with a text insertion point (Adobe's "How to make a table").+ let table = menu_tree().into_iter().find(|(m, _)| *m == "Table").unwrap().1;+ let labels: Vec<String> = table+ .iter()+ .map(|i| match i {+ Item::Sep => "-".to_string(),+ Item::Sub(n, _) => format!("{n} >"),+ Item::Cmd { label, .. } => label.clone(),+ })+ .collect();+ let expected = [+ "Insert Table…",+ "Convert Text to Table",+ "Convert Table to Text",+ "-",+ "Cell Options >",+ "-",+ "Insert >",+ "Delete >",+ "Select >",+ "-",+ "Merge Cells",+ "Unmerge Cells",+ "Split Cell Horizontally",+ "Split Cell Vertically",+ "Convert Cell Type >",+ "Convert Rows >",+ "-",+ "Distribute Rows Evenly",+ "Distribute Columns Evenly",+ ];+ assert_eq!(labels, expected);+ // Cmd+Alt+Shift+T opens the dialog, as InDesign's; the engine command has no shortcut of+ // its own. The Table panel is in Window › Type & Tables.+ assert_eq!(ui_label("app.insertTableDialog").and_then(|c| c.1), Some("Cmd+Alt+Shift+T"));+ assert_eq!(designcraft_engine::find_command("table.insert").unwrap().shortcut, None);+ assert_eq!(ui_label("app.tablePanel").and_then(|c| c.1), Some("Shift+F9"));+ }+#[test]fn the_type_menu_follows_indesigns_order() {// InDesign's Type menu, as Chris Nielsen opens it in "Numbering Page Sections" (2:09).diff --git a/docs/target-app-parity.md b/docs/target-app-parity.mdindex bb7c5eb80..77bd6d505 100644--- a/docs/target-app-parity.md+++ b/docs/target-app-parity.md@@ -273,7 +273,7 @@ It is evidence of breadth: each item exists. It is not a claim of InDesign-level- Tools: Selection (click, marquee, move, Alt-duplicate, resize handles), Direct Selection, Type (draw frame, click caret, select, type; Option/Alt+Left/Right kerns at the caret or tracks a selection by the Kerning/Tracking increment, ×5 with Cmd/Ctrl; words move with Cmd+Left/Right on macOS and Ctrl+Left/Right elsewhere), Rectangle/Ellipse/Polygon (+ frame variants), Line, Hand, Zoom.- PDF export (krilla): real selectable text with embedded font subsets, DeviceCMYK/RGB + spot Separations, bleed boxes, crop/bleed marks + page info, pages or spreads, PDF/A-2b (PDF/X-4 output intent pending) — `file.exportPdf`, File › Export PDF…, `designcraft-cli run --export out.pdf`. File › Export PDF… now opens an "Export PDF" options dialog (General / Compression / Marks and Bleeds / Advanced) and remembers the last-used settings across exports and sessions.- IDML interchange (`designcraft-idml`): export and import of swatches, styles, fonts, preferences, parent spreads, spreads/pages, frames, groups, images (embedded or linked), formatted threaded stories; attributes a file leaves unset take InDesign's defaults (Keep Lines Together at start/end of paragraph, 12 pt corners, paragraph rules in Text Color, auto-sizing from the centre, numbered lists restarting in each story, alternating table fills Black 20 % / None; a tint of −1 is the colour's own; frames take the fill, stroke, corners and Text Frame Options they don't write from their object style chain, then [None]) — opens in InDesign 2026 and round-trips InDesign-exported files (`file.exportIdml`, `file.openIdml`, File → Export IDML…, CLI `--in x.idml` / `--export x.idml`).-- Tables (M8): tables anchored in stories (header/footer/body rows, merged cells, per-edge strokes, fills + alternating fills, insets, vertical justification, at-least/exact row heights); composed into the text column (columns scale to fit, rows break across columns/frames with repeating headers/footers, overset); rendered, exported to PDF (real text) and IDML (export + import); Table menu, Table panel, Create Table dialog, caret/typing/Tab navigation and cell selection in cells; Type tool drags of row and column borders (Shift keeps the table size, or scales every row/column on the outer edge; `table.resizeBorder`); `table.*` commands.+- Tables (M8): tables anchored in stories (header/footer/body rows, merged cells, per-edge strokes, fills + alternating fills, insets, vertical justification, at-least/exact row heights); composed into the text column (columns scale to fit, rows break across columns/frames with repeating headers/footers, overset); rendered, exported to PDF (real text) and IDML (export + import); Table menu (in InDesign's order), Table panel, Insert Table dialog (with Table Style), caret/typing/Tab navigation and cell selection in cells; Type tool drags of row and column borders (Shift keeps the table size, or scales every row/column on the outer edge; `table.resizeBorder`); `table.*` commands.- Hyperlinks (text or frames → URL / e-mail / page) and bookmarks, exported as PDF link annotations and outline.- EPUB 3 (reflowable) export: stories in reading order, CSS from paragraph/character styles, images, navigation (`file.exportEpub`, CLI `--export x.epub`).- Data Merge (one linked CSV, TSV, text, or Excel file; text, image, QR, and hyperlink placeholders; preview; a new document with one record per page or records tiled on a single page), spell checking (public-domain Moby list + document dictionary, suggestions), Step and Repeat (count or grid, with a previewing dialog), snippets, object styles, Numbering & Section Options.