fix(dock): restore transactional integrity and fix build breaks

This commit is contained in:
2026-03-28 17:12:17 +09:00
parent cda3b292b5
commit 0a0359ec06
5 changed files with 104 additions and 16 deletions

View File

@@ -3,7 +3,6 @@ using System.ComponentModel;
using System.Diagnostics;
using Ghost.Core;
using Ghost.Editor.Core.Controls.Internal.Docking;
using Ghost.Editor.View.Windows;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Data;
@@ -435,13 +434,14 @@ public sealed partial class DockLayout : Control
// Validate that the item actually belongs to this source node before attempting tear-off
if (sourceNode.Items.Contains(args.Item))
{
var result = TabTearOffService.TryTearOffTab(sourceNode.Items, args.Item, sourceNode);
var result = TabTearOffService.TryTearOffTab(sourceNode.Items, args.Item, (tab) =>
{
// Raise event to let the host handle window creation
TabTornOff?.Invoke(this, new TabTornOffEventArgs(tab, sourceNode));
}, sourceNode);
if (result.IsSuccess)
{
// Raise event to let the host handle window creation
TabTornOff?.Invoke(this, new TabTornOffEventArgs(args.Item, sourceNode));
DockMutationEngine.CleanupEmptyNodes(sourceNode);
}
else