From b6b59cdb3ce70c7b119f4f126c05f613421d5b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 24 Apr 2022 01:58:22 +0200 Subject: Change user-additions HTML detection. --- static/user/user-additions.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'static') diff --git a/static/user/user-additions.js b/static/user/user-additions.js index c9ebe1a4..d357b4b5 100644 --- a/static/user/user-additions.js +++ b/static/user/user-additions.js @@ -1,6 +1,7 @@ window.formatters.set('description', (el, d) => { - if (//.exec(d)) { - /* Assume that the text is HTML iff it contains a
tag */ + if (/<\/?\w+( \w+(="?\w+"?)?)*\/?>/.exec(d)) { + /* Assume that the text is HTML if it contains something which looks + like an HTML tag */ let parser = new DOMParser(); let doc = parser.parseFromString(d, 'text/html'); el.replaceChildren(doc.body); -- cgit v1.2.3