I’m trying to save and restore the exact scroll position when the editor changes focus, but any method I’ve tried has inconsistent results.
For example, if I start from the top of my document and scroll all the way to the bottom, getScrollInfo()['top']
returns 5264
.
If I switch to an editor running in a different element, and then switch back to the old one, it’s in the exact same position, but I get a value of 3784
. Trying to restore the value I saved when the editor lost focus results in scrolling to a completely different place in the document.
Scrolling all the way up and back down produces 5264
again.
Clearly something is being left out of the calculation, but what? I’ve tried slathering refresh()
both before and after saving and restoring the value, but nothing seems to help. I’ve also tried different methods of both getting and setting the scroll height.