fix for duplicating elements (#261)

This commit is contained in:
David Luzar 2020-01-08 19:54:42 +01:00 committed by GitHub
parent 7f7f51f70b
commit 2122a9cf9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 8 deletions

View file

@ -32,3 +32,10 @@ export function newElement(
};
return element;
}
export function duplicateElement(element: ReturnType<typeof newElement>) {
const copy = { ...element };
copy.id = nanoid();
copy.seed = randomSeed();
return copy;
}