Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/fleather/lib/src/rendering/editable_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,17 @@ class RenderEditableContainerBox extends RenderBox

final targetNode = node.lookup(position.offset).node;

var targetChild = firstChild;
RenderEditableBox? targetChild = firstChild;

while (targetChild != null) {
if (targetChild.node == targetNode) {
break;
return targetChild;
}
targetChild = childAfter(targetChild);
}
assert(targetChild != null, 'No child at position $position');
return targetChild!;

// Fallback: return last available child instead of crashing
return lastChild!;
}

/// Returns child of this container located at the specified local `offset`.
Expand Down
Loading