From 0dfc7db2bb531a99f6be6ada9b6100689e064b0b Mon Sep 17 00:00:00 2001 From: j Date: Fri, 1 Feb 2019 14:02:10 +0530 Subject: [PATCH] avoid select loop --- 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 3ce17c1..4e9881d 100644 --- a/txt.js/txt.js +++ b/txt.js/txt.js @@ -219,7 +219,10 @@ txtjs.noteExists = function(note) { txtjs.onMessage = function(data, event) { if (event == 'selectAnnotation') { - txtjs.selectNote(data.id) + let selected = txtjs.getSelectedNote() + if (!selected || selected.id != data.id) { + txtjs.selectNote(data.id) + } } else if (event == 'addAnnotations') { data.annotations.forEach(function(note) { txtjs.renderNote(note)