Add div tag with markdown style when isTextTable is true for email content text/plain

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-04-04 16:52:19 +07:00
committed by Dat H. Pham
parent 868ec1bc8e
commit 75b675002c
2 changed files with 9 additions and 1 deletions
@@ -1,12 +1,18 @@
import 'dart:convert';
import 'package:core/presentation/utils/html_transformer/base/text_transformer.dart';
import 'package:core/utils/html/html_template.dart';
import 'package:core/utils/string_convert.dart';
class PersistPreformattedTextTransformer extends TextTransformer {
const PersistPreformattedTextTransformer();
@override
String process(String text, HtmlEscape htmlEscape) {
return '<pre>$text</pre>';
if (StringConvert.isTextTable(text)) {
return '<div style="${HtmlTemplate.markDownAndASCIIArtStyleCSS}">$text</div>';
} else {
return text;
}
}
}
+2
View File
@@ -216,4 +216,6 @@ class HtmlTemplate {
}
</style>
''';
static const String markDownAndASCIIArtStyleCSS = 'display: block; font-family: monospace; white-space: pre; margin: 1em 0px;';
}