Textnote BoundingBox to Exclude leader

Try searching the forum a bit- You will probably need some nodes from packages or Python.

I have Rhythm installed, and that has a node TextNotes.GetLeaders which you can use to filter text notes that have leaders.
This thread indicates the GeniusLoci package has nodes to manage leaders:

Finally, there is an active thread talking about managing undos with Dynamo: