auto emit blur and focus of textarea

This commit is contained in:
TDaglis
2015-10-26 15:07:15 +00:00
parent 4cf2f9a847
commit 987f09d880
+9 -6
View File
@@ -40,7 +40,7 @@
} else {
/*
* Plain browser environment
*/
*/
this.Xterm = xterm.call(this);
this.Terminal = this.Xterm; /* Backwards compatibility with term.js */
}
@@ -394,7 +394,6 @@
this.showCursor();
this.textarea.focus();
this.emit('focus', {terminal: this});
};
Terminal.prototype.blur = function() {
@@ -408,8 +407,6 @@
if (this.sendFocus) {
this.send('\x1b[O');
}
this.emit('blur', {terminal: this});
};
/**
@@ -559,6 +556,12 @@
this.textarea.setAttribute('autocapitalize', 'off');
this.textarea.setAttribute('spellcheck', 'false');
this.textarea.tabIndex = 0;
this.textarea.onfocus = function() {
self.emit('focus', {terminal: self});
}
this.textarea.onblur = function() {
self.emit('blur', {terminal: self});
}
this.helperContainer.appendChild(this.textarea);
for (; i < this.rows; i++) {
@@ -2379,7 +2382,7 @@
this.emit('keydown', ev);
this.emit('key', key, ev);
this.showCursor();
this.showCursor();
this.handler(key);
return this.cancel(ev);
@@ -4784,4 +4787,4 @@
Terminal.cancel = cancel;
return Terminal;
});
});