diff --git a/lib/src/editor/block_component/image_block_component/image_upload_widget.dart b/lib/src/editor/block_component/image_block_component/image_upload_widget.dart index 647a8e5fe..3895c2b97 100644 --- a/lib/src/editor/block_component/image_block_component/image_upload_widget.dart +++ b/lib/src/editor/block_component/image_block_component/image_upload_widget.dart @@ -391,6 +391,13 @@ extension InsertImage on EditorState { ); } + transaction.afterSelection = Selection.collapsed( + Position( + path: node.path.next, + offset: 0, + ), + ); + return apply(transaction); } } diff --git a/lib/src/editor/editor_component/service/ime/non_delta_input_service.dart b/lib/src/editor/editor_component/service/ime/non_delta_input_service.dart index b53990b1c..7cdadbbe6 100644 --- a/lib/src/editor/editor_component/service/ime/non_delta_input_service.dart +++ b/lib/src/editor/editor_component/service/ime/non_delta_input_service.dart @@ -119,6 +119,7 @@ class NonDeltaTextInputService extends TextInputService with TextInputClient { @override void close() { + keepEditorFocusNotifier.value = 0; currentTextEditingValue = null; composingTextRange = null; _textInputConnection?.close(); diff --git a/lib/src/editor/editor_component/service/selection/desktop_selection_service.dart b/lib/src/editor/editor_component/service/selection/desktop_selection_service.dart index fdb609d2d..9f4a1d952 100644 --- a/lib/src/editor/editor_component/service/selection/desktop_selection_service.dart +++ b/lib/src/editor/editor_component/service/selection/desktop_selection_service.dart @@ -100,10 +100,6 @@ class _DesktopSelectionServiceWidgetState @override void updateSelection(Selection? selection) { - if (currentSelection.value == selection) { - return; - } - currentSelection.value = selection; editorState.updateSelectionWithReason( selection, diff --git a/lib/src/editor/selection_menu/selection_menu_service.dart b/lib/src/editor/selection_menu/selection_menu_service.dart index c98c9e58f..33a186b8f 100644 --- a/lib/src/editor/selection_menu/selection_menu_service.dart +++ b/lib/src/editor/selection_menu/selection_menu_service.dart @@ -52,6 +52,8 @@ class SelectionMenu extends SelectionMenuService { editorState.service.selectionServiceKey.currentState == null; if (!isSelectionDisposed) { final selectionService = editorState.service.selectionService; + // focus to reload the selection after the menu dismissed. + editorState.selection = editorState.selection; selectionService.currentSelection.removeListener(_onSelectionChange); } }