Skip to content

Commit

Permalink
优化换行和P标签样式
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaoGongBra committed May 31, 2022
1 parent cafb28d commit 79b304a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions components/HtmlView.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
}

.html-ul {
margin: 35.84px 0;
margin: 32px 0;
}
.html-p {
margin: 35.84px 0;
margin: 32px 0;
flex-direction: row;
flex-wrap: wrap;
}
Expand Down
4 changes: 4 additions & 0 deletions components/HtmlView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export default function HtmlView({

return <Create nodes={nodes} />
}

const getNodes = (() => {
const nodeArr = {
span: 'Text',
Expand Down Expand Up @@ -244,6 +245,9 @@ const getNodes = (() => {
}
},
chars(text) {
if (text === '\n' || text === '\n\r') {
return
}
text = text.replace(/&nbsp;/g, ' ')
if (bufArray.length === 0) {
results.child.push(text);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "taro-html-view",
"version": "1.0.0",
"version": "1.0.1",
"description": "支持渲染由富文本编辑器编辑的html文本内容,支持小程序、h5、ReactNative,复杂的内容可能并不能正确渲染",
"main": "index.js",
"author": "[email protected]",
Expand Down

0 comments on commit 79b304a

Please sign in to comment.