findParentNodeId method
Helper to get the parent node ID of a fragment
Implementation
String? findParentNodeId(String fragmentId) {
// Fast path: check if it's a top-level node
for (var i = 0; i < _content.nodes.length; i++) {
if (_content.nodes[i].id == fragmentId) {
return _content.id; // Root document is the parent
}
}
// Search in nested structures
for (final node in _content.nodes) {
final found = _findInNode(node, fragmentId, _content.id);
if (found != null) return found;
}
return null;
}