Styled the input.

Do not render the widget after a close request.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta
2019-12-06 12:50:44 +01:00
parent 2f33038695
commit 80673ad18f
4 changed files with 51 additions and 6 deletions

View File

@@ -34,6 +34,11 @@ export class MonitorWidget extends ReactWidget {
* Do not touch or use it. It is for setting the focus on the `input` after the widget activation.
*/
protected focusNode: HTMLElement | undefined;
/**
* Guard against re-rendering the view after the close was requested.
* See: https://github.com/eclipse-theia/theia/issues/6704
*/
protected closing = false;
protected readonly clearOutputEmitter = new Emitter<void>();
constructor() {
@@ -67,6 +72,7 @@ export class MonitorWidget extends ReactWidget {
}
onCloseRequest(msg: Message): void {
this.closing = true;
this.monitorConnection.autoConnect = false;
if (this.monitorConnection.connected) {
this.monitorConnection.disconnect();
@@ -74,6 +80,12 @@ export class MonitorWidget extends ReactWidget {
super.onCloseRequest(msg);
}
protected onUpdateRequest(msg: Message): void {
if (!this.closing) {
super.onUpdateRequest(msg);
}
}
protected onResize(msg: Widget.ResizeMessage): void {
super.onResize(msg);
this.widgetHeight = msg.height;
@@ -195,7 +207,7 @@ export class SerialMonitorSendInput extends React.Component<SerialMonitorSendInp
return <input
ref={this.setRef}
type='text'
className={this.props.monitorConfig ? '' : 'not-connected'}
className={this.props.monitorConfig ? '' : 'warning'}
placeholder={this.placeholder}
value={this.state.text}
onChange={this.onChange}