TF-194 Fix style the block quote tag

This commit is contained in:
dab246
2021-10-18 16:34:18 +07:00
committed by Benoit TELLIER
parent 60ffa5ace0
commit 8a06b8ba50
3 changed files with 25 additions and 8 deletions
@@ -0,0 +1,23 @@
import 'package:html/dom.dart';
import 'package:core/presentation/utils/html_transformer/base/dom_transformer.dart';
import 'package:core/presentation/utils/html_transformer/transform_configuration.dart';
class BlockQuotedTransformer extends DomTransformer {
const BlockQuotedTransformer();
@override
void process(Document document, String message, TransformConfiguration configuration) {
final quotedElements = document.getElementsByTagName('blockquote');
for (final quotedElement in quotedElements) {
quotedElement.attributes['style'] = '''
margin-left: 4px;
margin-right: 4px;
padding-left: 8px;
padding-right: 8px;
border-left: 2px solid #eee;
''';
}
}
}
@@ -1,4 +1,5 @@
import 'package:core/presentation/utils/html_transformer/dom/blockquoted_transformers.dart';
import 'package:core/presentation/utils/html_transformer/dom/image_transformers.dart';
import 'package:core/presentation/utils/html_transformer/dom/link_transformers.dart';
import 'package:core/presentation/utils/html_transformer/dom/meta_transformers.dart';
@@ -61,6 +62,7 @@ class TransformConfiguration {
RemoveScriptTransformer(),
ImageTransformer(),
EnsureRelationNoReferrerTransformer(),
BlockQuotedTransformer(),
];
static const List<TextTransformer> standardTextTransformers = [
@@ -67,14 +67,6 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
color: #182952;
font-family: verdana;
}
blockquote {
font: normal helvetica, verdana;
margin-top: 10px;
margin-bottom: 10px;
margin-left: 20px;
padding-left: 15px;
border-left: 5px solid #eee;
}
table {
width: 100%;
max-width: 100%;