From a816a7b149ea83be928ea6f80bb7f7d9bd00ec5f Mon Sep 17 00:00:00 2001 From: liuzheng712 Date: Thu, 3 Mar 2016 17:03:47 +0800 Subject: [PATCH] fix(webterminal): bug fix test --- static/js/webterminal.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/static/js/webterminal.js b/static/js/webterminal.js index fd25d1257..8d6942d9b 100644 --- a/static/js/webterminal.js +++ b/static/js/webterminal.js @@ -13,7 +13,7 @@ WSSHClient.prototype._generateEndpoint = function (options) { var protocol = 'ws://'; } - var endpoint = protocol + document.URL.match(RegExp('//(.*?)/'))[1] + '/ws/terminal'+document.URL.match(/(\?.*)/); + var endpoint = protocol + document.URL.match(RegExp('//(.*?)/'))[1] + '/ws/terminal' + document.URL.match(/(\?.*)/); return endpoint; }; WSSHClient.prototype.connect = function (options) { @@ -55,10 +55,16 @@ WSSHClient.prototype.send = function (data) { function openTerminal(options) { var client = new WSSHClient(); - var term = new Terminal(80, 24, function (key) { - client.send(key); + var term = new Terminal({ + rows: rowHeight, + cols: colWidth, + useStyle: true, + screenKeys: true }); term.open(); + term.on('data', function (data) { + client.send(data) + }); $('.terminal').detach().appendTo('#term'); term.resize(80, 24); term.write('Connecting...');