avoid select loop
This commit is contained in:
parent
a71ffdb82f
commit
0dfc7db2bb
1 changed files with 4 additions and 1 deletions
|
@ -219,7 +219,10 @@ txtjs.noteExists = function(note) {
|
||||||
|
|
||||||
txtjs.onMessage = function(data, event) {
|
txtjs.onMessage = function(data, event) {
|
||||||
if (event == 'selectAnnotation') {
|
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') {
|
} else if (event == 'addAnnotations') {
|
||||||
data.annotations.forEach(function(note) {
|
data.annotations.forEach(function(note) {
|
||||||
txtjs.renderNote(note)
|
txtjs.renderNote(note)
|
||||||
|
|
Loading…
Reference in a new issue