Fix Live Preview for Docs not in Working Set

The simple recipe in #7886 uncovers a big design flaw in live preview where docs not in the working set don't work. I suspect that many reported problems and open issues are related to this subtle difference.

The issue is that live preview caches HTMLDocument objects, but the Document and Editor objects that it references are only maintained when doc is in the working set. When doc is not in the working set, a new Document and Editor object is created every time it is selected in project tree.

This PR makes 2 changes:

1. HTMLDocument now ref counts `this.doc` Document so it persists while Live Preview is connected.

2. HTMLDocument now listens for `activeEditorChange` event to handle Editor changes. This includes proper updating of event listeners and HTMLInstrumentation.

I moved this check from all the the ctor to here because it seemed safer to always do it here.