import { Editor } from "@tiptap/core"; import { Check, Trash } from "lucide-react"; import { Dispatch, FC, SetStateAction, useEffect, useRef } from "react"; import { cn } from "../utils"; import isValidHttpUrl from "./utils/link-validator"; interface LinkSelectorProps { editor: Editor; isOpen: boolean; setIsOpen: Dispatch>; } export const LinkSelector: FC = ({ editor, isOpen, setIsOpen }) => { const inputRef = useRef(null); useEffect(() => { inputRef.current && inputRef.current?.focus(); }); return (
{isOpen && (
{editor.getAttributes("link").href ? ( ) : ( )}
)}
); };