Fix `editor.selectedContainer`

I'm trying to think of a way to make this more stable and predictable, for this PR.

What I did so far is to wrap this `getNodes` call as an `editor.getSelectedNodes` public method. What I'm seeing from the tests that I wrote for that, led me to investigate on the subject and come up with my findings, described in #618.