break;
}
key = '\t';
+ this.cancel(ev, true);
break;
// return/enter
case 13:
key = '\r';
+ this.cancel(ev, true);
break;
// escape
case 27:
key = '\x1b';
+ this.cancel(ev, true);
break;
// left-arrow
case 37:
this.emit('keydown', ev);
this.emit('key', key, ev);
-
+ console.log('keydown');
this.showCursor();
this.handler(key);
this.emit('keypress', key, ev);
this.emit('key', key, ev);
-
+ console.log('keypress');
this.showCursor();
this.handler(key);
el.removeEventListener(type, handler, capture || false);
}
-function cancel(ev) {
- if (!this.cancelEvents) {
+function cancel(ev, force) {
+ if (!this.cancelEvents && !force) {
return;
}
- if (ev.preventDefault) {
- ev.preventDefault();
- }
- if (ev.stopPropagation) {
- ev.stopPropagation();
- }
- ev.cancelBubble = true;
+ ev.preventDefault();
+ ev.stopPropagation();
return false;
}