Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

854 B
Raw Blame
import { cn } from "@dub/utils";
import { EditorContent, EditorContentProps } from "@tiptap/react";
import { LoadingSpinner } from "../icons";
import { useRichTextContext } from "./rich-text-provider";

export * from "./link-modal";
export * from "./rich-text-provider";
export * from "./rich-text-toolbar";

export function RichTextArea({
  className,
  ...rest
}: Omit<EditorContentProps, "editor">) {
  const { editor, isUploading } = useRichTextContext();

  return (
    <div
      className={cn(
        "relative",
        isUploading && "pointer-events-none opacity-50",
        className,
      )}
    >
      <EditorContent editor={editor} {...rest} />

      {isUploading && (
        <div className="absolute inset-0 flex items-center justify-center">
          <LoadingSpinner className="size-4" />
        </div>
      )}
    </div>
  );
}