Public function

Signature
function useEditableText(
  id: TLShapeId,
  type: string,
  text: string
): {
  handleBlur: () => void
  handleChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void
  handleDoubleClick: (e: any) => any
  handleFocus: typeof noop
  handleInputPointerDown: (e: React.PointerEvent) => void
  handleKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void
  isEditing: boolean
  isEditingAnything: boolean
  isEmpty: boolean
  rInput: React.RefObject<HTMLTextAreaElement>
}
Parameters
NameDescription

id

TLShapeId

type

string

text

string
Returns
{
  handleBlur: () => void
  handleChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void
  handleDoubleClick: (e: any) => any
  handleFocus: typeof noop
  handleInputPointerDown: (e: React.PointerEvent) => void
  handleKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void
  isEditing: boolean
  isEditingAnything: boolean
  isEmpty: boolean
  rInput: React.RefObject<HTMLTextAreaElement>
}
References

TLShapeId

Source

packages/tldraw/src/lib/shapes/shared/useEditableText.ts

useDialogsuseExportAs