diff --git a/lib/src/editor/editor_component/service/ime/delta_input_on_insert_impl.dart b/lib/src/editor/editor_component/service/ime/delta_input_on_insert_impl.dart index cd14f5072..0ab26dd13 100644 --- a/lib/src/editor/editor_component/service/ime/delta_input_on_insert_impl.dart +++ b/lib/src/editor/editor_component/service/ime/delta_input_on_insert_impl.dart @@ -12,15 +12,20 @@ Future onInsert( final textInserted = insertion.textInserted; - // character shortcut events - final execution = await executeCharacterShortcutEvent( - editorState, - textInserted, - characterShortcutEvents, - ); + // In France, the backtick key is used to toggle a character style. + // We should prevent the execution of character shortcut events when the + // composing range is not collapsed. + if (insertion.composing.isCollapsed) { + // execute character shortcut events + final execution = await executeCharacterShortcutEvent( + editorState, + textInserted, + characterShortcutEvents, + ); - if (execution) { - return; + if (execution) { + return; + } } var selection = editorState.selection; 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 f1581e078..ffc3eae0d 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 @@ -5,7 +5,10 @@ import 'package:flutter/services.dart'; Future onNonTextUpdate( TextEditingDeltaNonTextUpdate nonTextUpdate, EditorState editorState, + List characterShortcutEvents, ) async { + AppFlowyEditorLog.input.debug('onNonTextUpdate: $nonTextUpdate'); + // update the selection on Windows // // when typing characters with CJK IME on Windows, a non-text update is sent diff --git a/lib/src/editor/editor_component/service/keyboard_service_widget.dart b/lib/src/editor/editor_component/service/keyboard_service_widget.dart index 80d095a52..a7c2f37aa 100644 --- a/lib/src/editor/editor_component/service/keyboard_service_widget.dart +++ b/lib/src/editor/editor_component/service/keyboard_service_widget.dart @@ -79,6 +79,7 @@ class KeyboardServiceWidgetState extends State onNonTextUpdate: (nonTextUpdate) async => await onNonTextUpdate( nonTextUpdate, editorState, + widget.characterShortcutEvents, ), onPerformAction: (action) async => await onPerformAction( action, diff --git a/test/editor/editor_component/ime/delta_input_on_non_text_update_impl_test.dart b/test/editor/editor_component/ime/delta_input_on_non_text_update_impl_test.dart index 346f39a27..4003b59a6 100644 --- a/test/editor/editor_component/ime/delta_input_on_non_text_update_impl_test.dart +++ b/test/editor/editor_component/ime/delta_input_on_non_text_update_impl_test.dart @@ -14,6 +14,7 @@ void main() { composing: TextRange(start: 0, end: 3), ), EditorState.blank(), + [], ); }); });