AppFlowy icon indicating copy to clipboard operation
AppFlowy copied to clipboard

feat: customize command shortcuts

Open MayurSMahajan opened this issue 1 year ago • 10 comments

Feature Preview

https://github.com/AppFlowy-IO/AppFlowy/assets/47064215/d439c58a-d026-48d1-9f55-8c5427ceebe9


Solves #1882

PR Checklist

  • [x] My code adheres to the AppFlowy Style Guide
  • [x] I've listed at least one issue that this PR fixes in the description above.
  • [x] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • [x] All existing tests are passing.

MayurSMahajan avatar Jun 20 '23 06:06 MayurSMahajan

Codecov Report

Merging #2848 (45c5ed7) into main (0fb004a) will increase coverage by 0.13%. The diff coverage is 80.70%.

@@            Coverage Diff             @@
##             main    #2848      +/-   ##
==========================================
+ Coverage   68.70%   68.84%   +0.13%     
==========================================
  Files         426      430       +4     
  Lines       20241    20469     +228     
==========================================
+ Hits        13907    14091     +184     
- Misses       6334     6378      +44     
Flag Coverage Δ
appflowy_flutter_integrateion_test 65.80% <15.78%> (-0.57%) :arrow_down:
appflowy_flutter_unit_test 13.15% <73.24%> (+0.80%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ace/application/settings/settings_dialog_bloc.dart 95.45% <ø> (ø)
...rkspace/presentation/settings/settings_dialog.dart 92.10% <0.00%> (-2.49%) :arrow_down:
...ngs/widgets/settings_customize_shortcuts_view.dart 71.68% <71.68%> (ø)
...n/settings/shortcuts/settings_shortcuts_cubit.dart 83.78% <83.78%> (ø)
...settings/shortcuts/settings_shortcuts_service.dart 91.17% <91.17%> (ø)
...pplication/settings/shortcuts/shortcuts_model.dart 92.30% <92.30%> (ø)
...lib/plugins/document/presentation/editor_page.dart 96.27% <100.00%> (+0.30%) :arrow_up:
...e/presentation/settings/widgets/settings_menu.dart 84.37% <100.00%> (+2.89%) :arrow_up:

codecov[bot] avatar Jun 20 '23 06:06 codecov[bot]

Screenshot 2023-06-20 at 17 16 18

Should we retain this warning for this particular case(customizing the same shortcut for the event)?

LucasXu0 avatar Jun 20 '23 09:06 LucasXu0

Screenshot 2023-06-20 at 17 16 18

Should we retain this warning for this particular case(customizing the same shortcut for the event)?

In my new changes, we simply ignore the user's request to assign the same keybinding to a shortcut.

MayurSMahajan avatar Jun 21 '23 15:06 MayurSMahajan

Can we aim to release this feature by the end of next week?

annieappflowy avatar Jun 23 '23 08:06 annieappflowy

Yes. I added reset to default just now. cc @MayurSMahajan.

Screenshot 2023-06-25 at 13 04 44

I found a new issue. Currently, you're using the standardCommandShortcutEvents, but I changed it to commandShortcutEvents, which includes the code block commands. However, when customizing the code block event, it will throw an exception because some events inside the code block are using the same command as the standardCommandShortcutEvents.

LucasXu0 avatar Jun 25 '23 05:06 LucasXu0

Capitalize the first letter of each command

Questions:

  1. How can I delete a key binding / set to something else?
  2. How did command conflicts handle?
  3. Can there be visual clues to show which key bind belongs to which command? If my screen is large, it's hard to locate in the current design (shown in this screenshot)
  4. How is the list sorted? Can it be user friendly? image

annieappflowy avatar Jun 26 '23 07:06 annieappflowy

Capitalize the first letter of each command

Questions:

1. How can I delete a key binding / set to something else?

2. How did command conflicts handle?

3. Can there be visual clues to show which key bind belongs to which command? If my screen is large, it's hard to locate in the current design (shown in this screenshot)

4. How is the list sorted? Can it be user-friendly?
   ![image](https://user-images.githubusercontent.com/12026239/248710053-a27d154d-9dfb-4b81-8315-78ee32d8a6c9.png)
  1. There is no way to delete a key binding. You can assign a new KeyBinding by clicking on it and then typing the desired key combination you want. (Deleting a key binding is not possible since we don't allow our CommandShortcutEvents to be null.)

  2. Command conflicts are handled by checking the type of command, i.e. is a command used for CodeBlock or not. The same keybinding can be used for one Codeblock shortcut and one non-Codeblock shortcut. However, you can not assign the same keybinding to two Codeblock shortcuts or two non-Codeblock shortcuts.

3 & 4. Let me submit a new commit addressing these issues.

MayurSMahajan avatar Jun 26 '23 09:06 MayurSMahajan

I've added a divider after each command and keybinding, which makes it visually easy to know which command and keybinding belong to each other. We are also sorting the list of shortcuts alphabetically, to make the UX better.

MayurSMahajan avatar Jun 26 '23 14:06 MayurSMahajan

Hi @MayurSMahajan , when can this PR be merged?

annieappflowy avatar Jul 10 '23 04:07 annieappflowy

Hey @annieappflowy! Actually, the PR is ready to be merged but there is some problem with CI/CD, we hope to resolve the issue soon. Maybe in a couple of days, we'll have it merged.

MayurSMahajan avatar Jul 10 '23 14:07 MayurSMahajan

Hey @annieappflowy! Actually, the PR is ready to be merged but there is some problem with CI/CD, we hope to resolve the issue soon. Maybe in a couple of days, we'll have it merged.

As long as a test introduced in this PR isn't failing on all platforms, I believe we can continue. Windows tests are failing, and we don't have a solution as of yet, we will keep working on it. :+1:

Xazin avatar Jul 16 '23 11:07 Xazin