chore: exlude reply content from HTML token search

This commit is contained in:
ggurdin 2025-06-18 14:06:43 -04:00
parent 7bd9179cda
commit 6c118ba88f
No known key found for this signature in database
GPG key ID: A01CB41737CBB478

View file

@ -185,6 +185,23 @@ class HtmlMessage extends StatelessWidget {
result.add(html.substring(lastEnd)); // Remaining text after last tag
}
final replyTagIndex = result.indexWhere(
(string) => string.contains('<mx-reply>'),
);
if (replyTagIndex != -1) {
final closingReplyTagIndex = result.indexWhere(
(string) => string.contains('</mx-reply>'),
replyTagIndex,
);
if (closingReplyTagIndex != -1) {
result.replaceRange(
replyTagIndex,
closingReplyTagIndex + 1,
[result.sublist(replyTagIndex, closingReplyTagIndex + 1).join()],
);
}
}
for (final PangeaToken token in tokens ?? []) {
final String tokenText = token.text.content;
final substringIndex = result.indexWhere(