avoid select loop

This commit is contained in:
j 2019-02-01 14:02:10 +05:30
parent a71ffdb82f
commit 0dfc7db2bb

View file

@ -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)