mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: Dedupe boundElement ids when container duplicated with alt+drag (#5938)
* Dedupe boundElement ids when container duplicated with alt+drag and add spec * set to null by default
This commit is contained in:
parent
66bbfda460
commit
a86224c797
3 changed files with 41 additions and 1 deletions
|
@ -370,6 +370,10 @@ export const deepCopyElement = (val: any, depth: number = 0) => {
|
|||
if (depth === 0 && (key === "shape" || key === "canvas")) {
|
||||
continue;
|
||||
}
|
||||
if (key === "boundElements") {
|
||||
tmp[key] = null;
|
||||
continue;
|
||||
}
|
||||
tmp[key] = deepCopyElement(val[key], depth + 1);
|
||||
}
|
||||
}
|
||||
|
@ -409,6 +413,7 @@ export const duplicateElement = <TElement extends Mutable<ExcalidrawElement>>(
|
|||
overrides?: Partial<TElement>,
|
||||
): TElement => {
|
||||
let copy: TElement = deepCopyElement(element);
|
||||
|
||||
if (isTestEnv()) {
|
||||
copy.id = `${copy.id}_copy`;
|
||||
// `window.h` may not be defined in some unit tests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue