dmy / elm-doc-preview

Elm offline documentation previewer
https://www.npmjs.com/package/elm-doc-preview
Other
128 stars 15 forks source link

Maintain scroll position when hot reloading? #24

Closed ianmackenzie closed 5 years ago

ianmackenzie commented 5 years ago

When I'm working on my own documentation, I often browse through the docs using elm-doc-preview, see something I want to change, make the edit and save the Elm file. This causes a hot reload of the documentation, which is great, but also causes the page to scroll back to the top and I have to scroll down to get back to where I was (unless I get clever and click the current function name first, so that it becomes the hash value in the URL and therefore causes the browser to scroll back to the function after reloading). Would it be possible to add some logic to maintain the scroll position after a hot reload?

ianmackenzie commented 5 years ago

If this will add a lot of complexity, don't worry about it - I actually had a project recently where I tried to be clever about tracking and maintaining scroll position and it became such a nightmare that I just gave up and just let the browser do its thing. But perhaps you can find an elegant solution that I could not!

rlefevre commented 5 years ago

As you found, setting the hash fragment is the first way as the app scrolls back to it after a reload.

The other way is to filter your function (s) with the regex filter box.

But I understand that this does not work well when reviewing the full doc.

I'm working on a major new version with a lot of cleaning and new features, so I will think about it.

Thanks for reporting it.

ianmackenzie commented 5 years ago

Sounds great! Looking forward to seeing the new version when it's ready =)

rlefevre commented 5 years ago

This should be fixed in 3.0.0-rc1 and later.