mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 08:15:09 +00:00
fix: Render tg-forward html tags
This commit is contained in:
parent
21af30e4c5
commit
172cd651fc
1 changed files with 20 additions and 1 deletions
|
@ -156,6 +156,7 @@ class HtmlMessage extends StatelessWidget {
|
||||||
SpoilerExtension(textColor: textColor),
|
SpoilerExtension(textColor: textColor),
|
||||||
const ImageExtension(),
|
const ImageExtension(),
|
||||||
FontColorExtension(),
|
FontColorExtension(),
|
||||||
|
FallbackTextExtension(fontSize: fontSize),
|
||||||
],
|
],
|
||||||
onLinkTap: (url, _, element) => UrlLauncher(
|
onLinkTap: (url, _, element) => UrlLauncher(
|
||||||
context,
|
context,
|
||||||
|
@ -172,6 +173,8 @@ class HtmlMessage extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const Set<String> fallbackTextTags = {'tg-forward'};
|
||||||
|
|
||||||
/// Keep in sync with: https://spec.matrix.org/v1.6/client-server-api/#mroommessage-msgtypes
|
/// Keep in sync with: https://spec.matrix.org/v1.6/client-server-api/#mroommessage-msgtypes
|
||||||
static const Set<String> allowedHtmlTags = {
|
static const Set<String> allowedHtmlTags = {
|
||||||
'font',
|
'font',
|
||||||
|
@ -217,7 +220,7 @@ class HtmlMessage extends StatelessWidget {
|
||||||
'rp',
|
'rp',
|
||||||
'rt',
|
'rt',
|
||||||
// Workaround for https://github.com/krille-chan/fluffychat/issues/507
|
// Workaround for https://github.com/krille-chan/fluffychat/issues/507
|
||||||
'tg-forward',
|
...fallbackTextTags,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,6 +413,22 @@ class CodeExtension extends HtmlExtension {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class FallbackTextExtension extends HtmlExtension {
|
||||||
|
final double fontSize;
|
||||||
|
|
||||||
|
FallbackTextExtension({required this.fontSize});
|
||||||
|
@override
|
||||||
|
Set<String> get supportedTags => HtmlMessage.fallbackTextTags;
|
||||||
|
|
||||||
|
@override
|
||||||
|
InlineSpan build(ExtensionContext context) => TextSpan(
|
||||||
|
text: context.element?.text ?? '',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: fontSize,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
class RoomPillExtension extends HtmlExtension {
|
class RoomPillExtension extends HtmlExtension {
|
||||||
final Room room;
|
final Room room;
|
||||||
final BuildContext context;
|
final BuildContext context;
|
||||||
|
|
Loading…
Reference in a new issue