MCSM:WebConsole: отправка комманд
This commit is contained in:
@@ -93,6 +93,13 @@ var WebConsole = React.createClass({
|
|||||||
focusInput: function() {
|
focusInput: function() {
|
||||||
this.refs.input.focus();
|
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{
|
getInitialState: function(){return{
|
||||||
lines: []
|
lines: []
|
||||||
@@ -107,7 +114,7 @@ var WebConsole = React.createClass({
|
|||||||
return ce('p', {dangerouslySetInnerHTML: {__html: ansi_up.ansi_to_html(line)}});
|
return ce('p', {dangerouslySetInnerHTML: {__html: ansi_up.ansi_to_html(line)}});
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
ce('input', {ref: 'input'})
|
ce('input', {ref: 'input', 'onKeyPress': this.handleKeyInput})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user