import * as React from "react" import "./styles/index.css" import { EditorContent } from "@tiptap/react" import type { Content, Editor } from "@tiptap/react" import { Separator } from "@/components/ui/separator" import { cn } from "@/lib/utils" import { SectionOne } from "./components/section/one" import { SectionTwo } from "./components/section/two" import { SectionThree } from "./components/section/three" import { SectionFour } from "./components/section/four" import { SectionFive } from "./components/section/five" import { LinkBubbleMenu } from "./components/bubble-menu/link-bubble-menu" import { ImageBubbleMenu } from "./components/bubble-menu/image-bubble-menu" import type { UseMinimalTiptapEditorProps } from "./hooks/use-minimal-tiptap" import { useMinimalTiptapEditor } from "./hooks/use-minimal-tiptap" export interface MinimalTiptapProps extends Omit { value?: Content onChange?: (value: Content) => void className?: string editorContentClassName?: string } const Toolbar = ({ editor }: { editor: Editor }) => (
) export type MinimalTiptapEditorRef = { editor: Editor | null } export const MinimalTiptapEditor = React.forwardRef( ({ value, onChange, className, editorContentClassName, ...props }, ref) => { const editor = useMinimalTiptapEditor({ value, onUpdate: onChange, ...props }) React.useImperativeHandle( ref, () => ({ editor: editor || null }), [editor] ) if (!editor) { return null } return (
) } ) MinimalTiptapEditor.displayName = "MinimalTiptapEditor" export default MinimalTiptapEditor