当前位置:网站首页>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'
}} />
边栏推荐
- [R language data science]: cross validation and looking back
- What is the real meaning and purpose of doing things, and what do you really want
- Ws2811 m is a special circuit for three channel LED drive and control, and the development of color light strip scheme
- 递增的三元子序列[贪心训练]
- Summary of recent days (non-technical article)
- Understand chisel language thoroughly 05. Chisel Foundation (II) -- combinational circuits and operators
- 吃透Chisel语言.03.写给Verilog转Chisel的开发者(没有Verilog基础也可以看看)
- 吃透Chisel语言.05.Chisel基础(二)——组合电路与运算符
- Excel快速合并多行数据
- LiveData
猜你喜欢
Applet live + e-commerce, if you want to be a new retail e-commerce, use it!
吃透Chisel语言.11.Chisel项目构建、运行和测试(三)——Chisel测试之ScalaTest
Mask wearing detection based on yolov1
Summary of recent days (non-technical article)
硬件基础知识-二极管基础
392. 判断子序列
学内核之三:使用GDB跟踪内核调用链
Hardware Basics - diode Basics
测试流程整理(2)
小程序直播 + 电商,想做新零售电商就用它吧!
随机推荐
Migration from go vendor project to mod project
华昊中天冲刺科创板:年亏2.8亿拟募资15亿 贝达药业是股东
Install and use MAC redis, connect to remote server redis
Supprimer les lettres dupliquées [avidité + pile monotone (maintenir la séquence monotone avec un tableau + Len)]
Understand chisel language thoroughly 05. Chisel Foundation (II) -- combinational circuits and operators
Golang 使用 JSON unmarshal 数字到 interface{} 数字变成 float64 类型(转)
Mask wearing detection based on yolov1
2022 practice questions and mock exams for the main principals of hazardous chemical business units
[FAQ] Huawei Account Service Error Report 907135701 Common reasons Summary and Solutions
[R language data science]: cross validation and looking back
测试流程整理(2)
Read excel table data
为什么图片传输要使用base64编码
[antd] how to set antd in form There is input in item Get input when gourp Value of each input of gourp
Learning projects are self-made, and growth opportunities are self created
Ws2811 m is a special circuit for three channel LED drive and control, and the development of color light strip scheme
递增的三元子序列[贪心训练]
Variable promotion and function promotion in JS
Understand chisel language thoroughly 06. Chisel Foundation (III) -- registers and counters
C# wpf 实现截屏框实时截屏功能