idonutunderstand
idonutunderstand

Reputation: 117

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?

Upvotes: 1

Views: 146

Answers (1)

jcubic
jcubic

Reputation: 66498

You can fix this using this code:

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

jQuery Terminal invoke focus() in mouseup, where it detects if there was no selection.

will add this to next version.

Upvotes: 1

Related Questions