AppFlowy-IO / AppFlowy-IO/appflowy-editor

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

Ouverte
#779 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
p1
Langage dominant
Dart
Étoiles
684
Forks
329
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.