diff --git a/packages/excalidraw/components/ConvertElementTypePopup.tsx b/packages/excalidraw/components/ConvertElementTypePopup.tsx index 8e527d549..2b37e2e8c 100644 --- a/packages/excalidraw/components/ConvertElementTypePopup.tsx +++ b/packages/excalidraw/components/ConvertElementTypePopup.tsx @@ -366,15 +366,14 @@ export const adjustBoundTextSize = ( container: ExcalidrawTextContainer, boundText: ExcalidrawTextElementWithContainer, scene: Scene, + wrapTextFirst = true, ) => { const maxWidth = getBoundTextMaxWidth(container, boundText); const maxHeight = getBoundTextMaxHeight(container, boundText); - const wrappedText = wrapText( - boundText.text, - getFontString(boundText), - maxWidth, - ); + const wrappedText = wrapTextFirst + ? wrapText(boundText.text, getFontString(boundText), maxWidth) + : boundText.originalText; let metrics = measureText( wrappedText, diff --git a/packages/excalidraw/data/transform.ts b/packages/excalidraw/data/transform.ts index 4c8012e6b..90bc4040b 100644 --- a/packages/excalidraw/data/transform.ts +++ b/packages/excalidraw/data/transform.ts @@ -62,6 +62,7 @@ import type { } from "@excalidraw/element/types"; import type { MarkOptional } from "@excalidraw/common/utility-types"; +import { adjustBoundTextSize } from "../components/ConvertElementTypePopup"; export type ValidLinearElement = { type: "arrow" | "line"; @@ -238,7 +239,7 @@ const bindTextToContainer = ( }), }); - redrawTextBoundingBox(textElement, container, scene); + adjustBoundTextSize(container as any, textElement as any, scene, false); return [container, textElement] as const; };