Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

fix: prevent wrap text in a container to only text that are not bound to a container (#10250)

Christopher Tangonan8d8f69662877
diff --git a/packages/excalidraw/actions/actionBoundText.tsx b/packages/excalidraw/actions/actionBoundText.tsx
index 606770dde5..383668c756 100644
--- a/packages/excalidraw/actions/actionBoundText.tsx
+++ b/packages/excalidraw/actions/actionBoundText.tsx
@@ -8,6 +8,7 @@ import {
} from "@excalidraw/common";
import {
getOriginalContainerHeightFromCache,
+ isBoundToContainer,
resetOriginalContainerCache,
updateOriginalContainerCache,
} from "@excalidraw/element";
@@ -225,7 +226,9 @@ export const actionWrapTextInContainer = register({
trackEvent: { category: "element" },
predicate: (elements, appState, _, app) => {
const selectedElements = app.scene.getSelectedElements(appState);
- const someTextElements = selectedElements.some((el) => isTextElement(el));
+ const someTextElements = selectedElements.some(
+ (el) => isTextElement(el) && !isBoundToContainer(el),
+ );
return selectedElements.length > 0 && someTextElements;
},
perform: (elements, appState, _, app) => {
@@ -234,7 +237,7 @@ export const actionWrapTextInContainer = register({
const containerIds: Mutable<AppState["selectedElementIds"]> = {};
for (const textElement of selectedElements) {
- if (isTextElement(textElement)) {
+ if (isTextElement(textElement) && !isBoundToContainer(textElement)) {
const container = newElement({
type: "rectangle",
backgroundColor: appState.currentItemBackgroundColor,