首页 > 其他 > 详细

react中simdiotr富文本的基础使用

时间:2020-06-17 12:05:31      阅读:78      评论:0      收藏:0      [点我收藏+]

 

  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版本可解决上述问题

 

 

 

  

react中simdiotr富文本的基础使用

原文:https://www.cnblogs.com/tu-0718/p/13151398.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!