astro-tractstack 2.2.8 → 2.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2451,8 +2451,14 @@ export class NodesContext {
|
|
|
2451
2451
|
.get()
|
|
2452
2452
|
.get(parentId) as StoryFragmentNode;
|
|
2453
2453
|
if (storyFragment) {
|
|
2454
|
-
|
|
2455
|
-
|
|
2454
|
+
// Use modifyNodes to ensure StoryFragment is marked dirty (isChanged: true)
|
|
2455
|
+
// We disable history recording here because we create a specific REMOVE patch below
|
|
2456
|
+
const updatedFragment = cloneDeep(storyFragment);
|
|
2457
|
+
paneIdx = updatedFragment.paneIds.indexOf(targetNodeId);
|
|
2458
|
+
if (paneIdx !== -1) {
|
|
2459
|
+
updatedFragment.paneIds.splice(paneIdx, 1);
|
|
2460
|
+
this.modifyNodes([updatedFragment], { recordHistory: false });
|
|
2461
|
+
}
|
|
2456
2462
|
}
|
|
2457
2463
|
} else if (targetNode.nodeType === 'TagElement') {
|
|
2458
2464
|
// mark pane as changed
|
|
@@ -2488,16 +2494,35 @@ export class NodesContext {
|
|
|
2488
2494
|
undo: (ctx) => {
|
|
2489
2495
|
ctx.addNodes(toDelete);
|
|
2490
2496
|
if (targetNode.nodeType === 'Pane' && parentId !== null) {
|
|
2491
|
-
const storyFragment =
|
|
2497
|
+
const storyFragment = ctx.allNodes
|
|
2498
|
+
.get()
|
|
2499
|
+
.get(parentId) as StoryFragmentNode;
|
|
2500
|
+
if (storyFragment) {
|
|
2501
|
+
// Use modifyNodes in Undo to correctly restore state and links
|
|
2502
|
+
const updatedFragment = cloneDeep(storyFragment);
|
|
2503
|
+
updatedFragment.paneIds.splice(paneIdx, 0, targetNodeId);
|
|
2504
|
+
ctx.modifyNodes([updatedFragment], { recordHistory: false });
|
|
2505
|
+
ctx.linkChildToParent(targetNodeId, parentId, paneIdx);
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
},
|
|
2509
|
+
redo: (ctx) => {
|
|
2510
|
+
ctx.deleteNodes(toDelete);
|
|
2511
|
+
// Ensure Redo also updates the parent StoryFragment correctly
|
|
2512
|
+
if (targetNode.nodeType === 'Pane' && parentId !== null) {
|
|
2513
|
+
const storyFragment = ctx.allNodes
|
|
2492
2514
|
.get()
|
|
2493
2515
|
.get(parentId) as StoryFragmentNode;
|
|
2494
2516
|
if (storyFragment) {
|
|
2495
|
-
|
|
2496
|
-
|
|
2517
|
+
const updatedFragment = cloneDeep(storyFragment);
|
|
2518
|
+
const idx = updatedFragment.paneIds.indexOf(targetNodeId);
|
|
2519
|
+
if (idx !== -1) {
|
|
2520
|
+
updatedFragment.paneIds.splice(idx, 1);
|
|
2521
|
+
ctx.modifyNodes([updatedFragment], { recordHistory: false });
|
|
2522
|
+
}
|
|
2497
2523
|
}
|
|
2498
2524
|
}
|
|
2499
2525
|
},
|
|
2500
|
-
redo: (ctx) => ctx.deleteNodes(toDelete),
|
|
2501
2526
|
});
|
|
2502
2527
|
}
|
|
2503
2528
|
}
|