TF-2116 Insert image at mouse cursor position

(cherry picked from commit cb347e5077eddb1366daf706aa87eb2291f71aab)
This commit is contained in:
dab246
2023-09-08 11:41:35 +07:00
committed by Dat H. Pham
parent d0744e7560
commit e63a8f7d7f
11 changed files with 164 additions and 53 deletions
@@ -9,12 +9,20 @@ import 'package:tmail_ui_user/features/composer/presentation/model/inline_image.
class RichTextMobileTabletController extends BaseRichTextController {
HtmlEditorApi? htmlEditorApi;
void insertImage(InlineImage image, {double? maxWithEditor}) async {
log('RichTextMobileTabletController::insertImage(): $image | maxWithEditor: $maxWithEditor');
void insertImage(
InlineImage image,
{
double? maxWithEditor,
bool fromFileShare = false
}
) async {
log('RichTextMobileTabletController::insertImage(): $image | maxWithEditor: $maxWithEditor | $fromFileShare');
if (image.source == ImageSource.network) {
htmlEditorApi?.insertImageLink(image.link!);
} else {
await htmlEditorApi?.moveCursorAtLastNode();
if (fromFileShare) {
await htmlEditorApi?.moveCursorAtLastNode();
}
await htmlEditorApi?.insertHtml(image.base64Uri ?? '');
}
}