From d0744e75603a0ae0c38bcf129e69939524ffccfd Mon Sep 17 00:00:00 2001 From: dab246 Date: Fri, 8 Sep 2023 03:28:14 +0700 Subject: [PATCH] TF-2116 Support expanded/collapsed for Signature in composer (cherry picked from commit 3ff79dcc8b43b9ae9af0c9b8f5133b5bfd210d18) --- .../utils/html_transformer/html_utils.dart | 72 +++++++++++++++++++ .../mixin/composer_loading_mixin.dart | 45 ------------ pubspec.lock | 10 +-- pubspec.yaml | 7 +- 4 files changed, 83 insertions(+), 51 deletions(-) delete mode 100644 lib/features/composer/presentation/mixin/composer_loading_mixin.dart diff --git a/core/lib/presentation/utils/html_transformer/html_utils.dart b/core/lib/presentation/utils/html_transformer/html_utils.dart index 221b7de53..14b371aad 100644 --- a/core/lib/presentation/utils/html_transformer/html_utils.dart +++ b/core/lib/presentation/utils/html_transformer/html_utils.dart @@ -134,6 +134,42 @@ class HtmlUtils { div.tmail-signature { text-align: left; + margin: 16px 0px 16px 0px; + } + + .tmail-signature-button, + .tmail-signature-button * { + box-sizing: border-box; + } + + .tmail-signature-button { + padding: 6px 40px 6px 16px; + border-radius: 4px; + color: #fff; + background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.0003 11.8319L5.53383 8.1098C5.18027 7.81516 4.6548 7.86293 4.36016 8.21649C4.06553 8.57006 4.1133 9.09553 4.46686 9.39016L9.46686 13.5568C9.7759 13.8144 10.2248 13.8144 10.5338 13.5568L15.5338 9.39016C15.8874 9.09553 15.9352 8.57006 15.6405 8.21649C15.3459 7.86293 14.8204 7.81516 14.4669 8.1098L10.0003 11.8319Z' fill='%23AEAEC0'/%3E%3C/svg%3E%0A"); + background-repeat: no-repeat; + background-position: right 16px center; + background-color: #FFFFFF; + border-radius: 36px; + border-style: solid; + border-color: var(--m-3-syslight-outline-shadow-outline-variant, #cac4d0); + border-width: 0.5px; + flex-direction: row; + gap: 8px; + align-items: center; + justify-content: flex-start; + flex-shrink: 0; + position: relative; + cursor: pointer; + color: var(--m-3-syslight-tetirary-tertiary, #8c9caf); + text-align: left; + font: var(--m-3-body-large-2, 400 17px/24px "Inter", sans-serif); + } + + .tmail-signature-content { + padding: 12px; + display: none; + overflow: hidden; } '''; @@ -145,6 +181,42 @@ class HtmlUtils { div.tmail-signature { text-align: left; + margin: 16px 0px 16px 0px; + } + + .tmail-signature-button, + .tmail-signature-button * { + box-sizing: border-box; + } + + .tmail-signature-button { + padding: 6px 40px 6px 16px; + border-radius: 4px; + color: #fff; + background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.0003 11.8319L5.53383 8.1098C5.18027 7.81516 4.6548 7.86293 4.36016 8.21649C4.06553 8.57006 4.1133 9.09553 4.46686 9.39016L9.46686 13.5568C9.7759 13.8144 10.2248 13.8144 10.5338 13.5568L15.5338 9.39016C15.8874 9.09553 15.9352 8.57006 15.6405 8.21649C15.3459 7.86293 14.8204 7.81516 14.4669 8.1098L10.0003 11.8319Z' fill='%23AEAEC0'/%3E%3C/svg%3E%0A"); + background-repeat: no-repeat; + background-position: right 16px center; + background-color: #FFFFFF; + border-radius: 36px; + border-style: solid; + border-color: var(--m-3-syslight-outline-shadow-outline-variant, #cac4d0); + border-width: 0.5px; + flex-direction: row; + gap: 8px; + align-items: center; + justify-content: flex-start; + flex-shrink: 0; + position: relative; + cursor: pointer; + color: var(--m-3-syslight-tetirary-tertiary, #8c9caf); + text-align: left; + font: var(--m-3-body-large-2, 400 17px/24px "Inter", sans-serif); + } + + .tmail-signature-content { + padding: 12px; + display: none; + overflow: hidden; } '''; } else { diff --git a/lib/features/composer/presentation/mixin/composer_loading_mixin.dart b/lib/features/composer/presentation/mixin/composer_loading_mixin.dart deleted file mode 100644 index 01091239f..000000000 --- a/lib/features/composer/presentation/mixin/composer_loading_mixin.dart +++ /dev/null @@ -1,45 +0,0 @@ - -import 'package:core/presentation/extensions/color_extension.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:tmail_ui_user/features/composer/domain/state/download_image_as_base64_state.dart'; -import 'package:tmail_ui_user/features/composer/presentation/composer_controller.dart'; -import 'package:tmail_ui_user/features/upload/domain/state/attachment_upload_state.dart'; - -mixin ComposerLoadingMixin { - - Widget _loadingWidgetWithSizeColor({double? size, Color? color}) { - return Center(child: Container( - margin: const EdgeInsets.all(10), - width: size ?? 24, - height: size ?? 24, - child: CircularProgressIndicator(color: color ?? AppColor.primaryColor))); - } - - Widget buildInlineLoadingView(ComposerController controller) { - return Obx(() => controller.uploadController.uploadInlineViewState.value.fold( - (failure) { - return controller.viewState.value.fold( - (failure) => const SizedBox.shrink(), - (success) { - if (success is DownloadingImageAsBase64) { - return _loadingWidgetWithSizeColor(); - } - return const SizedBox.shrink(); - }); - }, - (success) { - if (success is UploadingAttachmentUploadState) { - return _loadingWidgetWithSizeColor(); - } - return controller.viewState.value.fold( - (failure) => const SizedBox.shrink(), - (success) { - if (success is DownloadingImageAsBase64) { - return _loadingWidgetWithSizeColor(); - } - return const SizedBox.shrink(); - }); - })); - } -} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 1c3ea1be6..1bbdd4494 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -369,11 +369,11 @@ packages: source: hosted version: "2.0.0" enough_html_editor: - dependency: transitive + dependency: "direct overridden" description: path: "." - ref: email_supported - resolved-ref: ed465d707389bbb959ce2898b899fabb9e9608ed + ref: "improvement/support-expanded-collapsed-signature" + resolved-ref: f69ea3c0d84c32fe291b1b6092a30af1544a3038 url: "https://github.com/linagora/enough_html_editor.git" source: git version: "0.0.5" @@ -913,8 +913,8 @@ packages: dependency: "direct main" description: path: "." - ref: email_supported - resolved-ref: "11cf3928c18a43ad29f6dfb3d3b0a712a41ec816" + ref: "improvement/support-expanded-collapsed-signature" + resolved-ref: "96ae5c4ce7c2f5b84bd481df3aa02b38ac527a1d" url: "https://github.com/linagora/html-editor-enhanced.git" source: git version: "2.5.1" diff --git a/pubspec.yaml b/pubspec.yaml index e59e2d878..44a4b353a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -54,7 +54,7 @@ dependencies: html_editor_enhanced: git: url: https://github.com/linagora/html-editor-enhanced.git - ref: email_supported + ref: improvement/support-expanded-collapsed-signature jmap_dart_client: git: @@ -232,6 +232,11 @@ dependency_overrides: pointer_interceptor: 0.9.1 + enough_html_editor: + git: + url: https://github.com/linagora/enough_html_editor.git + ref: improvement/support-expanded-collapsed-signature + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec