import * as React from 'react'; import { useEffect } from 'react'; import { ctw } from '@ballerine/ui'; import { EditorContent } from '@tiptap/react'; import type { Content, Editor } from '@tiptap/react'; import { SectionTwo } from './components/section/two'; import { SectionFour } from './components/section/four'; import { SectionFive } from './components/section/five'; import { useMinimalTiptapEditor } from './hooks/use-minimal-tiptap'; import { MeasuredContainer } from './components/MeasuredContainer'; import { LinkBubbleMenu } from './components/bubble-menu/LinkBubbleMenu'; import type { UseMinimalTiptapEditorProps } 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 const MinimalTiptapEditor = React.forwardRef( ({ value, onChange, className, editorContentClassName, ...props }, ref) => { const editor = useMinimalTiptapEditor({ value, onUpdate: onChange, ...props, }); useEffect(() => { if (editor && value !== editor.getHTML()) { editor.commands.setContent(value ?? ''); } }, [value, editor]); if (!editor) { return null; } return ( ); }, ); MinimalTiptapEditor.displayName = 'MinimalTiptapEditor'; export default MinimalTiptapEditor;