fix: bind text to correct container when nested (#5307)
* fix: bind text to correct container when nested * fix tests
This commit is contained in:
parent
ddf088e428
commit
ec35d5db51
@ -2224,12 +2224,13 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
existingTextElement = selectedElements[0];
|
existingTextElement = selectedElements[0];
|
||||||
} else if (isTextBindableContainer(selectedElements[0], false)) {
|
} else if (isTextBindableContainer(selectedElements[0], false)) {
|
||||||
existingTextElement = getBoundTextElement(selectedElements[0]);
|
existingTextElement = getBoundTextElement(selectedElements[0]);
|
||||||
|
} else {
|
||||||
|
existingTextElement = this.getTextElementAtPosition(sceneX, sceneY);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
existingTextElement = this.getTextElementAtPosition(sceneX, sceneY);
|
||||||
}
|
}
|
||||||
|
|
||||||
existingTextElement =
|
|
||||||
existingTextElement ?? this.getTextElementAtPosition(sceneX, sceneY);
|
|
||||||
|
|
||||||
// bind to container when shouldBind is true or
|
// bind to container when shouldBind is true or
|
||||||
// clicked on center of container
|
// clicked on center of container
|
||||||
if (
|
if (
|
||||||
|
@ -115,6 +115,9 @@ describe("textWysiwyg", () => {
|
|||||||
height: textSize,
|
height: textSize,
|
||||||
containerId: container.id,
|
containerId: container.id,
|
||||||
});
|
});
|
||||||
|
mutateElement(container, {
|
||||||
|
boundElements: [{ type: "text", id: text.id }],
|
||||||
|
});
|
||||||
|
|
||||||
h.elements = [container, text];
|
h.elements = [container, text];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user