AppFlowy-IO / AppFlowy-IO/appflowy-editor

[Bug] Wrong variable in EditorState.getNodeInOffset() function in selection service

Đang mở
#779 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
p1
Ngôn ngữ chính
Dart
Star
684
Fork
329
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Bug Description

Bug found during implementation of custom blocks postioned horizontally.

[Source Line 51-58 of shared.dart](https://github.com/AppFlowy-IO/appflowy-editor/blob/680ada4fd865b1c0bcdba1b673621a8301eeb146/lib/src/editor/editor_component/service/selection/shared.dart#L51-L58)
```
final filteredNodes = List.of(sortedNodes)
..retainWhere((n) => n.rect.bottom == sortedNodes[min].rect.bottom);
min = 0;
if (filteredNodes.length > 1) {
min = _findCloseNode(
sortedNodes,
0,
filteredNodes.length - 1,
(rect) => rect.right <= offset.dx,
);
}
```

should be: filteredNodes instead of sortedNodes.

``` final filteredNodes = List.of(sortedNodes)
..retainWhere((n) => n.rect.bottom == sortedNodes[min].rect.bottom);
min = 0;
if (filteredNodes.length > 1) {
min = _findCloseNode(
filteredNodes,
0,
filteredNodes.length - 1,
(rect) => rect.right <= offset.dx,
);
}
```

### How to Reproduce

Keep 3 paragraphNodes() in a row. While attempting to select the middle one, selection shifts to 3rd node.

### Expected Behavior

Selection cursor to be on the middle node

### Operating System

Windows 11

### AppFlowy Editor Version(s)

2.3.4

### Screenshots

_No response_

### Additional Context

_No response_

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.