mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: allow adding text via enter only for text containers (#5891)
* fix: allow adding text via enter only for text containers * fix * fix * fix * move check isTextElement outside
This commit is contained in:
parent
4709b953e7
commit
96a5d6548b
3 changed files with 32 additions and 9 deletions
|
@ -12,6 +12,7 @@ import { MaybeTransformHandleType } from "./transformHandles";
|
|||
import Scene from "../scene/Scene";
|
||||
import { isTextElement } from ".";
|
||||
import { getMaxContainerHeight, getMaxContainerWidth } from "./newElement";
|
||||
import { isImageElement } from "./typeChecks";
|
||||
|
||||
export const redrawTextBoundingBox = (
|
||||
textElement: ExcalidrawTextElement,
|
||||
|
@ -490,3 +491,12 @@ export const getContainerElement = (
|
|||
export const getContainerDims = (element: ExcalidrawElement) => {
|
||||
return { width: element.width, height: element.height };
|
||||
};
|
||||
|
||||
export const isValidTextContainer = (element: ExcalidrawElement) => {
|
||||
return (
|
||||
element.type === "rectangle" ||
|
||||
element.type === "ellipse" ||
|
||||
element.type === "diamond" ||
|
||||
isImageElement(element)
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue