fix: catch if browser doesn't have Sanitizer

This commit is contained in:
Ayo 2023-06-01 12:59:27 +02:00
parent 7cd385aa0c
commit bb0bfd2b2f

View file

@ -62,8 +62,13 @@ function createRepliesBlock(replies, heading) {
).toLocaleDateString()}</a><div class="clear-both"></div>`; ).toLocaleDateString()}</a><div class="clear-both"></div>`;
const card = document.createElement("div"); const card = document.createElement("div");
card.className = "reply-card"; card.className = "reply-card";
if (typeof Sanitizer !== "undefined") {
const sanitizer = new Sanitizer(); const sanitizer = new Sanitizer();
card.setHTML(reply.content.html, { sanitizer }); card.setHTML(reply.content.html, { sanitizer });
} else {
// todo sanitize manually
card.innerHTML = reply.content.html;
}
card.insertBefore(author, card.firstChild); card.insertBefore(author, card.firstChild);
cell.appendChild(card); cell.appendChild(card);
repliesTable.append(row); repliesTable.append(row);