当前位置:网站首页>Rich text editing: wangeditor tutorial
Rich text editing: wangeditor tutorial
2022-07-04 14:15:00 【Angry little match man】
List of articles
Preface
A project that children have recently done requires rich text editing , Originally wanted to use github Upper react-draft-wysiwyg resources , But I found that there was a version problem ,React Updated to v18, So many functions are not easy to use , Baidu hasn't found a solution for half a year , Finally, abandon and decide to use wangEditor
Official documents
One 、 Official documents
Basically, download , introduce
Download and install on demand
I created React project , So press react Download dependency
Two 、 The styling
I found this style problem today , Look at this evil official big , Let's customize , If you don't write the style , Final table 、 quote 、 Code blocks and everything are just simple text displays !!!
resolvent :
In reference to Editor Nested outside a div( Anything , It's OK not to write ), You need to give this whole html Add the following style to the content display area , You can display tables or something
.editor-content-view {
border: 3px solid #ccc;
border-radius: 5px;
padding: 0 10px;
margin-top: 20px;
overflow-x: auto;
}
.editor-content-view p, .editor-content-view li {
white-space: pre-wrap;
/* Keep the space */
}
.editor-content-view blockquote {
border-left: 8px solid #d0e5f2;
padding: 10px 10px;
margin: 10px 0;
background-color: #f1f1f1;
}
.editor-content-view code {
font-family: monospace;
background-color: #eee;
padding: 3px;
border-radius: 3px;
}
.editor-content-view pre>code {
display: block;
padding: 10px;
}
.editor-content-view table {
border-collapse: collapse;
}
.editor-content-view td, .editor-content-view th {
border: 1px solid #ccc;
min-width: 50px;
height: 20px;
}
.editor-content-view th {
background-color: #f1f1f1;
}
.editor-content-view ul, .editor-content-view ol {
padding-left: 20px;
}
.editor-content-view input[type="checkbox"] {
margin-right: 5px;
}
Be careful editor-content-view It's your custom class Class name , Here's my html Display code (React)
<div className='editor-content-view' dangerouslySetInnerHTML={
{
__html:newsDetail.content
}} style={
{
border:'1px solid #BAC0BA',
margin:'0px 24px',
height:'300px',
overflow:'auto',
padding:'5px 10px'
}} />
边栏推荐
- Summary of recent days (non-technical article)
- Deming Lee listed on Shenzhen Stock Exchange: the market value is 3.1 billion, which is the husband and wife of Li Hu and Tian Hua
- Test evaluation of software testing
- CVPR 2022 | greatly reduce the manual annotation required for zero sample learning, and propose category semantic embedding rich in visual information (source code download)
- Variable promotion and function promotion in JS
- 英视睿达冲刺科创板:年营收4.5亿 拟募资9.79亿
- GCC【6】- 编译的4个阶段
- 吃透Chisel语言.03.写给Verilog转Chisel的开发者(没有Verilog基础也可以看看)
- 吃透Chisel语言.10.Chisel项目构建、运行和测试(二)——Chisel中生成Verilog代码&Chisel开发流程
- Unittest中的TestSuite和TestRunner
猜你喜欢
MATLAB中tiledlayout函数使用
递增的三元子序列[贪心训练]
Supprimer les lettres dupliquées [avidité + pile monotone (maintenir la séquence monotone avec un tableau + Len)]
安装Mysql
Mask wearing detection based on yolov1
【Matlab】conv、filter、conv2、filter2和imfilter卷积函数总结
中邮科技冲刺科创板:年营收20.58亿 邮政集团是大股东
去除重複字母[貪心+單調棧(用數組+len來維持單調序列)]
Understand chisel language thoroughly 05. Chisel Foundation (II) -- combinational circuits and operators
国内酒店交易DDD应用与实践——代码篇
随机推荐
递增的三元子序列[贪心训练]
Apple 5g chip research and development failure: continue to rely on Qualcomm, but also worry about being prosecuted?
吃透Chisel语言.09.Chisel项目构建、运行和测试(一)——用sbt构建Chisel项目并运行
【Antd】Antd 如何在 Form.Item 中有 Input.Gourp 时获取 Input.Gourp 的每一个 Input 的value
安装Mysql
Understand chisel language thoroughly 04. Chisel Foundation (I) - signal type and constant
基于YOLOv1的口罩佩戴检测
WS2818M是CPC8封装,是三通道LED驱动控制专用电路外置IC全彩双信号5V32灯可编程led灯带户外工程
Understand chisel language thoroughly 09. Chisel project construction, operation and testing (I) -- build and run chisel project with SBT
Haobo medical sprint technology innovation board: annual revenue of 260million Yonggang and Shen Zhiqun are the actual controllers
【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
中邮科技冲刺科创板:年营收20.58亿 邮政集团是大股东
MySQL之详解索引
find命令报错: paths must precede expression(转)
2022g3 boiler water treatment examination question simulation examination question bank and simulation examination
JVM memory layout detailed, illustrated, well written!
【Antd踩坑】Antd Form 配合Input.Group时出现Form.Item所占据的高度不对
IP lab monthly resumption · issue 5
IP 实验室月复盘 · 第 5 期
mac redis安装与使用,连接远程服务器 redis