findDirectParent function
Implementation
FNodeRange? findDirectParent(FNode root, FNode target) {
if (root is InlineContainerNode) {
for (final child in (root as InlineContainerNode).getChildren()) {
if (child.id == target.id) return FNodeRange(node: root, parent: null);
if (child is InlineContainerNode) {
final found = findDirectParent(child, target);
if (found != null) {
return FNodeRange(
node: found.node,
parent: found.parent ?? root,
);
}
}
}
}
return null;
}