mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-29 12:46:53 -06:00
Integration: #1022 style panels closed from the dock reopen in the dock, not floating
This commit is contained in:
@@ -310,6 +310,10 @@ fn open_floating_group(app: &mut DesignApp, params: &Value) -> Option<Result<Val
|
||||
if app.ui.icon_groups.as_ref().is_some_and(|g| g.iter().flatten().any(|p| group.contains(&p.as_str()))) {
|
||||
return None;
|
||||
}
|
||||
// A panel closed from a place in the dock comes back there.
|
||||
if group.iter().any(|p| app.ui.docking_hidden.get(*p).is_some_and(|l| l.floating.is_none())) {
|
||||
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;
|
||||
|
||||
@@ -729,3 +729,20 @@ fn paragraph_styles_open_floating_with_character_styles() {
|
||||
assert_eq!(group.panels[group.active], "characterStyles");
|
||||
assert_eq!(layout.panels().iter().filter(|p| p.as_str() == "characterStyles").count(), 1);
|
||||
}
|
||||
|
||||
/// Style panels the user docked and then closed come back in the dock, not floating.
|
||||
#[test]
|
||||
fn paragraph_styles_closed_from_the_dock_reopen_there() {
|
||||
let mut app = app();
|
||||
app.run("window.panel", json!({"panel":"paragraphStyles"})).unwrap();
|
||||
for panel in ["characterStyles", "paragraphStyles"] {
|
||||
app.run("window.panel.move", json!({"panel": panel, "anchor": "properties"})).unwrap();
|
||||
}
|
||||
for panel in ["characterStyles", "paragraphStyles"] {
|
||||
app.run("window.panel.close", json!({"panel": panel})).unwrap();
|
||||
}
|
||||
app.run("window.panel", json!({"panel":"paragraphStyles"})).unwrap();
|
||||
let layout = app.ui.docking.clone().unwrap();
|
||||
assert!(layout.contains(&"paragraphStyles".to_string()));
|
||||
assert!(layout.floating.iter().all(|g| !g.panels.iter().any(|p| p == "paragraphStyles")), "{:?}", layout.floating);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user