Skip to content

Commit

Permalink
fix: image block revamp issues (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 authored Oct 6, 2023
1 parent e996c92 commit af8d96b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,13 @@ extension InsertImage on EditorState {
);
}

transaction.afterSelection = Selection.collapsed(
Position(
path: node.path.next,
offset: 0,
),
);

return apply(transaction);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class NonDeltaTextInputService extends TextInputService with TextInputClient {

@override
void close() {
keepEditorFocusNotifier.value = 0;
currentTextEditingValue = null;
composingTextRange = null;
_textInputConnection?.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ class _DesktopSelectionServiceWidgetState

@override
void updateSelection(Selection? selection) {
if (currentSelection.value == selection) {
return;
}

currentSelection.value = selection;
editorState.updateSelectionWithReason(
selection,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/editor/selection_menu/selection_menu_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit af8d96b

Please sign in to comment.