simditor是什么?
一个基于浏览器的文本编辑器,也就是我们通常说的富文本
simditor官网
https://simditor.tower.im/ (simditor官网)
https://github.com/mycolorway/simditor (github)
simditor安装
npm install simditor
simditor卸载
npm uninstall simditor
simditor使用
1.在你react组件中引入simditor和css样式
2.在你react组件的render()中return下面的html代码
3.Simditor需要在组件加载时进行初始化,在生命周期函数componentDidMount()中调用richEditor()
注:其中this.refs[‘‘editor-descripition"]指代上面DOM节点<textarea ref="editor-descripition"></textarea>
如果你要插入多个富文本编辑器,只需要在生产对应的simditor即可
若运行后报错如下图提示
注:可降低版本,经本人测试,simditor2.3.6版本可解决上述问题
原文:https://www.cnblogs.com/tu-0718/p/13151398.html