@selfcommunity/react-ui
Version:
React UI Components to integrate a Community created with SelfCommunity Platform.
18 lines (17 loc) • 685 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const LexicalOnChangePlugin_1 = require("@lexical/react/LexicalOnChangePlugin");
const html_1 = require("@lexical/html");
const OnChangePlugin = (props) => {
// PROPS
const { onChange } = props;
const handleChange = (editorState, editor) => {
editorState.read(() => {
const htmlString = (0, html_1.$generateHtmlFromNodes)(editor);
onChange(htmlString);
});
};
return (0, jsx_runtime_1.jsx)(LexicalOnChangePlugin_1.OnChangePlugin, { onChange: handleChange });
};
exports.default = OnChangePlugin;
;