I replaced the textAreas with CodeMirror instances. Everything mostly works, except after reloading, the browser scrolls the page to the first CodeMirror wrapper. Funnily, my script finds and converts textAreas from the bottom up, so, as the page loads, I see a fast backward movie where every CodeMirror wrapper appears and disappears. The first one is left, of course.
An excerpt of the next version - the one with CodeMirror – is available here. The top of the page is scrolled out after loading. Like before, please select a chapter from TOC (the TOC control is still in the top right corner). Reload the page, and it will position (but not focus) at the CodeMirror wrapper div.
I have ‘autofocus: false’ in the initialization object, and it works. I could not find anything else.