useEditablePlainText

See source code
function useEditablePlainText(
  shapeId: TLShapeId,
  type: ExtractShapeByProps<{
    text: string;
  }>["type"],
  text?: string,
): {
  handleBlur: () => void;
  handleChange: ({ plaintext }: { plaintext: string }) => void;
  handleDoubleClick: (
    e:
      | {
          nativeEvent: Event;
        }
      | Event,
  ) => void;
  handleFocus: () => void;
  handleInputPointerDown: (e: React.PointerEvent<Element>) => void;
  handleKeyDown: (e: KeyboardEvent) => void;
  handlePaste: (
    e: ClipboardEvent | React.ClipboardEvent<HTMLTextAreaElement>,
  ) => void;
  isEditing: boolean;
  isEmpty: boolean;
  isReadyForEditing: boolean;
  rInput: React.RefObject<HTMLTextAreaElement | null>;
};

Parameters

NameDescription

shapeId

type

ExtractShapeByProps<{
  text: string;
}>["type"];

text

string;

Returns

{
  handleBlur: () => void;
  handleChange: ({ plaintext }: { plaintext: string }) => void;
  handleDoubleClick: (
    e:
      | {
          nativeEvent: Event;
        }
      | Event,
  ) => void;
  handleFocus: () => void;
  handleInputPointerDown: (e: React.PointerEvent<Element>) => void;
  handleKeyDown: (e: KeyboardEvent) => void;
  handlePaste: (
    e: ClipboardEvent | React.ClipboardEvent<HTMLTextAreaElement>,
  ) => void;
  isEditing: boolean;
  isEmpty: boolean;
  isReadyForEditing: boolean;
  rInput: React.RefObject<HTMLTextAreaElement | null>;
};
Prev
useDirection
Next
useEditableRichText