fix: slash not recogized on mobile (#1096)
This commit is contained in:
parent
23618990b2
commit
680222f503
1 changed files with 7 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ import 'package:appflowy_editor/appflowy_editor.dart';
|
|||
import 'package:appflowy_editor/src/editor/editor_component/service/ime/character_shortcut_event_helper.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:universal_platform/universal_platform.dart';
|
||||
|
||||
Future<void> onInsert(
|
||||
TextEditingDeltaInsertion insertion,
|
||||
|
|
@ -12,10 +13,15 @@ Future<void> onInsert(
|
|||
|
||||
final textInserted = insertion.textInserted;
|
||||
|
||||
/// On mobile devices, the "/" is context-sensitive,which means it can't be
|
||||
/// recognized as a standalone character. This requires special handling.
|
||||
final isMobileSlash =
|
||||
UniversalPlatform.isMobile && insertion.textInserted == '/';
|
||||
|
||||
// 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) {
|
||||
if (insertion.composing.isCollapsed || isMobileSlash) {
|
||||
// execute character shortcut events
|
||||
final execution = await executeCharacterShortcutEvent(
|
||||
editorState,
|
||||
|
|
|
|||
Loading…
Reference in a new issue