From 65ca7fa10cae841f6fb1dab653e4f44c59ff28f1 Mon Sep 17 00:00:00 2001 From: Eric NGUYEN Date: Fri, 17 Feb 2023 09:58:51 +0100 Subject: [PATCH] Remove children replacement --- .../Editor/Actions/ContainerOperations.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Components/Editor/Actions/ContainerOperations.ts b/src/Components/Editor/Actions/ContainerOperations.ts index 3dd1e74..684b443 100644 --- a/src/Components/Editor/Actions/ContainerOperations.ts +++ b/src/Components/Editor/Actions/ContainerOperations.ts @@ -158,16 +158,18 @@ export function ReplaceByContainer( if (containerToReplace === undefined) { return history; } - const containerParent = FindContainerById(current.containers,containerToReplace.properties.parentId); - if (containerParent=== undefined) { + + const containerParent = FindContainerById(current.containers, containerToReplace.properties.parentId); + if (containerParent === undefined) { return history; } - const historyAdd = AddContainers(containerParent.children.indexOf(containerId), [{ Type: newContainerId }], containerParent.properties.id, configuration, fullHistory, historyCurrentStep); - // Copy des possibles enfants - if (historyAdd.newContainers[0] === undefined) { - return history; - } - historyAdd.newContainers[0].children = containerToReplace.children; + + const historyAdd = AddContainers( + containerParent.children.indexOf(containerId), + [{ Type: newContainerId }], + containerParent.properties.id, + configuration, fullHistory, historyCurrentStep + ); const historyDelete = DeleteContainer(containerId, historyAdd.history, historyCurrentStep + 1); const currentDelete = historyDelete[historyDelete.length - 1];