if(richContent != null){
let index = 0 //width= 第一次出现的位置
let index2 = 0 // 宽度值结尾下标
let str = '' //截图width= 之后的内容
let widths = 0
let img = ''
if(richContent.indexOf(/<img1*>/gi) >= 0){
richContent= richContent.replace(/<img1*>/gi,function(match,capture){
img = JSON.parse(JSON.stringify(match))
index = img.indexOf('width=')
str = img.substring(index+6,img.length)
index2 = str.indexOf('"',1)
widths=str.substring(1,index2)
if(widths>300){
match = match.replace(/style="2+"/gi, '').replace(/style='3+'/gi, '');
match = match.replace(/width="2+"/gi, '').replace(/width='3+'/gi, '');
match = match.replace(/height="2+"/gi, '').replace(/height='3+'/gi, '');
return match;
}else{
return match;
}
});
if(widths>300){
richContent = richContent.replace(/style="2+"/gi,function(match,capture){
match = match.replace(/width:4+;/gi, 'max-width:100%;').replace(/width:4+;/gi, 'max-width:100%;');
return match;
});
richContent = richContent.replace(/<br1*/>/gi, '');
richContent = richContent.replace(/\<img/gi, '<img style="max-width:100%;margin:0 auto;display:inline-block"');
}else{
return match;
}
}
this.richContent = richContent;
}else{
this.richContent = ''
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。