From 3e3b0d3602be5bdfb2e5b4e659a995e1aba60461 Mon Sep 17 00:00:00 2001 From: DmitriyMX Date: Sat, 3 Jun 2017 16:55:10 +0300 Subject: [PATCH] =?UTF-8?q?MCSM:WebConsole:=20=D0=BE=D1=82=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B0=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mcserver-manager/src/main/resources/components.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mcserver-manager/src/main/resources/components.js b/mcserver-manager/src/main/resources/components.js index b4d5570..e838fb4 100644 --- a/mcserver-manager/src/main/resources/components.js +++ b/mcserver-manager/src/main/resources/components.js @@ -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}) ) ) },