Browse Source

编辑器转义处理

dev01 1 year ago
parent
commit
fc1dde89c7
2 changed files with 9 additions and 3 deletions
  1. 1 1
      package.json
  2. 8 2
      src/pages/reportdetail/reportdetail.js

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 	"name": "kede-createRD-h5",
-	"version": "1.3.0",
+	"version": "1.3.1",
 	"private": true,
 	"description": "Taro 多端(微信小程序 + H5 + React Native)",
 	"scripts": {

+ 8 - 2
src/pages/reportdetail/reportdetail.js

@@ -103,7 +103,13 @@ class ReportDetail extends Component {
       const chaplist = this.state.data.chapters
       chaplist.forEach(function (item, index) {
         if (index == i) {
-          item.content = res
+          const paragraphs = res.split('\n').map((paragraph) =>
+            !!paragraph
+              ? `<p>${paragraph.trim()}</p>`
+              : `\n`
+          );
+          item.content = paragraphs.join('');
+          // item.content = res
         }
       })
       this.setState({
@@ -741,7 +747,7 @@ class ReportDetail extends Component {
         {this.state.popup &&
           <View className='mask'>
             <View className='count'>
-              <View className='title' style={{ margin: "60px 0" }}>确认删除吗?</View>
+              <View className='title' style={{ margin: "60px 0" }}>确认删除该章节吗?</View>
               <View className='count_foot'>
                 <Button onClick={this.toggleVisible}>取消</Button>
                 <Button style={{ marginTop: 0 }}