fix: Render not permitted html tags as text instead of hiding
This commit is contained in:
parent
1ea649f01e
commit
903f7c7d15
1 changed files with 2 additions and 5 deletions
|
|
@ -156,8 +156,8 @@ class HtmlMessage extends StatelessWidget {
|
|||
// We must not render elements nested more than 100 elements deep:
|
||||
if (depth >= 100) return const TextSpan();
|
||||
|
||||
// This is a text node, so we render it as text:
|
||||
if (node is! dom.Element) {
|
||||
// This is a text node or not permitted node, so we render it as text:
|
||||
if (node is! dom.Element || !allowedHtmlTags.contains(node.localName)) {
|
||||
var text = node.text ?? '';
|
||||
// Single linebreak nodes between Elements are ignored:
|
||||
if (text == '\n') text = '';
|
||||
|
|
@ -170,9 +170,6 @@ class HtmlMessage extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
// We must not render tags which are not in the allow list:
|
||||
if (!allowedHtmlTags.contains(node.localName)) return const TextSpan();
|
||||
|
||||
switch (node.localName) {
|
||||
case 'br':
|
||||
return const TextSpan(text: '\n');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue