Cancel key input by <C-[>
This commit is contained in:
		
							parent
							
								
									2fd6a3f90f
								
							
						
					
					
						commit
						c69fdbb14a
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -1,6 +1,10 @@
 | 
				
			||||||
import * as dom from 'shared/utils/dom';
 | 
					import * as dom from 'shared/utils/dom';
 | 
				
			||||||
import * as keys from 'shared/utils/keys';
 | 
					import * as keys from 'shared/utils/keys';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const cancelKey = (e) => {
 | 
				
			||||||
 | 
					  return e.key === 'Escape' || e.key === '[' && e.ctrlKey;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class InputComponent {
 | 
					export default class InputComponent {
 | 
				
			||||||
  constructor(target) {
 | 
					  constructor(target) {
 | 
				
			||||||
    this.pressed = {};
 | 
					    this.pressed = {};
 | 
				
			||||||
| 
						 | 
					@ -37,7 +41,7 @@ export default class InputComponent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  capture(e) {
 | 
					  capture(e) {
 | 
				
			||||||
    if (this.fromInput(e)) {
 | 
					    if (this.fromInput(e)) {
 | 
				
			||||||
      if (e.key === 'Escape' && e.target.blur) {
 | 
					      if (cancelKey(e) && e.target.blur) {
 | 
				
			||||||
        e.target.blur();
 | 
					        e.target.blur();
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue