AppFlowy-IO / AppFlowy-IO/appflowy-editor

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

Aperta
#779 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
p1
Lingua principale
Dart
Stelle
684
Fork
329
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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_

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.