fix scroll-to-selected
This commit is contained in:
parent
22d9d92369
commit
41f32ae341
1 changed files with 6 additions and 3 deletions
|
@ -500,9 +500,12 @@ txtjs.selectNote = function(id, trigger) {
|
||||||
elements.forEach(function(element) {
|
elements.forEach(function(element) {
|
||||||
element.classList.add('selected')
|
element.classList.add('selected')
|
||||||
})
|
})
|
||||||
// FIXME: SCROLL
|
for (let i = 0; i < elements.length; i++) {
|
||||||
// elements[0].scrollIntoView()
|
if (!elements[i].parentNode.id.includes('scroll')) {
|
||||||
// window.scrollTo(0, elements[0].offsetTop)
|
elements[i].scrollIntoViewIfNeeded()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (trigger !== false) {
|
if (trigger !== false) {
|
||||||
txtjs.postMessage('selectNote', {id: id})
|
txtjs.postMessage('selectNote', {id: id})
|
||||||
|
|
Loading…
Reference in a new issue