首页 > 解决方案 > Can't edit textarea in JQuery Terminal

问题描述

I am loading raw data from a url into JQuery Terminal...

var terminal = $('#term').terminal(function(command, term) {
    term.pause();
    //set url...
    $.get(url, function(result) {
            term.echo(result, {raw:true}).resume();
    });
}

If the data contains a textarea, it is impossible to edit the text inside because as soon as I click on the textarea, the focus goes back to the prompt. Is there any way to fix this?

标签: javascriptjquery-terminal

解决方案


您可以使用以下代码解决此问题:

 term.on('mouseup', '.terminal-output textarea, .terminal-output input', function(e) {
     term.disable();
     return false;
 });

jQuery Terminalfocus()在 mouseup 中调用,它检测是否没有选择。

将其添加到下一个版本。


推荐阅读