avoid select loop

This commit is contained in:
j 2019-02-01 14:02:10 +05:30
parent a71ffdb82f
commit 0dfc7db2bb
1 changed files with 4 additions and 1 deletions

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)