mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 08:55:12 +00:00
refactor: Remove no longer necessary mx-reply workaround
This commit is contained in:
parent
938e1a91ae
commit
3d362df80a
1 changed files with 1 additions and 17 deletions
|
@ -59,22 +59,6 @@ class HtmlMessage extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// riot-web is notorious for creating bad reply fallback events from invalid messages which, if
|
|
||||||
// not handled properly, can lead to impersination. As such, we strip the entire `<mx-reply>` tags
|
|
||||||
// here already, to prevent that from happening.
|
|
||||||
// We do *not* do this in an AST and just with simple regex here, as riot-web tends to create
|
|
||||||
// miss-matching tags, and this way we actually correctly identify what we want to strip and, well,
|
|
||||||
// strip it.
|
|
||||||
final renderHtml = html.replaceAll(
|
|
||||||
RegExp(
|
|
||||||
'<mx-reply>.*</mx-reply>',
|
|
||||||
caseSensitive: false,
|
|
||||||
multiLine: false,
|
|
||||||
dotAll: true,
|
|
||||||
),
|
|
||||||
'',
|
|
||||||
);
|
|
||||||
|
|
||||||
final fontSize = AppConfig.messageFontSize * AppConfig.fontSizeFactor;
|
final fontSize = AppConfig.messageFontSize * AppConfig.fontSizeFactor;
|
||||||
|
|
||||||
final linkColor = textColor.withAlpha(150);
|
final linkColor = textColor.withAlpha(150);
|
||||||
|
@ -89,7 +73,7 @@ class HtmlMessage extends StatelessWidget {
|
||||||
padding: HtmlPaddings.only(left: 6, bottom: 0),
|
padding: HtmlPaddings.only(left: 6, bottom: 0),
|
||||||
);
|
);
|
||||||
|
|
||||||
final element = _linkifyHtml(HtmlParser.parseHTML(renderHtml));
|
final element = _linkifyHtml(HtmlParser.parseHTML(html));
|
||||||
|
|
||||||
// there is no need to pre-validate the html, as we validate it while rendering
|
// there is no need to pre-validate the html, as we validate it while rendering
|
||||||
return Html.fromElement(
|
return Html.fromElement(
|
||||||
|
|
Loading…
Reference in a new issue