mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
Close [BS-1869](https://linear.app/affine-design/issue/BS-1869/[bug]-android-chrome-%E8%BE%93%E5%85%A5%E9%94%99%E8%AF%AF) ## Problem On Android devices, keyboard events do not properly capture key information, causing the backspace key and other keyboard functionalities to malfunction. This is due to the specific behavior of Android platform, as discussed in: - https://stackoverflow.com/a/68188679 - https://stackoverflow.com/a/66724830 ## Solution 1. Added special handling for Android platform in `KeyboardControl` class by using `beforeInput` event instead of `keyDown` event 2. Implemented `androidBindKeymapPatch` function to handle special key events on Android platform 3. Updated event handling logic in related components, including: - CodeBlock - ListKeymap - ParagraphKeymap - PageKeyboardManager ## Changes - Added `androidBindKeymapPatch` function for handling key events on Android platform - Modified `KeyboardControl.bindHotkey` method to add `beforeInput` event handling for Android - Unified event object access using `ctx.get('defaultState').event` instead of `keyboardState.raw` - Updated key event handling logic in multiple components ## Before https://github.com/user-attachments/assets/e8602de4-d584-4adf-816f-369f38312022 ## After https://github.com/user-attachments/assets/f9e1680e-28ff-4d52-bdab-7683cdcb6f82
BlockSuite Framework
Here are the vanilla framework packages in BlockSuite.