Files
dify/web/app/components/base/prompt-editor/plugins/test-utils.tsx

18 lines
451 B
TypeScript

import type { LexicalEditor } from 'lexical'
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
import { useEffect } from 'react'
type CaptureEditorPluginProps = {
onReady: (editor: LexicalEditor) => void
}
export const CaptureEditorPlugin = ({ onReady }: CaptureEditorPluginProps) => {
const [editor] = useLexicalComposerContext()
useEffect(() => {
onReady(editor)
}, [editor, onReady])
return null
}