Remove children replacement

This commit is contained in:
Eric NGUYEN 2023-02-17 09:58:51 +01:00
parent 9aec5ae751
commit 65ca7fa10c

View file

@ -158,16 +158,18 @@ export function ReplaceByContainer(
if (containerToReplace === undefined) { if (containerToReplace === undefined) {
return history; 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; return history;
} }
const historyAdd = AddContainers(containerParent.children.indexOf(containerId), [{ Type: newContainerId }], containerParent.properties.id, configuration, fullHistory, historyCurrentStep);
// Copy des possibles enfants const historyAdd = AddContainers(
if (historyAdd.newContainers[0] === undefined) { containerParent.children.indexOf(containerId),
return history; [{ Type: newContainerId }],
} containerParent.properties.id,
historyAdd.newContainers[0].children = containerToReplace.children; configuration, fullHistory, historyCurrentStep
);
const historyDelete = DeleteContainer(containerId, historyAdd.history, historyCurrentStep + 1); const historyDelete = DeleteContainer(containerId, historyAdd.history, historyCurrentStep + 1);
const currentDelete = historyDelete[historyDelete.length - 1]; const currentDelete = historyDelete[historyDelete.length - 1];