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:
+7
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,4 +216,6 @@ class HtmlTemplate {
|
||||
}
|
||||
</style>
|
||||
''';
|
||||
|
||||
static const String markDownAndASCIIArtStyleCSS = 'display: block; font-family: monospace; white-space: pre; margin: 1em 0px;';
|
||||
}
|
||||
Reference in New Issue
Block a user