[PR #2365] [MERGED] Support pressing keyboard event to move cursor #5205

Closed
opened 2026-03-23 22:17:43 +00:00 by mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/2365
Author: @qinluhe
Created: 4/27/2023
Status: Merged
Merged: 4/28/2023
Merged by: @qinluhe

Base: developHead: feat/support-textblock-arrow-event


📝 Commits (1)

  • 9ee4f7e fix: support up/down/left/right keyboard event to move cursor

📊 Changes

7 files changed (+478 additions, -73 deletions)

View changed files

📝 frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/TextBlock.hooks.ts (+79 -13)
📝 frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TextInput.hooks.ts (+5 -2)
📝 frontend/appflowy_tauri/src/appflowy_app/stores/reducers/document/async_actions/backspace.ts (+3 -9)
📝 frontend/appflowy_tauri/src/appflowy_app/stores/reducers/document/async_actions/set_cursor.ts (+78 -25)
📝 frontend/appflowy_tauri/src/appflowy_app/utils/block.ts (+48 -1)
📝 frontend/appflowy_tauri/src/appflowy_app/utils/slate/hotkey.ts (+92 -18)
📝 frontend/appflowy_tauri/src/appflowy_app/utils/slate/text.ts (+173 -5)

📄 Description

Feature Preview

  • Support moving the cursor to the previous line with the same offset when pressing up, and the current cursor position is the upper edge
  • Support moving the cursor to the next line with the same offset when pressing down, and the current cursor position is the lower edge
  • Support pressing the left key to move the cursor to the end of the previous line, and the current cursor position is at the beginning of the line
  • Support pressing the right key to move the cursor to the beginning of the next line, and the current cursor position is at the end of the line

PR Checklist

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AppFlowy-IO/AppFlowy/pull/2365 **Author:** [@qinluhe](https://github.com/qinluhe) **Created:** 4/27/2023 **Status:** ✅ Merged **Merged:** 4/28/2023 **Merged by:** [@qinluhe](https://github.com/qinluhe) **Base:** `develop` ← **Head:** `feat/support-textblock-arrow-event` --- ### 📝 Commits (1) - [`9ee4f7e`](https://github.com/AppFlowy-IO/AppFlowy/commit/9ee4f7eb11d03e8374f0fee54aacdb92c2199ce4) fix: support up/down/left/right keyboard event to move cursor ### 📊 Changes **7 files changed** (+478 additions, -73 deletions) <details> <summary>View changed files</summary> 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/TextBlock.hooks.ts` (+79 -13) 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TextInput.hooks.ts` (+5 -2) 📝 `frontend/appflowy_tauri/src/appflowy_app/stores/reducers/document/async_actions/backspace.ts` (+3 -9) 📝 `frontend/appflowy_tauri/src/appflowy_app/stores/reducers/document/async_actions/set_cursor.ts` (+78 -25) 📝 `frontend/appflowy_tauri/src/appflowy_app/utils/block.ts` (+48 -1) 📝 `frontend/appflowy_tauri/src/appflowy_app/utils/slate/hotkey.ts` (+92 -18) 📝 `frontend/appflowy_tauri/src/appflowy_app/utils/slate/text.ts` (+173 -5) </details> ### 📄 Description <!--- Thank you for submitting a pull request to AppFlowy. The team will dedicate their best efforts to reviewing and approving your pull request. If you have any questions about the project or feedback for us, please join our [Discord](https://discord.gg/wdjWUXXhtw). --> <!--- If your pull request adds a new feature, please drag and drop a video into this section to showcase what you've done! If not, you may delete this section. --> ### Feature Preview - [x] Support moving the cursor to the previous line with the same offset when pressing <b>`up`</b>, and the current cursor position is the upper edge - [x] Support moving the cursor to the next line with the same offset when pressing **`down`,** and the current cursor position is the lower edge - [x] Support pressing the **`left`** key to move the cursor to the end of the previous line, and the current cursor position is at the beginning of the line - [x] Support pressing the **`right`** key to move the cursor to the beginning of the next line, and the current cursor position is at the end of the line <!--- List at least one issue here that this PR addresses. If it fixes the issue, please use the [fixes](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests) keyword to close the issue. For example: fixes https://github.com/AppFlowy-IO/AppFlowy/pull/2106 --> --- <!--- Before you mark this PR ready for review, run through this checklist! --> #### PR Checklist - [ ] My code adheres to the [AppFlowy Style Guide](https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/software-contributions/submitting-code/style-guides) - [ ] I've listed at least one issue that this PR fixes in the description above. - [ ] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes. - [ ] All existing tests are passing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
mirror 2026-03-23 22:17:43 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AppFlowy-IO/AppFlowy#5205
No description provided.