w***@126.com
w***@126.com
  • 发布:2020-06-22 20:43
  • 更新:2020-06-22 20:43
  • 阅读:763

【报Bug】富文本编辑setContents初始化内容出错。

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 10.15.2

HBuilderX类型: 正式

HBuilderX版本号: 2.7.14

手机系统: iOS

手机系统版本号: iOS 13.4

手机厂商: 苹果

手机机型: iphone8

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
const userInfo = {nickname: this.commentInfo.fromNickName, userId: this.commentInfo.fromUid};    
                let userInfoHtml = `<a href="toutou://user-detail?${stringify(userInfo)}" data-info="${stringify(userInfo)}" style="text-decoration:none;color:#3077EC">@${userInfo.nickname}: </a>`    
                const initHtml = this.commentInfo.content;    
                const reg = /(<p.*?>)(.*?<\/p>)/g;    
                userInfoHtml = initHtml.replace(reg, '$1'+'//' +userInfoHtml+'$2');    
                console.log('userInfoHtml',userInfoHtml)    
                this.editorCtx.setContents({html:userInfoHtml});    
                this.editorCtx.getContents({    
                    complete(res) {    
                   console.log('初始化转发的内容', res)    
            }    
 })

操作步骤:

见代码

预期结果:

保留原内容

实际结果:

被更改了

bug描述:

富文本编辑初始化内容是,标签内的属性被更改了。

2020-06-22 20:43 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复