don't fail without scrollIntoViewIfNeeded

This commit is contained in:
j 2019-02-10 17:45:09 +05:30
parent 54f47b6401
commit d7ac0f48f8
1 changed files with 4 additions and 1 deletions

View File

@ -224,6 +224,9 @@ txtjs.onMessage = function(data, event) {
} else if (event == 'addAnnotation') {
txtjs.addNoteFromSelection()
} else if (event == 'addAnnotations') {
if (data.reset) {
// fixme
}
data.annotations.forEach(function(note) {
////
note.position = note.position.replace(':', ',')
@ -502,7 +505,7 @@ txtjs.selectNote = function(id, trigger) {
})
for (let i = 0; i < elements.length; i++) {
if (!elements[i].parentNode.id.includes('scroll')) {
elements[i].scrollIntoViewIfNeeded()
elements[i].scrollIntoViewIfNeeded && elements[i].scrollIntoViewIfNeeded()
break
}
}