feature: escape on comment now deselects

This commit is contained in:
Ruben van de Ven 2022-05-25 10:14:34 +02:00
parent 7e946cb3f6
commit cc253295ee

View file

@ -279,7 +279,11 @@ class Annotator extends EventTarget {
this.commentEl.placeholder = "comment";
this.commentEl.value = "";
this.commentEl.addEventListener('keyup', (e) => {
e.stopPropagation(); // prevent keyup event to propagate and set i/o points
if (ev.key == 'Escape') {
this.commentEl.blur() // deselect annotation, and deselect commentEl
} else {
e.stopPropagation(); // prevent keyup event to propagate and set i/o points
}
});
this.commentEl.addEventListener('input', (e) => {
e.stopPropagation(); // prevent keyup event
@ -389,6 +393,7 @@ class Annotator extends EventTarget {
this.wrapperEl.classList.remove('selected-annotation');
this.commentEl.value = "";
this.commentEl.blur(); // make sure we're not typing anymore
this.selectedAnnotationI = null;
this.selectedAnnotation = null;