DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Tables: InDesign's Convert Text to Table and Convert Table to Text dialogs
moppeeercbb2a974d150
diff --git a/ROADMAP.md b/ROADMAP.mdindex 03691beec..28e3c17d8 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: Convert Text to Table… and Convert Table to Text… open InDesign's dialogs (they converted at once, with tabs and paragraphs only). Column and Row Separator take Tab, Comma, Paragraph or any characters typed; Number of Columns, available when both separators are the same, fills rows of that many cells (a list of paragraphs into two columns); Convert Text to Table also applies a Table Style. `table.convertFromText` takes `rowSeparator`, `columns` and `tableStyle`, and `table.convertToText` its separators. Convert Text to Table is available only with text selected outside a table. 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.diff --git a/crates/doc/src/table.rs b/crates/doc/src/table.rsindex e96aac4b7..bc9c857aa 100644--- a/crates/doc/src/table.rs+++ b/crates/doc/src/table.rs@@ -1011,14 +1011,19 @@ impl Table {/// Cell texts, rows separated by `\n`, cells by `\t` (Convert Table to Text, search, agents).pub fn plain_text(&self) -> String {+ self.text_with("\t", "\n")+ }++ /// The cells' text, columns separated by `col` and rows by `row` (Convert Table to Text).+ pub fn text_with(&self, col: &str, row: &str) -> String {let mut out = String::new();for r in 0..self.nrows() {if r > 0 {- out.push('\n');+ out.push_str(row);}for c in 0..self.ncols() {if c > 0 {- out.push('\t');+ out.push_str(col);}if let Some(cell) = self.cell(r, c) {out.push_str(&cell.text.text.replace('\n', " "));diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rsindex 09f433723..9b6e551a9 100644--- a/crates/engine/src/cmd/table.rs+++ b/crates/engine/src/cmd/table.rs@@ -99,7 +99,7 @@ fn table_specs() -> Vec<CommandSpec> {"Convert Text to Table",["Table"],None,- "{columnSeparator?: tab|comma, width?: table width (default: the column)} — selected paragraphs become rows",+ "{columnSeparator?: tab|comma|paragraph|text (tab), rowSeparator?: paragraph|tab|comma|text (paragraph), columns?: number of columns when both separators are the same (1), tableStyle?: name, width?: table width (default: the column)} — the selected paragraphs become a table, as InDesign's Convert Text to Table",has_text,convert_from_text),@@ -108,7 +108,7 @@ fn table_specs() -> Vec<CommandSpec> {"Convert Table to Text",["Table"],None,- "{story?, table?, rows?: [a, b] | row?, cols?: [a, b] | col? (the target cells; default: the selection)} — cells separated by tabs, rows by paragraphs",+ "{columnSeparator?: tab|comma|paragraph|text (tab), rowSeparator?: paragraph|tab|comma|text (paragraph), story?, table?, rows?: [a, b] | row?, cols?: [a, b] | col? (the target cells; default: the selection)} — the table becomes its cells' text, as InDesign's Convert Table to Text",in_table,convert_to_text),@@ -594,12 +594,49 @@ fn insert(s: &mut Session, p: &Value) -> Result<Value> {})}+/// A Convert Text to Table / Convert Table to Text separator: `tab`, `comma`, `paragraph` or the+/// separator's own text (InDesign's fields take any characters).+fn separator(p: &Value, key: &str, default: &str, cmd: &str) -> Result<String> {+ let sep = match p.get(key) {+ None | Some(Value::Null) => return Ok(default.to_string()),+ Some(Value::String(s)) => match s.as_str() {+ "tab" => "\t",+ "comma" => ",",+ "paragraph" => "\n",+ other => other,+ },+ Some(_) => "",+ };+ if sep.is_empty() {+ return Err(bad(cmd, format!("`{key}` must be tab, comma, paragraph or the separator's characters")));+ }+ Ok(sep.to_string())+}+fn convert_from_text(s: &mut Session, p: &Value) -> Result<Value> {- let t = s.doc()?.selection.text.ok_or_else(|| bad("table.convertFromText", "no text selected"))?;+ const ID: &str = "table.convertFromText";+ let t = s.doc()?.selection.text.ok_or_else(|| bad(ID, "no text selected"))?;if t.cell.is_some() {- return Err(bad("table.convertFromText", "select text outside tables"));- }- let sep = if str_param(p, "columnSeparator") == Some("comma") { ',' } else { '\t' };+ return Err(bad(ID, "select text outside tables"));+ }+ let (col_sep, row_sep) = (separator(p, "columnSeparator", "\t", ID)?, separator(p, "rowSeparator", "\n", ID)?);+ // With one separator for both, InDesign fills rows of Number of Columns cells.+ let per_row = match p.get("columns") {+ None | Some(Value::Null) => 1,+ Some(v) => {+ v.as_u64().filter(|n| (1..=10_000).contains(n)).ok_or_else(|| bad(ID, "`columns` must be a whole number from 1 to 10000"))? as usize+ }+ };+ let style = match str_param(p, "tableStyle").filter(|n| *n != designcraft_doc::BASIC_TABLE) {+ Some(name) => {+ let styles = &s.doc()?.doc.styles;+ if !styles.table.iter().any(|x| x.name == name) {+ return Err(bad(ID, format!("no table style `{name}`")));+ }+ Some((styles.resolve_table_style(name), styles.cell.clone()))+ }+ None => None,+ };let width = p.get("width").and_then(Value::as_f64).unwrap_or_else(|| column_width(s, &t));s.edit(|d, sel| {let id = d.alloc();@@ -611,11 +648,20 @@ fn convert_from_text(s: &mut Session, p: &Value) -> Result<Value> {return Err(bad("table.convertFromText", "the selection contains a table"));}let (a, b) = (ranges[pa].start, ranges[pb].end);- let data: Vec<Vec<String>> = st.text[a..b].split('\n').map(|line| line.split(sep).map(|c| c.trim().to_string()).collect()).collect();+ let text = &st.text[a..b];+ let data: Vec<Vec<String>> = if col_sep == row_sep {+ let cells: Vec<String> = text.split(col_sep.as_str()).map(|c| c.trim().to_string()).collect();+ cells.chunks(per_row).map(<[String]>::to_vec).collect()+ } else {+ text.split(row_sep.as_str()).map(|row| row.split(col_sep.as_str()).map(|c| c.trim().to_string()).collect()).collect()+ };let pf = st.paras[pa].clone();let cf = st.format_after(a).clone();let mut table = Table::from_strings(id, &data, width, &pf, &cf);table.options.direction = direction;+ if let Some((ts, cells)) = &style {+ ts.apply_to(&mut table, cells);+ }st.delete(a..b);let anchor = st.insert_table(a, table);*sel = Selection::text(TextSel::caret(t.story, anchor));@@ -625,9 +671,11 @@ fn convert_from_text(s: &mut Session, p: &Value) -> Result<Value> {fn convert_to_text(s: &mut Session, p: &Value) -> Result<Value> {let g = target(s, p, "table.convertToText")?;+ let col_sep = separator(p, "columnSeparator", "\t", "table.convertToText")?;+ let row_sep = separator(p, "rowSeparator", "\n", "table.convertToText")?;s.edit(|d, sel| {let st = d.story_mut(g.story).ok_or_else(|| bad("table.convertToText", "no story"))?;- let text = st.tables.get(&g.table).map(|t| t.plain_text()).unwrap_or_default();+ let text = st.tables.get(&g.table).map(|t| t.text_with(&col_sep, &row_sep)).unwrap_or_default();let a = st.table_anchor(g.table).ok_or_else(|| bad("table.convertToText", "no anchor"))?;st.replace(a..a + designcraft_doc::TABLE_ANCHOR.len_utf8(), &text);*sel = Selection::text(TextSel::caret(g.story, a + text.len()));diff --git a/crates/engine/src/tests_table.rs b/crates/engine/src/tests_table.rsindex 59d2f267b..8c5c98e76 100644--- a/crates/engine/src/tests_table.rs+++ b/crates/engine/src/tests_table.rs@@ -444,6 +444,50 @@ fn convert_text_to_table_and_back() {assert_eq!(s.doc().unwrap().doc.story(designcraft_doc::StoryId(sid)).unwrap().text, "Ink\tCoverage\nPlum\t80%\nSunset\t45%\nAfter");}+/// InDesign's Convert Text to Table and Convert Table to Text separators: tab, comma, paragraph or+/// any characters; with one separator for both, rows of Number of Columns cells; a Table Style.+#[test]+fn convert_text_to_table_with_indesigns_separators() {+ let (mut s, sid, _) = session_with_frame();+ let convert = |s: &mut Session, text: &str, p: Value| -> Result<Value> {+ s.execute("story.setText", &json!({"story": sid, "text": format!("{text}\nAfter")})).unwrap();+ s.execute("text.select", &json!({"story": sid, "anchor": 0, "focus": text.len()})).unwrap();+ s.execute("table.convertFromText", &p)+ };+ let cells = |s: &mut Session, r: &Value| -> (usize, Vec<String>) {+ let t = s.execute("table.get", &json!({"table": r["table"]})).unwrap();+ let texts = t["cells"].as_array().unwrap().iter().map(|c| c["text"].as_str().unwrap().to_string()).collect();+ (t["columns"].as_array().unwrap().len(), texts)+ };+ // Comma-separated columns, paragraphs for rows.+ let r = convert(&mut s, "Ink, Coverage\nPlum, 80%", json!({"columnSeparator": "comma"})).unwrap();+ assert_eq!(cells(&mut s, &r), (2, vec!["Ink".into(), "Coverage".into(), "Plum".into(), "80%".into()]));+ check(&s);+ // The lesson's list: one paragraph per cell; with two columns, two cells a row.+ let list = "Name:\nAddress:\nCity:\nState:";+ let r = convert(&mut s, list, json!({"columnSeparator": "paragraph", "rowSeparator": "paragraph", "columns": 2})).unwrap();+ assert_eq!(r["rows"], 2);+ assert_eq!(cells(&mut s, &r).0, 2);+ let r = convert(&mut s, list, json!({"columnSeparator": "tab"})).unwrap();+ assert_eq!((r["rows"].as_u64(), cells(&mut s, &r).0), (Some(4), 1), "a column of paragraphs");+ // Any characters separate: here " | " between columns and ";" between rows.+ let r = convert(&mut s, "a | b;c | d", json!({"columnSeparator": " | ", "rowSeparator": ";"})).unwrap();+ assert_eq!(cells(&mut s, &r), (2, vec!["a".into(), "b".into(), "c".into(), "d".into()]));+ // A table style is applied to the new table.+ s.execute("style.table.create", &json!({"name": "Grid"})).unwrap();+ let r = convert(&mut s, "x\ty", json!({"tableStyle": "Grid"})).unwrap();+ assert_eq!(s.execute("table.get", &json!({"table": r["table"]})).unwrap()["style"], "Grid");+ for bad in [json!({"columnSeparator": ""}), json!({"rowSeparator": 3}), json!({"columns": 0}), json!({"tableStyle": "Missing"})] {+ assert!(convert(&mut s, "p\tq", bad.clone()).is_err(), "{bad}");+ }+ check(&s);+ // Back to text with a comma between columns and a tab between rows.+ let r = convert(&mut s, "Plum\t80%\nSunset\t45%", json!({})).unwrap();+ s.execute("table.convertToText", &json!({"table": r["table"], "columnSeparator": "comma", "rowSeparator": "tab"})).unwrap();+ check(&s);+ assert_eq!(s.doc().unwrap().doc.story(designcraft_doc::StoryId(sid)).unwrap().text, "Plum,80%\tSunset,45%\nAfter");+}+#[test]fn caret_placement_in_cells_and_cell_formatting() {let (mut s, sid, fid) = session_with_frame();diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rsindex de490a157..ee462ea48 100644--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@ -34,6 +34,8 @@ impl Dialog {"goToPage" => json!({"page": "1"}),"qrCode" => json!({"type": "url", "content": "https://", "color": "[Black]"}),"insertTable" => json!({"bodyRows": 4, "columns": 4, "headerRows": 0, "footerRows": 0}),+ "convertTextToTable" => json!({"columnSeparator": "tab", "rowSeparator": "paragraph", "columns": 1}),+ "convertTableToText" => json!({"columnSeparator": "tab", "rowSeparator": "paragraph"}),"insertXref" => json!({"linkTo": "paragraph", "style": "", "target": "", "format": ""}),"findChange" => json!({"find": "", "change": "", "grep": false, "caseSensitive": false, "wholeWord": false, "scope": "document"}),"documentSetup" => json!({}),@@ -137,6 +139,75 @@ fn text_field(ui: &mut egui::Ui, d: &mut Dialog, key: &str, w: f32) {}}+/// Separators the Convert dialogs offer by name; anything else typed in the field is the+/// separator's own characters.+const SEPARATORS: [(&str, &str); 3] = [("tab", "Tab"), ("comma", "Comma"), ("paragraph", "Paragraph")];++/// A separator field, as InDesign's: type any characters, or pick Tab, Comma or Paragraph from+/// its menu. Stored as `tab`/`comma`/`paragraph` or the typed text.+fn separator_field(lang: &str, ui: &mut egui::Ui, d: &mut Dialog, key: &str) {+ let cur = d.s(key);+ let name = |v: &str| SEPARATORS.iter().find(|s| s.0 == v).map(|s| crate::i18n::tr(lang, s.1).to_string());+ let mut shown = name(&cur).unwrap_or_else(|| cur.clone());+ ui.horizontal(|ui| {+ ui.spacing_mut().item_spacing.x = 2.0;+ if ui.add(egui::TextEdit::singleline(&mut shown).id_salt(("sep", key)).desired_width(150.0)).changed() {+ let v = SEPARATORS.iter().find(|s| crate::i18n::tr(lang, s.1) == shown).map_or(shown.clone(), |s| s.0.to_string());+ d.fields.insert(key.into(), json!(v));+ }+ ui.menu_button("▾", |ui| {+ for (v, label) in SEPARATORS {+ if ui.selectable_label(cur == v, crate::i18n::tr(lang, label)).clicked() {+ d.fields.insert(key.into(), json!(v));+ ui.close();+ }+ }+ });+ });+}++/// Table › Convert Text to Table and Convert Table to Text, laid out as InDesign's: Column and+/// Row Separator; converting text to a table also has Number of Columns (only when both+/// separators are the same: the cells then fill rows of that many) and Table Style.+fn convert_table_dialog(app: &DesignApp, ui: &mut egui::Ui, d: &mut Dialog) {+ let lang = &app.ui.language;+ let to_table = d.id == "convertTextToTable";+ let label = |ui: &mut egui::Ui, text: &str, on: bool| {+ ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {+ ui.add_enabled(on, egui::Label::new(crate::rtl::widget(ui, format!("{}:", crate::i18n::tr(lang, text)))));+ });+ };+ egui::Grid::new(("convert_table", to_table)).num_columns(2).min_col_width(120.0).spacing([8.0, 6.0]).show(ui, |ui| {+ label(ui, "Column Separator", true);+ separator_field(lang, ui, d, "columnSeparator");+ ui.end_row();+ label(ui, "Row Separator", true);+ separator_field(lang, ui, d, "rowSeparator");+ ui.end_row();+ if !to_table {+ return;+ }+ let same = d.s("columnSeparator") == d.s("rowSeparator");+ label(ui, "Number of Columns", same);+ let field = crate::widgets::NumField::number("columns", d.n("columns"), "", 0).width(70.0).range(1.0, 10_000.0).spinner().enabled(same);+ if let Some(v) = field.show(ui) {+ d.fields.insert("columns".into(), json!(v.round()));+ }+ ui.end_row();+ label(ui, "Table Style", true);+ 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());+ egui::ComboBox::from_id_salt("convert_table_style").selected_text(&cur).width(170.0).show_ui(ui, |ui| {+ for n in &names {+ if ui.selectable_label(*n == cur, n).clicked() {+ d.fields.insert("tableStyle".into(), json!(n));+ }+ }+ });+ ui.end_row();+ });+}+/// 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.@@ -2088,6 +2159,8 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {"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, "Insert Table…").trim_end_matches('…').trim_end(),+ "convertTextToTable" => crate::i18n::tr(&app.ui.language, "Convert Text to Table"),+ "convertTableToText" => crate::i18n::tr(&app.ui.language, "Convert Table to Text"),"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"),@@ -2150,7 +2223,8 @@ 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" | "insertTable" => 380.0,+ "closeDocument" | "updateLink" | "deletePages" | "newWorkspace" | "pagesPanelOptions" | "insertTable" | "convertTableToText" => 380.0,+ "convertTextToTable" => 420.0,"newDocument" => 960.0,"numberingSection" => 560.0,crate::effects_dialog::ID => 720.0,@@ -2817,6 +2891,7 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {}"ruby" => style_cjk::ruby_dialog(app, ui, &mut d),"insertTable" => insert_table_dialog(app, ui, &mut d),+ "convertTextToTable" | "convertTableToText" => convert_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),@@ -3128,6 +3203,18 @@ pub fn confirm(app: &mut DesignApp) -> Result<Value, String> {None => Err(format!("no page \"{typed}\"")),}}+ "convertTextToTable" => {+ let same = d.s("columnSeparator") == d.s("rowSeparator");+ let style = Some(d.s("tableStyle")).filter(|s| !s.is_empty() && s != designcraft_doc::BASIC_TABLE);+ app.run(+ "table.convertFromText",+ json!({"columnSeparator": d.s("columnSeparator"), "rowSeparator": d.s("rowSeparator"),+ "columns": if same { json!(d.n("columns").unwrap_or(1.0).max(1.0) as u64) } else { Value::Null }, "tableStyle": style}),+ )+ }+ "convertTableToText" => {+ app.run("table.convertToText", json!({"columnSeparator": d.s("columnSeparator"), "rowSeparator": d.s("rowSeparator")}))+ }"insertTable" => app.run("table.insert",@@ -9667,6 +9754,38 @@ mod tests {}}+ /// Convert Text to Table: available with text selected (not with a caret alone); its+ /// separators and Number of Columns shape the table. Convert Table to Text takes it back with+ /// the separators chosen there.+ #[test]+ fn convert_dialogs_use_their_separators() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({})).unwrap();+ let text = "Name:\nAddress:\nCity:\nState:";+ let sid = app.run("frame.create", json!({"rect": [72, 72, 372, 372], "content": "text", "text": text})).unwrap()["story"].clone();+ app.run("text.select", json!({"story": sid, "anchor": 0, "focus": 0})).unwrap();+ assert!(!crate::menus::menu_enabled(&app, "app.convertTextToTableDialog"), "a caret alone");+ assert!(!crate::menus::menu_enabled(&app, "app.convertTableToTextDialog"), "no table");+ app.run("text.select", json!({"story": sid, "anchor": 0, "focus": text.len()})).unwrap();+ assert!(crate::menus::menu_enabled(&app, "app.convertTextToTableDialog"));+ app.run("app.convertTextToTableDialog", json!({})).unwrap();+ assert_eq!(app.ui.dialog.as_ref().map(|d| d.id.as_str()), Some("convertTextToTable"));+ for (field, value) in [("columnSeparator", json!("paragraph")), ("rowSeparator", json!("paragraph")), ("columns", json!(2))] {+ 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")), (2, 2), "{t}");+ assert!(crate::menus::menu_enabled(&app, "app.convertTableToTextDialog"));+ app.run("app.convertTableToTextDialog", json!({})).unwrap();+ ctl(&mut app, "ui.dialog.set", json!({"field": "columnSeparator", "value": ", "}));+ assert_eq!(ctl(&mut app, "ui.dialog.confirm", json!({}))["ok"], true);+ let story = app.session.active().unwrap().doc.story(designcraft_doc::StoryId(sid.as_u64().unwrap())).unwrap().text.clone();+ // (The empty paragraph after a table that ends its story stays after the text.)+ assert_eq!(story.trim_end(), "Name:, Address:\nCity:, State:");+ }+#[test]fn character_style_options_set_exactly_the_edited_attributes() {let mut app = styled_app();diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rsindex 6057abc97..8fab7218a 100644--- a/crates/ui-egui/src/i18n.rs+++ b/crates/ui-egui/src/i18n.rs@@ -1000,6 +1000,19 @@ const TABLE: &[(&str, [&str; 5])] = &[],),("Load Styles", ["Formate laden", "Charger les styles", "Cargar estilos", "スタイルを読み込み", "加载样式"]),+ ("Tab", ["Tabulator", "Tabulation", "Tabulación", "タブ", "制表符"]),+ (+ "Convert Text to Table…",+ ["Text in Tabelle umwandeln …", "Convertir le texte en tableau…", "Convertir texto en tabla…", "テキストを表に変換…", "将文本转换为表格…"],+ ),+ (+ "Convert Table to Text…",+ ["Tabelle in Text umwandeln …", "Convertir le tableau en texte…", "Convertir tabla en texto…", "表をテキストに変換…", "将表格转换为文本…"],+ ),+ ("Column Separator", ["Spaltentrennzeichen", "Séparateur de colonnes", "Separador de columnas", "列分解文字", "列分隔符"]),+ ("Row Separator", ["Zeilentrennzeichen", "Séparateur de rangs", "Separador de filas", "行分解文字", "行分隔符"]),+ ("Number of Columns", ["Spaltenanzahl", "Nombre de colonnes", "Número de columnas", "列数", "列数"]),+ ("Comma", ["Komma", "Virgule", "Coma", "カンマ", "逗号"]),("Differs from this document",["Weicht von diesem Dokument ab", "Diffère de ce document", "Difiere de este documento", "このドキュメントと異なります", "与此文档不同"],diff --git a/crates/ui-egui/src/i18n/ar.rs b/crates/ui-egui/src/i18n/ar.rsindex 31f7fb70d..fc4b05688 100644--- a/crates/ui-egui/src/i18n/ar.rs+++ b/crates/ui-egui/src/i18n/ar.rs@@ -30,6 +30,12 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "قص"),("Copy", "نسخ"),("Paste", "لصق"),+ ("Convert Text to Table…", "تحويل النص إلى جدول…"),+ ("Convert Table to Text…", "تحويل الجدول إلى نص…"),+ ("Column Separator", "فاصل الأعمدة"),+ ("Row Separator", "فاصل الصفوف"),+ ("Number of Columns", "عدد الأعمدة"),+ ("Comma", "فاصلة"),("Paste Vector Art", "لصق رسم متجه"),("Baseline Options", "خيارات خط الأساس"),("Fixed Number", "عدد ثابت"),diff --git a/crates/ui-egui/src/i18n/cs.rs b/crates/ui-egui/src/i18n/cs.rsindex 4d41c30dc..f9066bee1 100644--- a/crates/ui-egui/src/i18n/cs.rs+++ b/crates/ui-egui/src/i18n/cs.rs@@ -31,6 +31,12 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "Vyjmout"),("Copy", "Kopírovat"),("Paste", "Vložit"),+ ("Convert Text to Table…", "Převést text na tabulku…"),+ ("Convert Table to Text…", "Převést tabulku na text…"),+ ("Column Separator", "Oddělovač sloupců"),+ ("Row Separator", "Oddělovač řádků"),+ ("Number of Columns", "Počet sloupců"),+ ("Comma", "Čárka"),("Reverse Path", "Obrátit cestu"),("Set Anchor", "Nastavit kotvu"),("Clear", "Vymazat"),diff --git a/crates/ui-egui/src/i18n/de.rs b/crates/ui-egui/src/i18n/de.rsindex 4f4177cbd..0200516a9 100644--- a/crates/ui-egui/src/i18n/de.rs+++ b/crates/ui-egui/src/i18n/de.rs@@ -31,6 +31,12 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "Ausschneiden"),("Copy", "Kopieren"),("Paste", "Einfügen"),+ ("Convert Text to Table…", "Text in Tabelle umwandeln …"),+ ("Convert Table to Text…", "Tabelle in Text umwandeln …"),+ ("Column Separator", "Spaltentrennzeichen"),+ ("Row Separator", "Zeilentrennzeichen"),+ ("Number of Columns", "Spaltenanzahl"),+ ("Comma", "Komma"),("Inches Decimal", "Zoll dezimal"),("Back", "Zurück"),("Warning", "Warnung"),diff --git a/crates/ui-egui/src/i18n/fr.rs b/crates/ui-egui/src/i18n/fr.rsindex 681230d84..b2d9f6dd4 100644--- a/crates/ui-egui/src/i18n/fr.rs+++ b/crates/ui-egui/src/i18n/fr.rs@@ -351,7 +351,6 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Subscript:", "Indice :"),("Superscript:", "Exposant :"),("Swap Text Fill and Stroke", "Permuter le fond et le contour du texte"),- ("Tab", "Tabulation"),("Table of Contents", "Table des matières"),("Table/Convert Cell Type", "Tableau/Convertir le type de cellule"),("Table/Delete", "Tableau/Supprimer"),diff --git a/crates/ui-egui/src/i18n/it.rs b/crates/ui-egui/src/i18n/it.rsindex 755272fe5..8471dbd5a 100644--- a/crates/ui-egui/src/i18n/it.rs+++ b/crates/ui-egui/src/i18n/it.rs@@ -28,6 +28,13 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "Taglia"),("Copy", "Copia"),("Paste", "Incolla"),+ ("Tab", "Tabulazione"),+ ("Convert Text to Table…", "Converti testo in tabella…"),+ ("Convert Table to Text…", "Converti tabella in testo…"),+ ("Column Separator", "Separatore colonna"),+ ("Row Separator", "Separatore riga"),+ ("Number of Columns", "Numero di colonne"),+ ("Comma", "Virgola"),("Paste Vector Art", "Incolla grafica vettoriale"),("Baseline Options", "Opzioni linea di base"),("Fixed Number", "Numero fisso"),diff --git a/crates/ui-egui/src/i18n/ja.rs b/crates/ui-egui/src/i18n/ja.rsindex e23ef15c7..3e8499fa7 100644--- a/crates/ui-egui/src/i18n/ja.rs+++ b/crates/ui-egui/src/i18n/ja.rs@@ -30,6 +30,12 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "カット"),("Copy", "コピー"),("Paste", "ペースト"),+ ("Convert Text to Table…", "テキストを表に変換…"),+ ("Convert Table to Text…", "表をテキストに変換…"),+ ("Column Separator", "列分解文字"),+ ("Row Separator", "行分解文字"),+ ("Number of Columns", "列数"),+ ("Comma", "カンマ"),("Paste Vector Art", "ベクトルアートをペースト"),("Baseline Options", "ベースラインオプション"),("Column Rules", "段落境界線"),diff --git a/crates/ui-egui/src/i18n/ka.rs b/crates/ui-egui/src/i18n/ka.rsindex 0300b62d7..0734bbc3e 100644--- a/crates/ui-egui/src/i18n/ka.rs+++ b/crates/ui-egui/src/i18n/ka.rs@@ -31,6 +31,12 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "ამოჭრა"),("Copy", "კოპირება"),("Paste", "ჩასმა"),+ ("Convert Text to Table…", "ტექსტის ცხრილად გარდაქმნა…"),+ ("Convert Table to Text…", "ცხრილის ტექსტად გარდაქმნა…"),+ ("Column Separator", "სვეტების გამყოფი"),+ ("Row Separator", "სტრიქონების გამყოფი"),+ ("Number of Columns", "სვეტების რაოდენობა"),+ ("Comma", "მძიმე"),("Inches Decimal", "ინჩები (ათობითი)"),("Back", "უკან"),("Warning", "გაფრთხილება"),diff --git a/crates/ui-egui/src/i18n/pl.rs b/crates/ui-egui/src/i18n/pl.rsindex 7d1d12c67..03a6e5aa8 100644--- a/crates/ui-egui/src/i18n/pl.rs+++ b/crates/ui-egui/src/i18n/pl.rs@@ -29,6 +29,12 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "Wytnij"),("Copy", "Kopiuj"),("Paste", "Wklej"),+ ("Convert Text to Table…", "Zamień tekst na tabelę…"),+ ("Convert Table to Text…", "Zamień tabelę na tekst…"),+ ("Column Separator", "Separator kolumn"),+ ("Row Separator", "Separator wierszy"),+ ("Number of Columns", "Liczba kolumn"),+ ("Comma", "Przecinek"),("Clear", "Wyczyść"),("Duplicate", "Powiel"),("Select All", "Zaznacz wszystko"),diff --git a/crates/ui-egui/src/i18n/pt_br.rs b/crates/ui-egui/src/i18n/pt_br.rsindex f552e9a63..1f7159e1c 100644--- a/crates/ui-egui/src/i18n/pt_br.rs+++ b/crates/ui-egui/src/i18n/pt_br.rs@@ -31,6 +31,13 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "Recortar"),("Copy", "Copiar"),("Paste", "Colar"),+ ("Tab", "Tabulação"),+ ("Convert Text to Table…", "Converter texto em tabela…"),+ ("Convert Table to Text…", "Converter tabela em texto…"),+ ("Column Separator", "Separador de coluna"),+ ("Row Separator", "Separador de linha"),+ ("Number of Columns", "Número de colunas"),+ ("Comma", "Vírgula"),("Paste Vector Art", "Colar arte vetorial"),("Baseline Options", "Opções de linha de base"),("Fixed Number", "Número fixo"),diff --git a/crates/ui-egui/src/i18n/ru.rs b/crates/ui-egui/src/i18n/ru.rsindex 3f6ef1be0..a2bb57854 100644--- a/crates/ui-egui/src/i18n/ru.rs+++ b/crates/ui-egui/src/i18n/ru.rs@@ -33,6 +33,12 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "Вырезать"),("Copy", "Копировать"),("Paste", "Вставить"),+ ("Convert Text to Table…", "Преобразовать текст в таблицу…"),+ ("Convert Table to Text…", "Преобразовать таблицу в текст…"),+ ("Column Separator", "Разделитель столбцов"),+ ("Row Separator", "Разделитель строк"),+ ("Number of Columns", "Число столбцов"),+ ("Comma", "Запятая"),("Clear", "Очистить"),("Duplicate", "Дублировать"),("Select All", "Выделить все"),diff --git a/crates/ui-egui/src/i18n/uk.rs b/crates/ui-egui/src/i18n/uk.rsindex 9c7cc855a..2dce9d48b 100644--- a/crates/ui-egui/src/i18n/uk.rs+++ b/crates/ui-egui/src/i18n/uk.rs@@ -29,6 +29,13 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Cut", "Вирізати"),("Copy", "Копіювати"),("Paste", "Вставити"),+ ("Tab", "Табуляція"),+ ("Convert Text to Table…", "Перетворити текст на таблицю…"),+ ("Convert Table to Text…", "Перетворити таблицю на текст…"),+ ("Column Separator", "Роздільник стовпців"),+ ("Row Separator", "Роздільник рядків"),+ ("Number of Columns", "Кількість стовпців"),+ ("Comma", "Кома"),("Paste Vector Art", "Вставити векторну графіку"),("Baseline Options", "Параметри базової лінії"),("Fixed Number", "Фіксована кількість"),diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rsindex f6c8bd02a..d50603c4c 100644--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@ -93,6 +93,13 @@ pub const UI_COMMANDS: &[(&str, &str, Option<&str>, &str)] = &[),("app.findChange", "Find/Change…", Some("Cmd+F"), "{}"),("app.insertTableDialog", "Insert Table…", Some("Cmd+Alt+Shift+T"), "{} — Insert Table dialog (body/header/footer rows, columns, table style)"),+ (+ "app.convertTextToTableDialog",+ "Convert Text to Table…",+ None,+ "{} — Convert Text to Table dialog (column and row separators, number of columns, table style)",+ ),+ ("app.convertTableToTextDialog", "Convert Table to Text…", None, "{} — Convert Table to Text dialog (column and row separators)"),("app.cellOptionsDialog","Strokes and Fills…",@@ -717,8 +724,8 @@ pub const MENUS: &[(&str, &[&str])] = &["Table",&["ui:app.insertTableDialog",- "cmd:table.convertFromText",- "cmd:table.convertToText",+ "ui:app.convertTextToTableDialog",+ "ui:app.convertTableToTextDialog","-",">Cell Options","ui:app.cellOptionsDialog",@@ -1254,6 +1261,20 @@ fn run_ui_inner(app: &mut DesignApp, id: &str, p: &Value) -> Option<Result<Valueapp.ui.dialog = Some(crate::dialogs::Dialog::new("findChange", json!({})));Ok(Value::Null)}+ "app.convertTextToTableDialog" => {+ if !menu_enabled(app, id) {+ return Some(Err("select the text to convert to a table".into()));+ }+ app.ui.dialog = Some(crate::dialogs::Dialog::new("convertTextToTable", p.clone()));+ Ok(Value::Null)+ }+ "app.convertTableToTextDialog" => {+ if !menu_enabled(app, id) {+ return Some(Err("place the insertion point in a table to convert it to text".into()));+ }+ app.ui.dialog = Some(crate::dialogs::Dialog::new("convertTableToText", p.clone()));+ Ok(Value::Null)+ }"app.insertTableDialog" => {if app.session.active().is_none_or(|d| d.selection.text.is_none()) {return Some(Err("place the insertion point in a text frame to create a table".into()));@@ -2465,6 +2486,15 @@ pub fn menu_enabled(app: &DesignApp, id: &str) -> bool {if id == "guide.selectAll" && (!app.ui.guides || app.ui.guides_locked) {return false;}+ // As InDesign's: Convert Text to Table wants selected text outside a table, Convert Table to+ // Text a table.+ if id == "app.convertTextToTableDialog" {+ let selected = app.session.active().and_then(|d| d.selection.text).is_some_and(|t| t.cell.is_none() && !t.is_caret());+ return selected && enabled(app, "table.convertFromText");+ }+ if id == "app.convertTableToTextDialog" {+ return enabled(app, "table.convertToText");+ }if ui_label(id).is_some() {return app.session.active().is_some() || id.starts_with("app.") || id.starts_with("window.") || id.starts_with("help.");}@@ -4959,8 +4989,8 @@ mod tests {.collect();let expected = ["Insert Table…",- "Convert Text to Table",- "Convert Table to Text",+ "Convert Text to Table…",+ "Convert Table to Text…","-","Cell Options >","-",diff --git a/docs/target-app-parity.md b/docs/target-app-parity.mdindex 77bd6d505..e273fe286 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 (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.+- 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), Convert Text to Table and Convert Table to Text dialogs (any separators, Number of Columns, 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.