diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_service.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_service.dart index 01a14524ac..498438e6be 100644 --- a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_service.dart +++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_service.dart @@ -111,7 +111,7 @@ class SelectionMenu implements SelectionMenuService { Overlay.of(context)?.insert(_selectionMenuEntry!); - editorState.service.keyboardService?.disable(); + editorState.service.keyboardService?.disable(showCursor: true); editorState.service.scrollService?.disable(); selectionService.currentSelection.addListener(_onSelectionChange); } diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/keyboard_service.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/keyboard_service.dart index d5154bc2b5..fad31c711e 100644 --- a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/keyboard_service.dart +++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/keyboard_service.dart @@ -35,7 +35,7 @@ abstract class AppFlowyKeyboardService { /// you can disable the keyboard service of flowy_editor. /// But you need to call the `enable` function to restore after exiting /// your custom component, otherwise the keyboard service will fails. - void disable(); + void disable({bool showCursor = false}); } /// Process keyboard events @@ -62,6 +62,7 @@ class _AppFlowyKeyboardState extends State final FocusNode _focusNode = FocusNode(debugLabel: 'flowy_keyboard_service'); bool isFocus = true; + bool showCursor = false; @override List get shortcutEvents => widget.shortcutEvents; @@ -101,8 +102,9 @@ class _AppFlowyKeyboardState extends State } @override - void disable() { + void disable({bool showCursor = false}) { isFocus = false; + this.showCursor = showCursor; _focusNode.unfocus(); } @@ -137,8 +139,10 @@ class _AppFlowyKeyboardState extends State void _onFocusChange(bool value) { Log.keyboard.debug('on keyboard event focus change $value'); isFocus = value; - if (!value) { + if (!value && !showCursor) { widget.editorState.service.selectionService.clearCursor(); + } else { + showCursor = false; } } diff --git a/frontend/app_flowy/packages/appflowy_editor_plugins/lib/src/emoji_picker/emoji_menu_item.dart b/frontend/app_flowy/packages/appflowy_editor_plugins/lib/src/emoji_picker/emoji_menu_item.dart index 6ecd09328d..810d497541 100644 --- a/frontend/app_flowy/packages/appflowy_editor_plugins/lib/src/emoji_picker/emoji_menu_item.dart +++ b/frontend/app_flowy/packages/appflowy_editor_plugins/lib/src/emoji_picker/emoji_menu_item.dart @@ -5,7 +5,7 @@ import 'package:flutter/services.dart'; import 'emoji_picker.dart'; SelectionMenuItem emojiMenuItem = SelectionMenuItem( - name: () => 'emoji', + name: () => 'Emoji', icon: (editorState, onSelected) => Icon( Icons.emoji_emotions_outlined, color: onSelected