我正在使用JCubic Jquery终端,工作得很好,但光标始终聚焦在终端cmd上。
页面上的任何其他文本字段/文本框都不起作用,因为任何按键都会将光标聚焦在终端上。
https://github.com/jcubic/jquery.terminal/tree/master/js
我假设在jquery.terminal-1.3.1.js文件中有一个答案。但是哪里?
谢谢 :)
当目标是keypress
时,我通过从keydown
和input
处理程序返回来解决这个问题:
return $(this.context).terminal( () => {}, {
keypress : (e, terminal) => {
if (e.target.tagName.toLowerCase() === 'input') {
return true;
}
// ...
},
keydown : (evt, terminal) => {
if (evt.target.tagName.toLowerCase() === 'input') {
return true;
}
// ...
}
// ...
});