From 8061262c96b05e056813f996a1074dd395963311 Mon Sep 17 00:00:00 2001 From: Aman Negi Date: Sat, 18 Feb 2023 16:45:14 +0530 Subject: [PATCH] feat(shortcuts): Add Shortcuts to Help Menu - Added option of shorcuts in help menu - Clicking on the shortcut leads to the `Shortcuts.md` file --- frontend/app_flowy/assets/translations/en.json | 1 + .../widgets/float_bubble/question_bubble.dart | 13 ++++++++++++- .../shortcut_event/built_in_shortcut_events.dart | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/app_flowy/assets/translations/en.json b/frontend/app_flowy/assets/translations/en.json index 50f04014f7e3c..07ffbfa2235ff 100644 --- a/frontend/app_flowy/assets/translations/en.json +++ b/frontend/app_flowy/assets/translations/en.json @@ -71,6 +71,7 @@ }, "dialogCreatePageNameHint": "Page name", "questionBubble": { + "shortcuts": "Shortcuts", "whatsNew": "What's new?", "help": "Help & Support", "debug": { diff --git a/frontend/app_flowy/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart b/frontend/app_flowy/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart index 0020ca4004611..024d7e5cef63c 100644 --- a/frontend/app_flowy/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart +++ b/frontend/app_flowy/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart @@ -64,6 +64,10 @@ class BubbleActionList extends StatelessWidget { case BubbleAction.debug: _DebugToast().show(); break; + case BubbleAction.shortcuts: + _launchURL( + "https://github.com/AppFlowy-IO/AppFlowy-Docs/blob/main/essential-documentation/shortcuts.md"); + break; } } @@ -160,7 +164,7 @@ class FlowyVersionDescription extends CustomActionCell { } } -enum BubbleAction { whatsNews, help, debug } +enum BubbleAction { whatsNews, help, debug, shortcuts } class BubbleActionWrapper extends ActionCell { final BubbleAction inner; @@ -182,6 +186,11 @@ extension QuestionBubbleExtension on BubbleAction { return LocaleKeys.questionBubble_help.tr(); case BubbleAction.debug: return LocaleKeys.questionBubble_debug_name.tr(); + case BubbleAction.shortcuts: + // return LocaleKeys.questionBubble_shortcuts.tr(); + + // TODO: Use localized approach + return "Shortcuts"; } } @@ -193,6 +202,8 @@ extension QuestionBubbleExtension on BubbleAction { return '👥'; case BubbleAction.debug: return '🐛'; + case BubbleAction.shortcuts: + return '⌨️'; } } } diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/shortcut_event/built_in_shortcut_events.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/shortcut_event/built_in_shortcut_events.dart index bb2dfe128ba46..6151042e52eba 100644 --- a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/shortcut_event/built_in_shortcut_events.dart +++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/shortcut_event/built_in_shortcut_events.dart @@ -49,6 +49,7 @@ List builtInShortcutEvents = [ command: 'shift+arrow down', handler: cursorDownSelect, ), + // TODO: Use Unique and correct key names here ShortcutEvent( key: 'Cursor down select', command: 'shift+alt+arrow left',