changed ContainerBehavior into an object {textFlow: "growing"|"fixed", margin: number}

This commit is contained in:
zsviczian
2025-09-22 17:14:16 +00:00
parent f90bf59ecd
commit f3a60a5ef6
10 changed files with 62 additions and 26 deletions

View File

@@ -10,6 +10,7 @@ import {
getFontString,
getUpdatedTimestamp,
getLineHeight,
BOUND_TEXT_PADDING,
} from "@excalidraw/common";
import type { Radians } from "@excalidraw/math";
@@ -169,7 +170,10 @@ export const newElement = (
opts.type as ExcalidrawFlowchartNodeElement["type"],
opts,
),
containerBehavior: opts.containerBehavior ?? "growing",
containerBehavior: {
textFlow: opts.containerBehavior?.textFlow ?? "growing",
margin: opts.containerBehavior?.margin ?? BOUND_TEXT_PADDING,
},
} as NonDeleted<ExcalidrawFlowchartNodeElement>;
}
return _newElementBase<ExcalidrawGenericElement>(

View File

@@ -27,7 +27,10 @@ export type StrokeRoundness = "round" | "sharp";
export type RoundnessType = ValueOf<typeof ROUNDNESS>;
export type StrokeStyle = "solid" | "dashed" | "dotted";
export type TextAlign = typeof TEXT_ALIGN[keyof typeof TEXT_ALIGN];
export type ContainerBehavior = "growing" | "stickyNote";
export type ContainerBehavior = {
textFlow: "growing" | "fixed";
margin?: number;
};
type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
export type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
@@ -88,7 +91,7 @@ export type ExcalidrawSelectionElement = _ExcalidrawElementBase & {
};
type _ExcalidrawStickyNoteContainer = _ExcalidrawElementBase & {
containerBehavior: "stickyNote";
containerBehavior: ContainerBehavior;
};
export type ExcalidrawRectangleElement = _ExcalidrawStickyNoteContainer & {