当前位置:网站首页>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'
}} />
边栏推荐
猜你喜欢

国内酒店交易DDD应用与实践——代码篇

vscode 常用插件汇总

2022g3 boiler water treatment examination question simulation examination question bank and simulation examination

1200. Minimum absolute difference

MySQL之详解索引

Install MySQL

富文本编辑:wangEditor使用教程

Summary of recent days (non-technical article)
![递增的三元子序列[贪心训练]](/img/92/7efd1883c21c0e804ffccfb2231602.png)
递增的三元子序列[贪心训练]

【Antd】Antd 如何在 Form.Item 中有 Input.Gourp 时获取 Input.Gourp 的每一个 Input 的value
随机推荐
R语言使用dplyr包的mutate函数对指定数据列进行标准化处理(使用mean函数和sd函数)并基于分组变量计算标准化后的目标变量的分组均值
The font of markdown grammar is marked in red
[C question set] of VII
Understand chisel language thoroughly 07. Chisel Foundation (IV) - bundle and VEC
奇妙秘境 码蹄集
Huahao Zhongtian sprint Technology Innovation Board: perte annuelle de 280 millions de RMB, projet de collecte de fonds de 1,5 milliard de Beida Pharmaceutical est actionnaire
MySQL8版本免安装步骤教程
Introducing testfixture into unittest framework
ARouter的使用
[FAQ] summary of common causes and solutions of Huawei account service error 907135701
Assertion of unittest framework
Understand chisel language thoroughly 08. Chisel Foundation (V) -- wire, REG and IO, and how to understand chisel generation hardware
Worried about "cutting off gas", Germany is revising the energy security law
Idea shortcut keys
递增的三元子序列[贪心训练]
测试流程整理(3)
吃透Chisel语言.03.写给Verilog转Chisel的开发者(没有Verilog基础也可以看看)
BLOB,TEXT GEOMETRY or JSON column 'xxx' can't have a default value query 问题
Can mortgage with housing exclude compulsory execution
mac redis安装与使用,连接远程服务器 redis