Skip to content
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: add keyboard service interceptor to prevent default ops execution #902

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

LucasXu0
Copy link
Collaborator

@LucasXu0 LucasXu0 commented Sep 26, 2024

Provide a keyboard service interceptor to allow developers to override or inject built-in keyboard operations.

abstract class AppFlowyKeyboardServiceInterceptor {
  /// Intercept insert operation
  Future<bool> interceptInsert(
    TextEditingDeltaInsertion insertion,
    EditorState editorState,
    List<CharacterShortcutEvent> characterShortcutEvents,
  ) async {
    return false;
  }

  /// Intercept delete operation
  Future<bool> interceptDelete(
    TextEditingDeltaDeletion deletion,
    EditorState editorState,
  ) async {
    return false;
  }

  /// Intercept replace operation
  Future<bool> interceptReplace(
    TextEditingDeltaReplacement replacement,
    EditorState editorState,
    List<CharacterShortcutEvent> characterShortcutEvents,
  ) async {
    return false;
  }

  /// Intercept non-text update operation
  Future<bool> interceptNonTextUpdate(
    TextEditingDeltaNonTextUpdate nonTextUpdate,
    EditorState editorState,
    List<CharacterShortcutEvent> characterShortcutEvents,
  ) async {
    return false;
  }

  /// Intercept perform action operation
  Future<bool> interceptPerformAction(
    TextInputAction action,
    EditorState editorState,
  ) async {
    return false;
  }

  /// Intercept floating cursor operation
  Future<bool> interceptFloatingCursor(
    RawFloatingCursorPoint point,
    EditorState editorState,
  ) async {
    return false;
  }
}

Copy link

codecov bot commented Sep 26, 2024

Codecov Report

Attention: Patch coverage is 20.58824% with 54 lines in your changes missing coverage. Please review.

Project coverage is 71.97%. Comparing base (ab977f9) to head (1ba2a28).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...tor_component/service/keyboard_service_widget.dart 22.58% 48 Missing ⚠️
...tor/editor_component/service/keyboard_service.dart 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #902      +/-   ##
==========================================
- Coverage   72.18%   71.97%   -0.21%     
==========================================
  Files         317      318       +1     
  Lines       14870    14921      +51     
==========================================
+ Hits        10734    10740       +6     
- Misses       4136     4181      +45     
Flag Coverage Δ
71.97% <20.58%> (-0.21%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LucasXu0 LucasXu0 merged commit 6da7b4e into AppFlowy-IO:main Sep 26, 2024
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant