@jaceyi/lexical-editor
v0.2.0
Published
A React rich text editor based on Lexical, supporting HTML and JSON modes with extensible plugins.
Readme
Lexical Editor
基于 Lexical 的 React 富文本编辑器,可快速上手。
- 基础富文本能力:粗体、斜体、下划线、标题、引用、列表
- 常用样式能力:颜色、字号、字体、对齐
- 扩展能力:链接、图片/文件上传、@提及、关键词高亮
- 双数据模式:
html字符串与json结构化数据
Docs
Install
npm install @jaceyi/lexical-editor
# or
yarn add @jaceyi/lexical-editorExample
import Editor, { useHTMLHandle } from '@jaceyi/lexical-editor';
import '@jaceyi/lexical-editor/style.css';
const App = () => {
const [{ value }, editorProps] = useHTMLHandle({
initialValue: '<p>Hello Lexical Editor</p>',
});
return (
<>
<Editor namespace="basic-demo" {...editorProps} />
<pre>{value}</pre>
</>
);
};
export default App;
JSON模式可使用useJSONHandle,并将mode设置为json。
License
MIT
