Restore reload_templates setting
Rework thread collapsing and editing interaction

Thread collapse handling is moved to the thread directive. This
directive no longer creates new scope (since the tranclusion of the
recursion was making it hard to propagate events up the thread
scopes).

Now, which children are being edited is tracked by every ancestor
so that threads cannot be collapsed if editing is taking place
below.

Fix #555