From 8a5ca2a45eafcd8b9700b8584d1b64ef8953c193 Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Thu, 1 Feb 2024 17:16:01 +0800 Subject: [PATCH] chore: revert ime changes (#701) * Revert "fix: chinese IME" This reverts commit bdc0dc1113cd64805e285e1b650a27ea688028ad. * Revert "fix: windows chinese ime issue (#682)" This reverts commit 3cd56020b169cac1fdfa2331e915f9f0a96302cd. --- .../delta_input_on_non_text_update_impl.dart | 17 ++++++++++------- .../service/ime/non_delta_input_service.dart | 3 +-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/src/editor/editor_component/service/ime/delta_input_on_non_text_update_impl.dart b/lib/src/editor/editor_component/service/ime/delta_input_on_non_text_update_impl.dart index 343b26a70..a2287cad1 100644 --- a/lib/src/editor/editor_component/service/ime/delta_input_on_non_text_update_impl.dart +++ b/lib/src/editor/editor_component/service/ime/delta_input_on_non_text_update_impl.dart @@ -12,13 +12,13 @@ Future onNonTextUpdate( final selection = editorState.selection; if (PlatformExtension.isWindows) { - if (selection != null) { - editorState.updateSelectionWithReason( - Selection.collapsed( - Position( - path: selection.start.path, - offset: nonTextUpdate.selection.start, - ), + if (selection != null && + nonTextUpdate.composing == TextRange.empty && + nonTextUpdate.selection.isCollapsed) { + editorState.selection = Selection.collapsed( + Position( + path: selection.start.path, + offset: nonTextUpdate.selection.start, ), ); } @@ -31,6 +31,9 @@ Future onNonTextUpdate( offset: nonTextUpdate.selection.start, ), ), + extraInfo: { + selectionExtraInfoDoNotAttachTextService: true, + }, ); } } else if (PlatformExtension.isMacOS) { 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 55888b473..58f918704 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 @@ -1,4 +1,3 @@ -import 'dart:io'; import 'dart:math'; import 'package:appflowy_editor/appflowy_editor.dart'; @@ -203,7 +202,7 @@ class NonDeltaTextInputService extends TextInputService with TextInputClient { } // solve the issue where the Chinese IME doesn't continue deleting after the input content has been deleted. - if (Platform.isMacOS && (composingTextRange?.isCollapsed ?? false)) { + if (composingTextRange?.isCollapsed ?? false) { composingTextRange = TextRange.empty; } }