UNPKG

@selfcommunity/react-ui

Version:

React UI Components to integrate a Community created with SelfCommunity Platform.

16 lines (15 loc) 585 B
import { jsx as _jsx } from "react/jsx-runtime"; import { OnChangePlugin as LexicalOnChangePlugin } from '@lexical/react/LexicalOnChangePlugin'; import { $generateHtmlFromNodes } from '@lexical/html'; const OnChangePlugin = (props) => { // PROPS const { onChange } = props; const handleChange = (editorState, editor) => { editorState.read(() => { const htmlString = $generateHtmlFromNodes(editor); onChange(htmlString); }); }; return _jsx(LexicalOnChangePlugin, { onChange: handleChange }); }; export default OnChangePlugin;