scrollIntoView() control offset?


I’m experimenting with trying to force an element to scroll into view with tr.scrollIntoView() but I’m finding that sometimes the element is scrolled to the very bottom of the view port and other times it’s scrolled to the very top.

It seems that due to the way things are rendered setting scrollTop is not going to work, or am I missing something obvious? Is there a simple way to scroll my selection into view with a set offset from the top?


Such a feature doesn’t exist yet. You could, after updating the view, use getBoundingClientRect and manually update the editor’s scroll position.

Yes, that worked great. Thanks