From 42fa72b05ea5301090bc425634dc2f450673be18 Mon Sep 17 00:00:00 2001 From: hieubt Date: Fri, 12 Apr 2024 11:14:06 +0700 Subject: [PATCH] TW-1666: Support others special tag --- .../message_content_builder_mixin.dart | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/pages/chat/events/message/message_content_builder_mixin.dart b/lib/pages/chat/events/message/message_content_builder_mixin.dart index 0db4a87ff2..4d5b242a91 100644 --- a/lib/pages/chat/events/message/message_content_builder_mixin.dart +++ b/lib/pages/chat/events/message/message_content_builder_mixin.dart @@ -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)[^>]*>.*|]*>', + multiLine: true, + dotAll: true, ); return specialTagRegex.hasMatch(formattedText); }