fix scroll-to-selected

This commit is contained in:
rlx 2019-02-01 15:19:34 +05:30
parent 22d9d92369
commit 41f32ae341

View file

@ -500,9 +500,12 @@ txtjs.selectNote = function(id, trigger) {
elements.forEach(function(element) {
element.classList.add('selected')
})
// FIXME: SCROLL
// elements[0].scrollIntoView()
// window.scrollTo(0, elements[0].offsetTop)
for (let i = 0; i < elements.length; i++) {
if (!elements[i].parentNode.id.includes('scroll')) {
elements[i].scrollIntoViewIfNeeded()
break
}
}
}
if (trigger !== false) {
txtjs.postMessage('selectNote', {id: id})