Skip to content

Commit

Permalink
TF-2426 Add insert link dialog to composer web
Browse files Browse the repository at this point in the history
  • Loading branch information
hieutbui authored and hoangdat committed Jan 17, 2024
1 parent 3b9368a commit bf682aa
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 147 deletions.
23 changes: 23 additions & 0 deletions lib/features/composer/presentation/composer_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import 'package:jmap_dart_client/jmap/mail/email/keyword_identifier.dart';
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
import 'package:model/model.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:rich_text_composer/rich_text_composer.dart';
import 'package:rxdart/rxdart.dart';
Expand Down Expand Up @@ -59,6 +60,7 @@ import 'package:tmail_ui_user/features/composer/presentation/model/save_to_draft
import 'package:tmail_ui_user/features/composer/presentation/model/screen_display_mode.dart';
import 'package:tmail_ui_user/features/composer/presentation/styles/composer_style.dart';
import 'package:tmail_ui_user/features/composer/presentation/widgets/mobile/from_composer_bottom_sheet_builder.dart';
import 'package:tmail_ui_user/features/composer/presentation/widgets/web/insert_link_dialog_widget.dart';
import 'package:tmail_ui_user/features/email/domain/exceptions/email_exceptions.dart';
import 'package:tmail_ui_user/features/email/domain/state/get_email_content_state.dart';
import 'package:tmail_ui_user/features/email/domain/state/transform_html_email_content_state.dart';
Expand Down Expand Up @@ -2186,4 +2188,25 @@ class ComposerController extends BaseController {
..onTextSearchChangedAction((searchText) => _searchIdentities(searchText))
).build();
}

void onEditLinkAction(
BuildContext context,
String? text,
String? url,
bool? isOpenNewTab,
String linkTagId
) async {
Get.dialog(
PointerInterceptor(
child: InsertLinkDialogWidget(
responsiveUtils: responsiveUtils,
editorController: richTextWebController.editorController,
linkTagId: linkTagId,
displayText: text ?? url ?? '',
link: url ?? '',
openNewTab: isOpenNewTab ?? true,
)
)
);
}
}
3 changes: 3 additions & 0 deletions lib/features/composer/presentation/composer_view_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class ComposerView extends GetWidget<ComposerController> {
onEditorTextSizeChanged: controller.richTextWebController.onEditorTextSizeChanged,
width: constraints.maxWidth,
height: constraints.maxHeight,
onEditLink: (text, url, isOpenNewTab, linkTagId) => controller.onEditLinkAction(context, text, url, isOpenNewTab, linkTagId),
)),
),
Align(
Expand Down Expand Up @@ -377,6 +378,7 @@ class ComposerView extends GetWidget<ComposerController> {
onEditorTextSizeChanged: controller.richTextWebController.onEditorTextSizeChanged,
width: constraints.maxWidth,
height: constraints.maxHeight,
onEditLink: (text, url, isOpenNewTab, linkTagId) => controller.onEditLinkAction(context, text, url, isOpenNewTab, linkTagId),
),
if (controller.mailboxDashBoardController.isDraggableAppActive)
PointerInterceptor(
Expand Down Expand Up @@ -604,6 +606,7 @@ class ComposerView extends GetWidget<ComposerController> {
onEditorTextSizeChanged: controller.richTextWebController.onEditorTextSizeChanged,
width: constraints.maxWidth,
height: constraints.maxHeight,
onEditLink: (text, url, isOpenNewTab, linkTagId) => controller.onEditLinkAction(context, text, url, isOpenNewTab, linkTagId),
)),
),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:flutter/material.dart';

class InsertLinkDialogBuilderStyle {
class InsertLinkDialogWidgetStyle {
static const double actionOverFlowButtonSpacing = 8.0;
static const double elevation = 10.0;
static const double widthRatio = 0.3;
Expand Down

This file was deleted.

Loading

0 comments on commit bf682aa

Please sign in to comment.