TF-3035 Show and hide signature toggle button on draft
This commit is contained in:
@@ -61,9 +61,7 @@ class ComposerRepositoryImpl extends ComposerRepository {
|
||||
emailAttachments.addAll(tupleContentInlineAttachments.value2);
|
||||
}
|
||||
|
||||
if (createEmailRequest.draftsMailboxId == null) {
|
||||
emailContent = await _removeCollapsedExpandedSignatureEffect(emailContent: emailContent);
|
||||
}
|
||||
emailContent = await _removeCollapsedExpandedSignatureEffect(emailContent: emailContent);
|
||||
|
||||
final userAgent = await _applicationManager.generateApplicationUserAgent();
|
||||
final emailBodyPartId = PartId(_uuid.v1());
|
||||
|
||||
@@ -15,6 +15,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:html/parser.dart';
|
||||
import 'package:html_editor_enhanced/html_editor.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
||||
@@ -1437,6 +1438,18 @@ class ComposerController extends BaseController with DragDropFileMixin implement
|
||||
identitySelected.value = selectedIdentityFromHeader;
|
||||
}
|
||||
|
||||
Future<void> restoreCollapsibleButton(String? emailContent) async {
|
||||
try {
|
||||
if (emailContent == null) return;
|
||||
final emailDocument = parse(emailContent);
|
||||
final signature = emailDocument.querySelector('div.tmail-signature');
|
||||
if (signature == null) return;
|
||||
await _applySignature(signature.innerHtml);
|
||||
} catch (e) {
|
||||
logError('ComposerController::_restoreCollapsibleButton: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void _transformHtmlEmailContent(String? emailContent) {
|
||||
emailContentsViewState(Right(TransformHtmlEmailContentLoading()));
|
||||
if (emailContent?.isEmpty == true) {
|
||||
|
||||
@@ -202,6 +202,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
||||
base64: base64,
|
||||
uploadError: uploadError
|
||||
),
|
||||
onInitialContentLoadComplete: controller.restoreCollapsibleButton,
|
||||
)),
|
||||
),
|
||||
),
|
||||
@@ -454,6 +455,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
||||
base64: base64,
|
||||
uploadError: uploadError
|
||||
),
|
||||
onInitialContentLoadComplete: controller.restoreCollapsibleButton,
|
||||
);
|
||||
}),
|
||||
),
|
||||
@@ -724,6 +726,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
||||
base64: base64,
|
||||
uploadError: uploadError
|
||||
),
|
||||
onInitialContentLoadComplete: controller.restoreCollapsibleButton,
|
||||
)),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -33,6 +33,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
|
||||
final OnDragEnterListener? onDragEnter;
|
||||
final OnPasteImageSuccessAction? onPasteImageSuccessAction;
|
||||
final OnPasteImageFailureAction? onPasteImageFailureAction;
|
||||
final OnInitialContentLoadComplete? onInitialContentLoadComplete;
|
||||
|
||||
const WebEditorView({
|
||||
super.key,
|
||||
@@ -52,6 +53,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
|
||||
this.onDragEnter,
|
||||
this.onPasteImageSuccessAction,
|
||||
this.onPasteImageFailureAction,
|
||||
this.onInitialContentLoadComplete,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -80,6 +82,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
|
||||
onDragEnter: onDragEnter,
|
||||
onPasteImageSuccessAction: onPasteImageSuccessAction,
|
||||
onPasteImageFailureAction: onPasteImageFailureAction,
|
||||
onInitialContentLoadComplete: onInitialContentLoadComplete,
|
||||
);
|
||||
case EmailActionType.editDraft:
|
||||
case EmailActionType.editSendingEmail:
|
||||
@@ -107,6 +110,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
|
||||
onDragEnter: onDragEnter,
|
||||
onPasteImageSuccessAction: onPasteImageSuccessAction,
|
||||
onPasteImageFailureAction: onPasteImageFailureAction,
|
||||
onInitialContentLoadComplete: onInitialContentLoadComplete,
|
||||
),
|
||||
(success) {
|
||||
if (success is GetEmailContentLoading || success is RestoringEmailInlineImages) {
|
||||
@@ -134,6 +138,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
|
||||
onDragEnter: onDragEnter,
|
||||
onPasteImageSuccessAction: onPasteImageSuccessAction,
|
||||
onPasteImageFailureAction: onPasteImageFailureAction,
|
||||
onInitialContentLoadComplete: onInitialContentLoadComplete,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -168,6 +173,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
|
||||
onDragEnter: onDragEnter,
|
||||
onPasteImageSuccessAction: onPasteImageSuccessAction,
|
||||
onPasteImageFailureAction: onPasteImageFailureAction,
|
||||
onInitialContentLoadComplete: onInitialContentLoadComplete,
|
||||
);
|
||||
},
|
||||
(success) {
|
||||
@@ -198,6 +204,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
|
||||
onDragEnter: onDragEnter,
|
||||
onPasteImageSuccessAction: onPasteImageSuccessAction,
|
||||
onPasteImageFailureAction: onPasteImageFailureAction,
|
||||
onInitialContentLoadComplete: onInitialContentLoadComplete,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -219,6 +226,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
|
||||
onDragEnter: onDragEnter,
|
||||
onPasteImageSuccessAction: onPasteImageSuccessAction,
|
||||
onPasteImageFailureAction: onPasteImageFailureAction,
|
||||
onInitialContentLoadComplete: onInitialContentLoadComplete,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ typedef OnPasteImageFailureAction = Function(
|
||||
List<FileUpload>? listFileUpload,
|
||||
String? base64,
|
||||
UploadError uploadError);
|
||||
typedef OnInitialContentLoadComplete = Function(String text);
|
||||
|
||||
class WebEditorWidget extends StatefulWidget {
|
||||
|
||||
@@ -36,6 +37,7 @@ class WebEditorWidget extends StatefulWidget {
|
||||
final OnDragEnterListener? onDragEnter;
|
||||
final OnPasteImageSuccessAction? onPasteImageSuccessAction;
|
||||
final OnPasteImageFailureAction? onPasteImageFailureAction;
|
||||
final OnInitialContentLoadComplete? onInitialContentLoadComplete;
|
||||
|
||||
const WebEditorWidget({
|
||||
super.key,
|
||||
@@ -54,6 +56,7 @@ class WebEditorWidget extends StatefulWidget {
|
||||
this.onDragEnter,
|
||||
this.onPasteImageSuccessAction,
|
||||
this.onPasteImageFailureAction,
|
||||
this.onInitialContentLoadComplete,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -190,6 +193,7 @@ class _WebEditorState extends State<WebEditorWidget> {
|
||||
onDragLeave: (_) {},
|
||||
onImageUpload: widget.onPasteImageSuccessAction,
|
||||
onImageUploadError: widget.onPasteImageFailureAction,
|
||||
onInitialTextLoadComplete: widget.onInitialContentLoadComplete,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1107,7 +1107,7 @@ packages:
|
||||
description:
|
||||
path: "."
|
||||
ref: main
|
||||
resolved-ref: cc63bc2e8ddf9fad93b4f1dd6e0a04d17937ba05
|
||||
resolved-ref: "3274d7fe8c711e7466890b6a3948e9708877ca4a"
|
||||
url: "https://github.com/linagora/html-editor-enhanced.git"
|
||||
source: git
|
||||
version: "3.1.1"
|
||||
|
||||
Reference in New Issue
Block a user