diff --git a/src/Editor/Ghost.Editor/View/Controls/Docking/DockContainer.cs b/src/Editor/Ghost.Editor/View/Controls/Docking/DockContainer.cs index cbaffca..20cb5cb 100644 --- a/src/Editor/Ghost.Editor/View/Controls/Docking/DockContainer.cs +++ b/src/Editor/Ghost.Editor/View/Controls/Docking/DockContainer.cs @@ -40,6 +40,7 @@ public abstract class DockContainer : DockModule /// /// /// This method does not support reordering existing children within the same container. + /// Cross-layout moves are intentionally allowed and supported (e.g., for dragging tabs between floating windows and the main window). /// /// The zero-based index at which the module should be inserted. /// The module to insert. @@ -90,6 +91,9 @@ public abstract class DockContainer : DockModule /// /// Replaces an existing child module with a new one. /// + /// + /// Cross-layout moves are intentionally allowed and supported (e.g., for dragging tabs between floating windows and the main window). + /// /// The child module to be replaced. /// The new child module to insert. public virtual void ReplaceChild(DockModule oldChild, DockModule newChild) @@ -110,7 +114,8 @@ public abstract class DockContainer : DockModule { throw new ArgumentException("newChild is already in this container", nameof(newChild)); } - + + var oldOwner = newChild.Owner; newChild.Owner?.RemoveChildInternal(newChild, false); // Remove oldChild without triggering cleanup @@ -131,6 +136,7 @@ public abstract class DockContainer : DockModule } CheckCleanup(); + oldOwner?.CheckCleanup(); } ///