TF-806 open new tab when click link or tags a
This commit is contained in:
@@ -16,6 +16,7 @@ class MessageContentTransformer {
|
||||
DioClient? dioClient
|
||||
}
|
||||
) async {
|
||||
await _addTargetBlankInTagA(document);
|
||||
await Future.wait([
|
||||
if (configuration.domTransformers.isNotEmpty)
|
||||
...configuration.domTransformers.map((domTransformer) async =>
|
||||
@@ -26,6 +27,13 @@ class MessageContentTransformer {
|
||||
]);
|
||||
}
|
||||
|
||||
Future _addTargetBlankInTagA(Document document) async {
|
||||
final elements = document.querySelectorAll('a');
|
||||
await Future.wait(elements.map((element) async {
|
||||
element.attributes['target'] = '_blank';
|
||||
}));
|
||||
}
|
||||
|
||||
Future<Document> toDocument(
|
||||
String message,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user