Skip to content

Commit

Permalink
TF-2426 Add onEditLink callback to editor widget
Browse files Browse the repository at this point in the history
  • Loading branch information
hieutbui authored and dab246 committed Jun 13, 2024
1 parent b3dcaf1 commit 42a19fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
final double? width;
final double? height;
final VoidCallback? onDragEnter;
final OnEditLink? onEditLink;

const WebEditorView({
super.key,
Expand All @@ -47,6 +48,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
this.width,
this.height,
this.onDragEnter,
this.onEditLink,
});

@override
Expand All @@ -73,6 +75,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
width: width,
height: height,
onDragEnter: onDragEnter,
onEditLink: onEditLink,
);
case EmailActionType.editDraft:
case EmailActionType.editSendingEmail:
Expand All @@ -98,6 +101,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
width: width,
height: height,
onDragEnter: onDragEnter,
onEditLink: onEditLink,
),
(success) {
if (success is GetEmailContentLoading) {
Expand All @@ -123,6 +127,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
width: width,
height: height,
onDragEnter: onDragEnter,
onEditLink: onEditLink,
);
}
}
Expand Down Expand Up @@ -155,6 +160,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
width: width,
height: height,
onDragEnter: onDragEnter,
onEditLink: onEditLink,
);
},
(success) {
Expand Down Expand Up @@ -183,6 +189,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
width: width,
height: height,
onDragEnter: onDragEnter,
onEditLink: onEditLink,
);
}
}
Expand All @@ -202,6 +209,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
width: width,
height: height,
onDragEnter: onDragEnter,
onEditLink: onEditLink,
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ typedef OnInitialContentEditorAction = Function(String text);
typedef OnMouseDownEditorAction = Function(BuildContext context);
typedef OnEditorSettingsChange = Function(EditorSettings settings);
typedef OnEditorTextSizeChanged = Function(int? size);
typedef OnEditLink = Function(String? text, String? url, bool? isOpenNewTab, String linkTagId)?;

class WebEditorWidget extends StatefulWidget {

Expand All @@ -28,6 +29,7 @@ class WebEditorWidget extends StatefulWidget {
final double? width;
final double? height;
final VoidCallback? onDragEnter;
final OnEditLink? onEditLink;

const WebEditorWidget({
super.key,
Expand All @@ -44,6 +46,7 @@ class WebEditorWidget extends StatefulWidget {
this.width,
this.height,
this.onDragEnter,
this.onEditLink,
});

@override
Expand Down Expand Up @@ -176,6 +179,7 @@ class _WebEditorState extends State<WebEditorWidget> {
),
onDragEnter: widget.onDragEnter,
onDragLeave: () {},
onEditLink: widget.onEditLink
),
);
}
Expand Down

0 comments on commit 42a19fd

Please sign in to comment.