Jquery终端始终专注

问题描述 投票:2回答:1

我正在使用JCubic Jquery终端,工作得很好,但光标始终聚焦在终端cmd上。

页面上的任何其他文本字段/文本框都不起作用,因为任何按键都会将光标聚焦在终端上。

https://github.com/jcubic/jquery.terminal/tree/master/js

我假设在jquery.terminal-1.3.1.js文件中有一个答案。但是哪里?

谢谢 :)

javascript jquery html terminal jquery-terminal
1个回答
0
投票

当目标是keypress时,我通过从keydowninput处理程序返回来解决这个问题:

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;
        }
        // ...
    }
    // ...
});

© www.soinside.com 2019 - 2024. All rights reserved.