DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Window > Paragraph Styles opens the floating Character Styles | Paragraph Styles group
moppeeer4e7c49b36b90
diff --git a/ROADMAP.md b/ROADMAP.mdindex d60a6bf49..45bd66719 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -347,6 +347,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.mNewest first.+- **2026-10-15** · Window › Styles › Paragraph Styles (or Character Styles) opens InDesign's floating Character Styles | Paragraph Styles group, which stays open while other panels open; it was a flyout that the next panel replaced. No readiness percentage change.- **2026-10-14** · The Type tool draws a new text frame over a locked empty frame, as InDesign does, instead of turning the locked frame into a text frame. No readiness percentage change.- **2026-10-14** · 100% black shows as pure black on screen by default, as InDesign's Appearance of Black does out of the box (Display All Blacks as Rich Black); Preferences › Appearance of Black › Display All Blacks Accurately still shows it as the dark grey it prints, and a saved choice is kept. No readiness percentage change.- **2026-10-14** · Pathfinder keeps the frontmost object, as InDesign does: a photo placed over shapes and intersected with them shows through the shapes (it was dropped, and the shapes kept their black fill); Add, Exclude Overlap and Minus Back take the front object's fill too, Subtract still keeps the back one. No readiness percentage change.diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rsindex a35261d59..a5261a158 100644--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@ -3908,8 +3908,10 @@ mod tests {app.run("file.new", json!({})).unwrap();activate(&mut app, "app.characterPanel", &Value::Null);assert_eq!(app.ui.open_panel.as_deref(), Some("character"));+ // Paragraph Styles opens floating, grouped with Character Styles, as in InDesign.activate(&mut app, "app.paragraphStylesPanel", &Value::Null);- assert_eq!(app.ui.open_panel.as_deref(), Some("paragraphStyles"));+ let layout = app.ui.docking.as_ref().unwrap();+ assert!(layout.floating.iter().any(|g| g.panels == ["characterStyles", "paragraphStyles"] && g.active == 1));let story = app.run("frame.create", json!({"rect": [36, 36, 200, 100], "content": "text", "text": "Page "})).unwrap()["story"].clone();app.run("text.select", json!({"story": story, "anchor": 5, "focus": 5})).unwrap();activate(&mut app, "app.insertCurrentPageNumber", &Value::Null);diff --git a/crates/ui-egui/src/panel_docking.rs b/crates/ui-egui/src/panel_docking.rsindex 05fc1150c..040669b9f 100644--- a/crates/ui-egui/src/panel_docking.rs+++ b/crates/ui-egui/src/panel_docking.rs@@ -116,6 +116,11 @@ pub(crate) fn command(app: &mut DesignApp, id: &str, params: &Value) -> Option<Rlet visible = app.ui.docking.as_ref().is_some_and(|layout| layout.contains(&panel));return Some(change(app, if visible { "close" } else { "activate" }, &json!({"panel": panel})));}+ if id == "window.panel"+ && let Some(result) = open_floating_group(app, params)+ {+ return Some(result);+ }if id == "window.panel.layout" {return Some(params@@ -194,6 +199,94 @@ fn apply_action(app: &mut DesignApp, action: Action<String>) -> Result<Value, StOk(json!({"layout": app.ui.docking}))}+/// The panel in front of each tab group in the dock (not the floating groups).+fn front_tabs(layout: &Layout<String>) -> Vec<String> {+ let mut out = Vec::new();+ let mut visit: Vec<&Node<String>> = layout.root.iter().collect();+ while let Some(node) = visit.pop() {+ if out.len() > craft_ui::docking::MAX_PANELS {+ break;+ }+ match node {+ Node::Split { first, second, .. } => {+ visit.push(first);+ visit.push(second);+ }+ Node::Tabs { panels, active } => out.extend(panels.get(*active).cloned()),+ Node::Stack { .. } => {}+ }+ }+ out+}++/// Bring each of `front` back in front of the dock tab group that holds it.+fn restore_front_tabs(layout: &mut Layout<String>, front: &[String]) {+ let mut visit: Vec<&mut Node<String>> = layout.root.iter_mut().collect();+ let mut seen = 0usize;+ while let Some(node) = visit.pop() {+ seen = seen.saturating_add(1);+ if seen > 2 * craft_ui::docking::MAX_PANELS {+ break;+ }+ match node {+ Node::Split { first, second, .. } => {+ visit.push(first);+ visit.push(second);+ }+ Node::Tabs { panels, active } => {+ if let Some(i) = panels.iter().position(|p| front.contains(p)) {+ *active = i;+ }+ }+ Node::Stack { .. } => {}+ }+ }+}++/// Panels InDesign opens together as one floating group from the Window menu, in tab order:+/// Window › Styles › Paragraph Styles (or Character Styles) brings both.+const FLOATING_GROUPS: &[&[&str]] = &[&["characterStyles", "paragraphStyles"]];++/// Window › a panel of a [`FLOATING_GROUPS`] group none of whose panels is showing: the group+/// opens floating over the right of the canvas, with that panel in front. None otherwise (the+/// panel opens as before).+fn open_floating_group(app: &mut DesignApp, params: &Value) -> Option<Result<Value, String>> {+ let panel = params.get("panel").and_then(Value::as_str).and_then(normalize)?;+ let group = FLOATING_GROUPS.iter().find(|g| g.contains(&panel))?;+ // Panels in the workspace's icon groups open from there.+ if app.ui.icon_groups.as_ref().is_some_and(|g| g.iter().flatten().any(|p| group.contains(&p.as_str()))) {+ return None;+ }+ let layout = app.ui.docking.clone().unwrap_or_else(|| legacy(app));+ if group.iter().any(|p| layout.contains(&p.to_string())) {+ return None;+ }+ let (w, h) = (290.0, 340.0);+ let (x, y) = app.canvas_rect.map_or((400.0, 140.0), |r| ((r.right() - w - 24.0).max(r.left()), r.top() + 96.0));+ let before = (app.ui.docking.clone(), app.ui.docking_hidden.clone(), app.ui.floating.clone(), app.ui.open_panel.clone());+ // The dock's tab in front stays in front (opening a panel passes through the dock).+ let front = front_tabs(&layout);+ let open = |app: &mut DesignApp| -> Result<Value, String> {+ let first = group.first().ok_or("empty panel group")?;+ change(app, "float", &json!({"panel": first, "x": x, "y": y, "width": w, "height": h}))?;+ for p in group.get(1..).unwrap_or_default() {+ change(app, "move", &json!({"panel": p, "anchor": first}))?;+ }+ change(app, "activate", &json!({"panel": panel}))+ };+ let result = open(app);+ if result.is_ok()+ && let Some(layout) = app.ui.docking.as_mut()+ {+ restore_front_tabs(layout, &front);+ }+ if result.is_err() {+ // All or nothing.+ (app.ui.docking, app.ui.docking_hidden, app.ui.floating, app.ui.open_panel) = before;+ }+ Some(result)+}+fn change(app: &mut DesignApp, operation: &str, params: &Value) -> Result<Value, String> {let panel = params.get("panel").and_then(Value::as_str).and_then(normalize).ok_or("panel must name a registered panel")?;if app.ui.docking.as_ref().is_some_and(|layout| !valid(layout)) {diff --git a/crates/ui-egui/src/panel_docking_tests.rs b/crates/ui-egui/src/panel_docking_tests.rsindex fa1b3a8fa..3666345f3 100644--- a/crates/ui-egui/src/panel_docking_tests.rs+++ b/crates/ui-egui/src/panel_docking_tests.rs@@ -650,3 +650,28 @@ fn legacy_dock_menu_button_opens_the_active_panel_menu() {assert_eq!(h.state().session.active().unwrap().doc.page_count(), pages + 1);assert!(!egui::Popup::is_any_open(&h.ctx));}++/// Window › Styles › Paragraph Styles opens InDesign's floating Character Styles | Paragraph Styles+/// group, which stays open while other panels open (Learn Skills Daily's InDesign course, 7:55).+#[test]+fn paragraph_styles_open_floating_with_character_styles() {+ let mut app = app();+ app.run("window.panel", json!({"panel":"paragraphStyles"})).unwrap();+ let layout = app.ui.docking.clone().unwrap();+ let group = layout.floating.iter().find(|g| g.panels.iter().any(|p| p == "paragraphStyles")).expect("a floating group");+ assert_eq!(group.panels, ["characterStyles", "paragraphStyles"]);+ assert_eq!(group.panels[group.active], "paragraphStyles", "the one chosen is in front");+ // The dock still shows Properties in front.+ assert!(matches!(&layout.root, Some(craft_ui::docking::Node::Tabs { panels, active }) if panels[*active] == "properties"), "{:?}", layout.root);+ // Other panels from Window leave it open.+ app.run("window.panel", json!({"panel":"color"})).unwrap();+ app.run("window.panel", json!({"panel":"links"})).unwrap();+ let layout = app.ui.docking.clone().unwrap();+ assert!(layout.floating.iter().any(|g| g.panels == ["characterStyles", "paragraphStyles"]));+ // Once showing, Window › Character Styles brings that tab forward.+ app.run("window.panel", json!({"panel":"characterStyles"})).unwrap();+ let layout = app.ui.docking.clone().unwrap();+ let group = layout.floating.iter().find(|g| g.panels.iter().any(|p| p == "characterStyles")).unwrap();+ assert_eq!(group.panels[group.active], "characterStyles");+ assert_eq!(layout.panels().iter().filter(|p| p.as_str() == "characterStyles").count(), 1);+}