TextShapeUtil
Table of contents
Public class
Signature
class TextShapeUtil extends ShapeUtil<TLTextShape> {}
References
Source
packages/tldraw/src/lib/shapes/text/TextShapeUtil.tsx
Properties
canEdit
Public property
Signature
canEdit: () => boolean
isAspectRatioLocked
Public property
Signature
isAspectRatioLocked: TLShapeUtilFlag<TLTextShape>
References
migrations
Public static property
Signature
static migrations: import('@tldraw/editor').TLPropsMigrations
References
onBeforeCreate
Public property
Signature
onBeforeCreate: (shape: TLTextShape) =>
| {
id: TLShapeId
index: import('@tldraw/editor').IndexKey
isLocked: boolean
meta: import('@tldraw/editor').JsonObject
opacity: number
parentId: import('@tldraw/editor').TLParentId
props: {
autoSize: boolean
color:
| 'black'
| 'blue'
| 'green'
| 'grey'
| 'light-blue'
| 'light-green'
| 'light-red'
| 'light-violet'
| 'orange'
| 'red'
| 'violet'
| 'white'
| 'yellow'
font: 'draw' | 'mono' | 'sans' | 'serif'
scale: number
size: 'l' | 'm' | 's' | 'xl'
text: string
textAlign: 'end' | 'middle' | 'start'
w: number
}
rotation: number
type: 'text'
typeName: 'shape'
x: number
y: number
}
| undefined
References
TLTextShape, TLShapeId, TLParentId
onBeforeUpdate
Public property
Signature
onBeforeUpdate: (
prev: TLTextShape,
next: TLTextShape
) =>
| {
id: TLShapeId
index: import('@tldraw/editor').IndexKey
isLocked: boolean
meta: import('@tldraw/editor').JsonObject
opacity: number
parentId: import('@tldraw/editor').TLParentId
props: {
autoSize: boolean
color:
| 'black'
| 'blue'
| 'green'
| 'grey'
| 'light-blue'
| 'light-green'
| 'light-red'
| 'light-violet'
| 'orange'
| 'red'
| 'violet'
| 'white'
| 'yellow'
font: 'draw' | 'mono' | 'sans' | 'serif'
scale: number
size: 'l' | 'm' | 's' | 'xl'
text: string
textAlign: 'end' | 'middle' | 'start'
w: number
}
rotation: number
type: 'text'
typeName: 'shape'
x: number
y: number
}
| undefined
References
TLTextShape, TLShapeId, TLParentId
onDoubleClickEdge
Public property
Signature
onDoubleClickEdge: (shape: TLTextShape) =>
| {
id: TLShapeId
props: {
autoSize: boolean
scale?: undefined
}
type: 'text'
}
| {
id: TLShapeId
props: {
autoSize?: undefined
scale: number
}
type: 'text'
}
| undefined
References
onEditEnd
Public property
Signature
onEditEnd: TLOnEditEndHandler<TLTextShape>
References
TLOnEditEndHandler, TLTextShape
onResize
Public property
Signature
onResize: TLOnResizeHandler<TLTextShape>
References
TLOnResizeHandler, TLTextShape
props
Public static property
Signature
static props: {
autoSize: import('@tldraw/editor').Validator<boolean>
color: import('@tldraw/editor').EnumStyleProp<
| 'black'
| 'blue'
| 'green'
| 'grey'
| 'light-blue'
| 'light-green'
| 'light-red'
| 'light-violet'
| 'orange'
| 'red'
| 'violet'
| 'white'
| 'yellow'
>
font: import('@tldraw/editor').EnumStyleProp<
'draw' | 'mono' | 'sans' | 'serif'
>
scale: import('@tldraw/editor').Validator<number>
size: import('@tldraw/editor').EnumStyleProp<'l' | 'm' | 's' | 'xl'>
text: import('@tldraw/editor').Validator<string>
textAlign: import('@tldraw/editor').EnumStyleProp<
'end' | 'middle' | 'start'
>
w: import('@tldraw/editor').Validator<number>
}
References
type
Public static property
Signature
static type: 'text'
Methods
component()
Public method
Signature
component(shape: TLTextShape): import('react/jsx-runtime').JSX.Element
Parameters
Name | Description |
---|---|
|
|
Returns
import('react/jsx-runtime').JSX.Element
References
getDefaultProps()
Public method
Signature
getDefaultProps(): TLTextShape['props']
References
getGeometry()
Public method
Signature
getGeometry(shape: TLTextShape): Rectangle2d
Parameters
Name | Description |
---|---|
|
|
Returns
Rectangle2d
References
getMinDimensions()
Public method
Signature
getMinDimensions(shape: TLTextShape): {
height: number
width: number
}
Parameters
Name | Description |
---|---|
|
|
Returns
{
height: number
width: number
}
References
indicator()
Public method
Signature
indicator(shape: TLTextShape): import('react/jsx-runtime').JSX.Element | null
Parameters
Name | Description |
---|---|
|
|
Returns
import('react/jsx-runtime').JSX.Element | null
References
toSvg()
Public method
Signature
toSvg(
shape: TLTextShape,
ctx: SvgExportContext
): import('react/jsx-runtime').JSX.Element
Parameters
Name | Description |
---|---|
|
|
|
|
Returns
import('react/jsx-runtime').JSX.Element
References