Rich text editor based on react. With superior compatibility, you can perfectly retain the text format copied from anywhere !!
npm i jserTang@react-rich-text-editorgit clone https://github.com/jserTang/react-rich-text-editor.git
cd react-rich-text-editor
npm i && npm startimport { RichTextEditor } from 'jserTang@react-rich-text-editor';
const Demo = () => {
const defaultContent = 'default content!';
const config = {
menuBarFixTop: 0,
menus: defaultMenus,
placeholder: 'This is placeholder',
};
const onUpdate = (data: { html: string; text: string }) => {
console.log(data.html);
};
return <RichTextEditor config={config} content={defaultContent} onUpdate={onUpdate} />;
}- content: Initial text content
- config: Editor configuration; menu, placeholder are configured here
- extensions: Extension plug-ins are configured here
- i18n: Configure the copy that should be displayed in the editor
- onUpdate: This callback is performed when the content changes

