Prepare cleanHtml() for new feature

This commit is contained in:
the-djmaze 2023-02-14 14:07:38 +01:00
parent 4d2cd82d95
commit aae3072209
2 changed files with 5 additions and 3 deletions

View file

@ -276,7 +276,7 @@ populateMessageBody = (oMessage, popup) => {
MessageUserStore.error('');
const messagesDom = MessageUserStore.bodiesDom();
if (messagesDom) {
let id = 'rl-msg-' + oMessage.hash.replace(/[^a-zA-Z0-9]/g, ''),
let id = 'rl-msg-' + oMessage.hash,
body = elementById(id);
if (body) {
oMessage.body = body;

View file

@ -25,6 +25,8 @@ import { LanguageStore } from 'Stores/Language';
import Remote from 'Remote/User/Fetch';
const
msgHtml = msg => cleanHtml(msg.html(), msg.attachments()),
toggleTag = (message, keyword) => {
const lower = keyword.toLowerCase(),
flags = message.flags,
@ -291,7 +293,7 @@ export class MessageModel extends AbstractModel {
viewHtml() {
const body = this.body;
if (body && this.html()) {
let result = cleanHtml(this.html(), this.attachments());
let result = msgHtml(this);
this.hasExternals(result.hasExternals);
this.hasImages(body.rlHasImages = !!result.hasExternals);
@ -460,7 +462,7 @@ export class MessageModel extends AbstractModel {
);
return clone.innerHTML;
}
let result = cleanHtml(this.html(), this.attachments())
let result = msgHtml(this);
return result.html || plainToHtml(this.plain());
}