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 37332818c..d7daac0bf 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 @@ -123,7 +123,10 @@ class _DesktopSelectionServiceWidgetState } currentSelection.value = selection; - editorState.selection = selection; + editorState.updateSelectionWithReason( + selection, + reason: SelectionUpdateReason.uiEvent, + ); } void _updateSelection() { @@ -239,16 +242,18 @@ class _DesktopSelectionServiceWidgetState clearSelection(); return; } - if (selectable.cursorStyle == CursorStyle.verticalLine) { - editorState.selection = Selection.collapsed( - selectable.getPositionInOffset(offset), - ); - } else { - editorState.selection = Selection( - start: selectable.start(), - end: selectable.end(), - ); - } + final selection = selectable.cursorStyle == CursorStyle.verticalLine + ? Selection.collapsed( + selectable.getPositionInOffset(offset), + ) + : Selection( + start: selectable.start(), + end: selectable.end(), + ); + editorState.updateSelectionWithReason( + selection, + reason: SelectionUpdateReason.uiEvent, + ); } void _onDoubleTapDown(TapDownDetails details) {