useEditableRichText

See source code
function useEditableRichText(
  shapeId: TLShapeId,
  type: ExtractShapeByProps<{
    richText: TLRichText;
  }>["type"],
  richText?: TLRichText,
): {
  handleBlur: () => void;
  handleChange: ({
    richText,
  }: {
    richText: {
      attrs?: any;
      content: unknown[];
      type: string;
    };
  }) => void;
  handleDoubleClick: (
    e:
      | {
          nativeEvent: Event;
        }
      | Event,
  ) => void;
  handleFocus: () => void;
  handleInputPointerDown: (e: import("react").PointerEvent<Element>) => void;
  handleKeyDown: (e: KeyboardEvent) => void;
  handlePaste: (
    e: ClipboardEvent | import("react").ClipboardEvent<HTMLTextAreaElement>,
  ) => void;
  isEditing: boolean;
  isEmpty: boolean | undefined;
  isReadyForEditing: boolean;
  rInput: import("react").RefObject<HTMLDivElement | null>;
};

Parameters

NameDescription

shapeId

type

ExtractShapeByProps<{
  richText: TLRichText;
}>["type"];

richText

Returns

{
  handleBlur: () => void;
  handleChange: ({
    richText,
  }: {
    richText: {
      attrs?: any;
      content: unknown[];
      type: string;
    };
  }) => void;
  handleDoubleClick: (
    e:
      | {
          nativeEvent: Event;
        }
      | Event,
  ) => void;
  handleFocus: () => void;
  handleInputPointerDown: (e: import("react").PointerEvent<Element>) => void;
  handleKeyDown: (e: KeyboardEvent) => void;
  handlePaste: (
    e: ClipboardEvent | import("react").ClipboardEvent<HTMLTextAreaElement>,
  ) => void;
  isEditing: boolean;
  isEmpty: boolean | undefined;
  isReadyForEditing: boolean;
  rInput: import("react").RefObject<HTMLDivElement | null>;
};
Prev
useEditablePlainText
Next
useExportAs