From d7ac0f48f81fc8f53d6fa7d4e6bb2d6461676ccd Mon Sep 17 00:00:00 2001 From: j Date: Sun, 10 Feb 2019 17:45:09 +0530 Subject: [PATCH] don't fail without scrollIntoViewIfNeeded --- txt.js/txt.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/txt.js/txt.js b/txt.js/txt.js index c92ca06..b4cc1e6 100644 --- a/txt.js/txt.js +++ b/txt.js/txt.js @@ -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 } }