diff --git a/lib/pages/chat/events/html_message.dart b/lib/pages/chat/events/html_message.dart index d95edee9f..c60a85919 100644 --- a/lib/pages/chat/events/html_message.dart +++ b/lib/pages/chat/events/html_message.dart @@ -125,14 +125,14 @@ class HtmlMessage extends StatelessWidget { 'rt', 'html', 'body', - // Workaround for https://github.com/krille-chan/fluffychat/issues/507 - 'tg-forward', // #Pangea 'token', 'nontoken', // Pangea# }; + static const Set ignoredHtmlTags = {'mx-reply'}; + /// We add line breaks before these tags: static const Set blockHtmlTags = { 'p', @@ -390,6 +390,11 @@ class HtmlMessage extends StatelessWidget { // We must not render elements nested more than 100 elements deep: if (depth >= 100) return const TextSpan(); + if (node is dom.Element && + ignoredHtmlTags.contains(node.localName?.toLowerCase())) { + return const TextSpan(); + } + // This is a text node or not permitted node, so we render it as text: if (node is! dom.Element || !allowedHtmlTags.contains(node.localName)) { var text = node.text ?? ''; @@ -682,19 +687,21 @@ class HtmlMessage extends StatelessWidget { // Pangea# TextSpan( children: [ - if (node.parent?.localName == 'ul') - // #Pangea - // const TextSpan(text: '• '), - TextSpan(text: '• ', style: existingStyle), - // Pangea# - if (node.parent?.localName == 'ol') - TextSpan( - text: - '${(node.parent?.nodes.whereType().toList().indexOf(node) ?? 0) + (int.tryParse(node.parent?.attributes['start'] ?? '1') ?? 1)}. ', + if (!isCheckbox) ...[ + if (node.parent?.localName == 'ul') // #Pangea - style: existingStyle, - // Pangea# - ), + // const TextSpan(text: '• '), + TextSpan(text: '• ', style: existingStyle), + // Pangea# + if (node.parent?.localName == 'ol') + TextSpan( + text: + '${(node.parent?.nodes.whereType().toList().indexOf(node) ?? 0) + (int.tryParse(node.parent?.attributes['start'] ?? '1') ?? 1)}. ', + // #Pangea + style: existingStyle, + // Pangea# + ), + ], if (node.className == 'task-list-item') WidgetSpan( child: Padding( diff --git a/pubspec.lock b/pubspec.lock index 3b66d1ed9..354937c40 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1384,12 +1384,11 @@ packages: license_checker: dependency: "direct dev" description: - path: "." - ref: HEAD - resolved-ref: "38a65ff5b4b65db092b11dad999081388f75ece8" - url: "https://github.com/krille-chan/license_checker.git" - source: git - version: "1.6.0" + name: license_checker + sha256: "8a35b6946e50811e070ac6fe4717ee431cd1a334e080df2116956b54b0bb0d0f" + url: "https://pub.dev" + source: hosted + version: "1.6.2" linkify: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 287f09756..6fd618733 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -134,9 +134,7 @@ dev_dependencies: import_sorter: ^4.6.0 integration_test: sdk: flutter - # Waiting for https://github.com/rufman/license_checker/pull/47 - license_checker: - git: https://github.com/krille-chan/license_checker.git + license_checker: ^1.6.2 pedantic: ^1.11.0 sentry_dart_plugin: ^1.0.0 translations_cleaner: ^0.0.5