fix(editor): update element.frameId on frame change (#11490)

Co-authored-by: Diego Mateos <dimateos@ucm.es>
This commit is contained in:
David Luzar
2026-06-13 22:39:04 +02:00
committed by GitHub
parent b324a85ab1
commit 069982606d
2 changed files with 28 additions and 4 deletions
-4
View File
@@ -569,10 +569,6 @@ export const addElementsToFrame = <T extends ElementsMapOrArray>(
continue;
}
if (element.frameId && element.frameId !== frame.id) {
continue;
}
finalElementsToAdd.add(element);
const boundTextElement = getBoundTextElement(element, elementsMap);
+28
View File
@@ -692,6 +692,34 @@ describe("adding elements to frames", () => {
expect(rect2.frameId).toBe(frame.id);
});
it("should move an element dragged from one frame into another", () => {
const otherFrame = API.createElement({
id: "otherFrame",
type: "frame",
x: 300,
y: 0,
width: 150,
height: 150,
});
const frameChild = API.createElement({
id: "frameChild",
type: "rectangle",
x: 50,
y: 50,
width: 20,
height: 20,
frameId: frame.id,
});
API.setElements([frame, frameChild, otherFrame]);
expect(frameChild.frameId).toBe(frame.id);
dragElementIntoFrame(otherFrame, frameChild);
expect(frameChild.frameId).toBe(otherFrame.id);
});
it("should layer a dragged element above the highest frame child", () => {
const frameChild = API.createElement({
id: "frameChild",