indextree
indextree copied to clipboard
Feature Request: Reparenting Trees
I work on a system that occasionally moves subtrees to new parent nodes.
HTML example:
<main>
<section>
<h2>Hello world</h2>
<p>Text here</p>
</section>
</main>
But now, I want to move h2 and p to the main tree directly:
<main>
<h2>...</h2>
<p>...</p>
</main>
These changes show up to me as ParentChanged(newParentId).
In this trivial exanple, it isn't so bad. But in the real world this could be any node in the tree, and it may have its own children, etc.
Would it be possible to have something like NodeId::detach_subtree that only removes the one link (fron parent to child) and then it could be reattached elsewhere?
Based on what the docs look like now: detaching something only removes the one node, but keeps the rest of the subtree in place.