diff --git a/txt.js/txt.js b/txt.js/txt.js index bf90f9d..c92ca06 100644 --- a/txt.js/txt.js +++ b/txt.js/txt.js @@ -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})