Skip to content

Commit

Permalink
TW-1666: Support others special tag
Browse files Browse the repository at this point in the history
  • Loading branch information
hieutbui committed Apr 12, 2024
1 parent 3f9ae83 commit 42fa72b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/pages/chat/events/message/message_content_builder_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,25 @@ mixin MessageContentBuilderMixin {

bool isContainsSpecialHTMLTag(Event event) {
final formattedText = event.formattedText;
final specialTags = [
'b',
'strong',
'tt',
'h[1-6]',
'code',
'pre',
'blockquote',
'del',
's',
'strike',
'i',
'em',
];
final specialTagsPattern = specialTags.join('|');
final specialTagRegex = RegExp(
r'<(b|strong|tt|h[1-6]|code)[^>]*>.*<\/(b|strong|tt|h[1-6]|code)>',
'<($specialTagsPattern)[^>]*>.*</($specialTagsPattern)>|<hr[^>]*>',
multiLine: true,
dotAll: true,
);
return specialTagRegex.hasMatch(formattedText);
}
Expand Down

0 comments on commit 42fa72b

Please sign in to comment.