AppFlowy-IO / appflowy-editor

A highly customizable rich-text editor for Flutter. The AppFlowy Editor project for AppFlowy and beyond.
https://pub.dev/packages/appflowy_editor
Other
473 stars 201 forks source link

feat: add command shortcut keys to convert text to title #921

Open Ahad-patel opened 1 month ago

Ahad-patel commented 1 month ago

closes : https://github.com/AppFlowy-IO/AppFlowy/issues/6348

I have crated shortcut for CMD+SHIFT+T/H/J/B to set text to H1/H2/H3/Body but instead of H as it is already reaserved for highlight I have used G for H2

I have kept it as draft for now because writing tests are pending

https://github.com/user-attachments/assets/8ac66aad-697a-48d9-b637-9e1b22dce822

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 64.44444% with 16 lines in your changes missing coverage. Please review.

Project coverage is 72.00%. Comparing base (0a0d441) to head (9e0e71e). Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
lib/src/l10n/l10n.dart 0.00% 12 Missing :warning:
...ding_block_component/heading_command_shortcut.dart 85.71% 4 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #921 +/- ## ========================================== - Coverage 72.06% 72.00% -0.06% ========================================== Files 318 319 +1 Lines 15000 15091 +91 ========================================== + Hits 10810 10867 +57 - Misses 4190 4224 +34 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Ahad-patel commented 1 month ago

hey @LucasXu0, I have updated the const values as you suggested, are these changes correct?

I have few other questions too.

  1. I have made it a toggle but noticed that the values does not toggle in mac notes app, should I make it working as notes app?
  2. I have used cmd+shift+g for H2 text because h is already taken as highlight? is it ok?
  3. should there be more shortcuts for h4,h5 and h6 ? if so what whould be shortcut keys?
LucasXu0 commented 1 month ago

I have made it a toggle but noticed that the values does not toggle in mac notes app, should I make it working as notes app?

IMO, we can keep the current implementation. Supporting toggling would be easy for canceling the format.

I have used cmd+shift+g for H2 text because h is already taken as highlight? is it ok?

Yes.

should there be more shortcuts for h4,h5 and h6 ? if so what whould be shortcut keys?

Supporting H1-H3 is good enough now.

Ahad-patel commented 1 month ago

I missed some description strings, I have added them. Please let me know any thing else missing in this PR.

Ahad-patel commented 4 weeks ago

hey @LucasXu0, some code coverage files are not proper how do i fix them?

Ahad-patel commented 2 weeks ago

@LucasXu0 any updates here?

LucasXu0 commented 2 weeks ago

I'm going to review it again, and I'll let you know the next step.