mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2026-03-24 12:56:59 +00:00
[PR #2671] [MERGED] Refactor text block delta and across block selection #5358
Labels
No labels
2024
2025
2026
acct mgmt
AI
automation
bug
calendar
ci
CJK
cloud
code-block
collaboration
copy-paste
database
data migration
data sync
deploy
desktop
develop
develop
documentation
duplicate
editor
editor-plugin
emoji
export
files
flutter-only
follow-up
formula
good first issue for devs
good first issue for experienced devs
grid
hacktoberfest
HACKTOBERFEST-ACCEPTED
help wanted
i18n
icons
images
importer
improvements
infra
install
integrations
IR
kanban board
login
look and joy
mentorship
mobile
mobile
needs design
new feature
new feature
non-coding
notes
notifications
onboarding
organization
P0+
permission
platform-linux
platform-mac
platform-windows
plugins
program
pull-request
Q1 25
Q1 26
Q2 24
Q2 25
Q3 24
Q3 25
Q4 24
Q4 25
react
regression
rust
rust
Rust-only
Rust-only
Rust-starter
Rust-starter
self-hosted
shortcuts
side panel
slash-menu
sync v2
table
tablet
task
tauri
templates
tests
themes
translation
v0.5.6
v0.5.8
v0.5.9
v0.6.0
v0.6.1
v0.6.4
v0.6.7
v0.6.8
v0.7.1
v0.7.4
v0.7.4
v0.7.5
v0.7.6
v0.7.7
v0.7.8
v0.8.0
v0.8.4
v0.8.5
v0.8.9
web
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AppFlowy-IO/AppFlowy#5358
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/2671
Author: @qinluhe
Created: 5/31/2023
Status: ✅ Merged
Merged: 6/2/2023
Merged by: @qinluhe
Base:
develop← Head:refactor/text-block-delta📝 Commits (2)
aae01bdfix: add block menu commenta23727brefactor: separation of abstract delta and editor, and optimization across block selections📊 Changes
99 files changed (+3497 additions, -2636 deletions)
View changed files
📝
frontend/appflowy_tauri/package.json(+6 -2)📝
frontend/appflowy_tauri/pnpm-lock.yaml(+143 -21)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSelection/BlockRangeSelection.hooks.ts(+106 -40)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSelection/BlockRectSelection.hooks.ts(+8 -5)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSelection/BlockRectSelection.tsx(+6 -5)➕
frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSelection/RangeKeyDown.hooks.ts(+119 -0)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSelection/index.tsx(+4 -1)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSideToolbar/BlockMenu.tsx(+14 -5)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSideToolbar/BlockMenuTurnInto.tsx(+1 -0)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSideToolbar/BlockSideToolbar.hooks.tsx(+7 -9)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSideToolbar/index.tsx(+2 -4)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSlash/BlockSlashMenu.tsx(+6 -0)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSlash/index.hooks.ts(+2 -2)➖
frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/CodeBlock.hooks.ts(+0 -86)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/SelectLanguage.tsx(+6 -1)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/index.tsx(+18 -20)➕
frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/useKeyDown.ts(+51 -0)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/HeadingBlock/index.tsx(+1 -1)📝
frontend/appflowy_tauri/src/appflowy_app/components/document/Node/index.tsx(+4 -2)➕
frontend/appflowy_tauri/src/appflowy_app/components/document/Overlay/BlockOverlay.tsx(+7 -0)...and 79 more files
📄 Description
Feature Preview
Refactor Delta and Operation
The abstraction of delta and editor separation decouples the editing operations from the specific implementation of the editor, allowing the operations to be reused in different editor environments.
Refactor Across block selection
The cross-block selection is achieved by listening to mouse events at a higher level. When the mouse cursor passes over a block, the block is focused, allowing the block itself to store the changes in the selection within that block.
Considering the scenario of virtual scrolling where nodes are destroyed and re-rendered, the cross-block selection ensures that each block is dispatched with its own selection, enabling it to redraw accordingly.
Due to the way slate.js handles the selection, there will be some interaction problems in the process of drawing the selection. The code uses some completions and hacks to solve these problems. Maybe there are other more elegant solutions?
PR Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.