TF-2532 Invoke request focus editor when insert inline image

This commit is contained in:
dab246
2024-02-02 16:23:54 +07:00
committed by Dat H. Pham
parent 800241cef0
commit 797a14c483
4 changed files with 13 additions and 9 deletions
@@ -14,11 +14,13 @@ class RichTextMobileTabletController extends BaseRichTextController {
final RichTextController richTextController = RichTextController();
void insertImage(InlineImage inlineImage) async {
if (inlineImage.fileInfo.isShared == true) {
await htmlEditorApi?.moveCursorAtLastNode();
bool isEditorFocused = await htmlEditorApi?.hasFocus() ?? false;
log('RichTextMobileTabletController::insertImage: isEditorFocused = $isEditorFocused');
if (!isEditorFocused) {
await htmlEditorApi?.requestFocusLastChild();
}
if (inlineImage.base64Uri?.isNotEmpty == true) {
await htmlEditorApi?.insertHtml(inlineImage.base64Uri!);
await htmlEditorApi?.insertHtml('${inlineImage.base64Uri ?? ''}<br/><br/>');
}
}
@@ -170,9 +170,6 @@ class UploadController extends BaseController {
cid: uuid.v1()
);
final uploadFileState = _uploadingStateInlineFiles.getUploadFileStateById(success.uploadId);
log('UploadController::_handleProgressUploadInlineImageStateStream:uploadId: ${uploadFileState?.uploadTaskId} | fromFileShared: ${uploadFileState?.file?.isShared}');
_uploadingStateInlineFiles.updateElementByUploadTaskId(
success.uploadId,
(currentState) {
+3 -3
View File
@@ -433,11 +433,11 @@ packages:
source: path
version: "1.0.0+1"
enough_html_editor:
dependency: transitive
dependency: "direct overridden"
description:
path: "."
ref: cnb_supported
resolved-ref: "6409f47b01c5992906971f2d8fdb8be3278bf787"
ref: cherry-pick-add-attachment-app-bar
resolved-ref: "195c74a0d65fc95226dbd257a40bc8c0c55f9a3e"
url: "https://github.com/linagora/enough_html_editor.git"
source: git
version: "0.0.5"
+5
View File
@@ -280,6 +280,11 @@ dependency_overrides:
url: https://github.com/linagora/flutter_file_picker
ref: email_supported_5.3.1
enough_html_editor:
git:
url: https://github.com/linagora/enough_html_editor.git
ref: cherry-pick-add-attachment-app-bar
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec