Archived
0

MCSM:WebConsole: отправка комманд

This commit is contained in:
2017-06-03 16:55:10 +03:00
parent 80ff52b471
commit 3e3b0d3602

View File

@@ -93,6 +93,13 @@ var WebConsole = React.createClass({
focusInput: function() {
this.refs.input.focus();
},
handleKeyInput: function(event) {
if (event.key === 'Enter') {
console.debug("send command '" + this.refs.input.value + "'");
this.ws.send(':'+this.refs.input.value);
this.refs.input.value = '';
}
},
/*--------------------*/
getInitialState: function(){return{
lines: []
@@ -107,7 +114,7 @@ var WebConsole = React.createClass({
return ce('p', {dangerouslySetInnerHTML: {__html: ansi_up.ansi_to_html(line)}});
})
),
ce('input', {ref: 'input'})
ce('input', {ref: 'input', 'onKeyPress': this.handleKeyInput})
)
)
},