AppFlowy-IO / AppFlowy-IO/appflowy-editor

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

Aberta
#779 0 comentários 0 reações 0 responsáveis Ver no GitHub
p1
Linguagem predominante
Dart
Estrelas
684
Forks
329
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.