mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Ensure group ids are all duplicated
This commit is contained in:
parent
2d2f7edaa9
commit
dc4bc0329b
1 changed files with 9 additions and 0 deletions
|
@ -129,6 +129,15 @@ export const duplicateElements = (
|
|||
opts?.idsOfElementsToDuplicate ??
|
||||
new Map(elements.map((el) => [el.id, el]));
|
||||
|
||||
// For sanity
|
||||
if (opts?.appState?.selectedGroupIds) {
|
||||
for (const groupId of Object.keys(opts.appState.selectedGroupIds)) {
|
||||
elements
|
||||
.filter((el) => el.groupIds?.includes(groupId))
|
||||
.forEach((el) => _idsOfElementsToDuplicate.set(el.id, el));
|
||||
}
|
||||
}
|
||||
|
||||
elements = normalizeElementOrder(elements);
|
||||
|
||||
const elementsWithClones: ExcalidrawElement[] = elements.slice();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue