mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: restoring deleted bindings (#6029)
* fix: restoring deleted bindings * add tests * add one more test * merge restore tests files
This commit is contained in:
parent
8ec5f7b982
commit
2595e0de82
2 changed files with 191 additions and 9 deletions
|
@ -273,6 +273,14 @@ const repairContainerElement = (
|
|||
) => {
|
||||
const boundElement = elementsMap.get(binding.id);
|
||||
if (boundElement && !boundIds.has(binding.id)) {
|
||||
boundIds.add(binding.id);
|
||||
|
||||
if (boundElement.isDeleted) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
acc.push(binding);
|
||||
|
||||
if (
|
||||
isTextElement(boundElement) &&
|
||||
// being slightly conservative here, preserving existing containerId
|
||||
|
@ -282,9 +290,6 @@ const repairContainerElement = (
|
|||
(boundElement as Mutable<ExcalidrawTextElement>).containerId =
|
||||
container.id;
|
||||
}
|
||||
|
||||
acc.push(binding);
|
||||
boundIds.add(binding.id);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
|
@ -312,6 +317,10 @@ const repairBoundElement = (
|
|||
return;
|
||||
}
|
||||
|
||||
if (boundElement.isDeleted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
container.boundElements &&
|
||||
!container.boundElements.find((binding) => binding.id === boundElement.id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue