feature: escape on comment now deselects
This commit is contained in:
		
							parent
							
								
									7e946cb3f6
								
							
						
					
					
						commit
						cc253295ee
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		|  | @ -279,7 +279,11 @@ class Annotator extends EventTarget { | ||||||
|                 this.commentEl.placeholder = "comment"; |                 this.commentEl.placeholder = "comment"; | ||||||
|                 this.commentEl.value = ""; |                 this.commentEl.value = ""; | ||||||
|                 this.commentEl.addEventListener('keyup', (e) => { |                 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) => { |                 this.commentEl.addEventListener('input', (e) => { | ||||||
|                     e.stopPropagation(); // prevent keyup event 
 |                     e.stopPropagation(); // prevent keyup event 
 | ||||||
|  | @ -389,6 +393,7 @@ class Annotator extends EventTarget { | ||||||
| 
 | 
 | ||||||
|         this.wrapperEl.classList.remove('selected-annotation'); |         this.wrapperEl.classList.remove('selected-annotation'); | ||||||
|         this.commentEl.value = ""; |         this.commentEl.value = ""; | ||||||
|  |         this.commentEl.blur(); // make sure we're not typing anymore
 | ||||||
| 
 | 
 | ||||||
|         this.selectedAnnotationI = null; |         this.selectedAnnotationI = null; | ||||||
|         this.selectedAnnotation = null; |         this.selectedAnnotation = null; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Ruben van de Ven
						Ruben van de Ven