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];