File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -673,13 +673,17 @@ class Room {
673
673
final html = markdown (event['body' ],
674
674
getEmotePacks: () => getImagePacksFlat (ImagePackUsage .emoticon),
675
675
getMention: getMention);
676
+
677
+ final formatText = event['body' ]
678
+ .toString ()
679
+ .trim ()
680
+ .replaceAll (RegExp (r'(<br />)+$' ), '' )
681
+ .convertLinebreaksToBr ()
682
+ .replaceAll (RegExp (r'<br />\n?' ), '\n ' );
683
+
676
684
// if the decoded html is the same as the body, there is no need in sending a formatted message
677
685
if (HtmlUnescape ().convert (html.replaceAll (RegExp (r'<br />\n?' ), '\n ' )) !=
678
- event['body' ]
679
- .toString ()
680
- .trim ()
681
- .replaceAll (RegExp (r'(<br />)+$' ), '' )
682
- .convertLinebreaksToBr ()) {
686
+ formatText) {
683
687
event['format' ] = 'org.matrix.custom.html' ;
684
688
event['formatted_body' ] = html;
685
689
}
You can’t perform that action at this time.
0 commit comments