mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: add pasted elements to frame under cursor (#7590)
This commit is contained in:
parent
46da032626
commit
1e7df58b5b
4 changed files with 56 additions and 2 deletions
|
@ -398,12 +398,28 @@ export const addElementsToFrame = (
|
|||
|
||||
const finalElementsToAdd: ExcalidrawElement[] = [];
|
||||
|
||||
const otherFrames = new Set<ExcalidrawFrameLikeElement["id"]>();
|
||||
|
||||
for (const element of elementsToAdd) {
|
||||
if (isFrameLikeElement(element) && element.id !== frame.id) {
|
||||
otherFrames.add(element.id);
|
||||
}
|
||||
}
|
||||
|
||||
// - add bound text elements if not already in the array
|
||||
// - filter out elements that are already in the frame
|
||||
for (const element of omitGroupsContainingFrameLikes(
|
||||
allElements,
|
||||
elementsToAdd,
|
||||
)) {
|
||||
// don't add frames or their children
|
||||
if (
|
||||
isFrameLikeElement(element) ||
|
||||
(element.frameId && otherFrames.has(element.frameId))
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!currTargetFrameChildrenMap.has(element.id)) {
|
||||
finalElementsToAdd.push(element);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue