mirror of
https://github.com/langgenius/dify.git
synced 2026-03-05 23:57:06 +08:00
18 lines
451 B
TypeScript
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
|
|
}
|