-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: insert emoji using ":" command #3025
feat: insert emoji using ":" command #3025
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3025 +/- ##
===========================================
- Coverage 68.70% 13.00% -55.71%
===========================================
Files 426 432 +6
Lines 20241 20665 +424
===========================================
- Hits 13907 2687 -11220
- Misses 6334 17978 +11644
Flags with carried forward coverage won't be shown. Click here to find out more.
|
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart
Outdated
Show resolved
Hide resolved
...er/lib/plugins/document/presentation/editor_plugins/emoji_shortcut/emoji_picker_builder.dart
Outdated
Show resolved
Hide resolved
...er/lib/plugins/document/presentation/editor_plugins/emoji_shortcut/emoji_picker_builder.dart
Outdated
Show resolved
Hide resolved
...er/lib/plugins/document/presentation/editor_plugins/emoji_shortcut/emoji_picker_builder.dart
Outdated
Show resolved
Hide resolved
@Xazin I made the suggested changes |
for (int i = 0; i < _emojiController.text.length + 1; i++) { | ||
_deleteLastCharacters(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < _emojiController.text.length + 1; i++) { | |
_deleteLastCharacters(); | |
} | |
_deleteLastCharacters(_emojiController.text.length); |
@@ -8,6 +8,8 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:flutter_bloc/flutter_bloc.dart'; | |||
|
|||
import 'editor_plugins/emoji_shortcut/emoji_shortcut_service.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this header to editor_plugins/plugins.dart
.
ShortcutEmojiPickerViewState createState() => ShortcutEmojiPickerViewState(); | ||
} | ||
|
||
@visibleForTesting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to add @visibleForTesting
@@ -0,0 +1,92 @@ | |||
import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test will not be executed in the CI job. Please add this test to document_test_runner.dart
.
final resultsFilterCount = 35; | ||
|
||
@override | ||
void initState() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call the super.initState();
at the beginning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@override
void initState() {
super.initState();
final initCategory = widget.state.categoryEmoji.indexWhere(
(element) => element.category == widget.config.initCategory,
);
final initialIndex = initCategory != -1 ? initCategory : 0;
_tabController = TabController(
initialIndex: initialIndex,
length: widget.state.categoryEmoji.length,
vsync: this,
);
_pageController = PageController(
initialPage: initialIndex,
);
_emojiFocusNode.requestFocus();
WidgetsBinding.instance.addPostFrameCallback((_) {
_focusNode.requestFocus();
});
}
super.dispose(); | ||
} | ||
|
||
bool get isEmojiSearching => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this getter before the initState
function.
searchEmojiList.emoji.isNotEmpty || _emojiController.text.isNotEmpty; | ||
|
||
KeyEventResult _onKey(FocusNode node, RawKeyEvent event) { | ||
final CategoryEmoji catEmoji = isEmojiSearching |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to declare the type. remove the CategoryEmoji
.
} else if (event.logicalKey == LogicalKeyboardKey.arrowUp) { | ||
newSelectedIndex -= 7; | ||
} else if (event.logicalKey == LogicalKeyboardKey.arrowDown) { | ||
newSelectedIndex += 7; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why using 7? Please make it configurable.
return KeyEventResult.ignored; | ||
} | ||
|
||
_searchEmoji() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add return type.
widget.editorState.apply(transaction); | ||
} | ||
|
||
void _insertText(String text) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this function. use widget.editorState.insertTextAtCurrentSelection(text);
instead
|
…m/rizwan3395/AppFlowy into use_character_shortcut_for_emojis
Could this plugin be considered an editor one or AppFlowy specific? |
Feature Preview
AppFlowy_o9xHZRPzJ9.mp4
PR Checklist
This PR fixes issue #2797