Skip to content

Commit 80673ad

Browse files
author
Akos Kitta
committed
Styled the input.
Do not render the widget after a close request. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
1 parent 2f33038 commit 80673ad

File tree

4 files changed

+51
-6
lines changed

4 files changed

+51
-6
lines changed

arduino-ide-extension/src/browser/monitor/monitor-widget.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export class MonitorWidget extends ReactWidget {
3434
* Do not touch or use it. It is for setting the focus on the `input` after the widget activation.
3535
*/
3636
protected focusNode: HTMLElement | undefined;
37+
/**
38+
* Guard against re-rendering the view after the close was requested.
39+
* See: https://github.com/eclipse-theia/theia/issues/6704
40+
*/
41+
protected closing = false;
3742
protected readonly clearOutputEmitter = new Emitter<void>();
3843

3944
constructor() {
@@ -67,13 +72,20 @@ export class MonitorWidget extends ReactWidget {
6772
}
6873

6974
onCloseRequest(msg: Message): void {
75+
this.closing = true;
7076
this.monitorConnection.autoConnect = false;
7177
if (this.monitorConnection.connected) {
7278
this.monitorConnection.disconnect();
7379
}
7480
super.onCloseRequest(msg);
7581
}
7682

83+
protected onUpdateRequest(msg: Message): void {
84+
if (!this.closing) {
85+
super.onUpdateRequest(msg);
86+
}
87+
}
88+
7789
protected onResize(msg: Widget.ResizeMessage): void {
7890
super.onResize(msg);
7991
this.widgetHeight = msg.height;
@@ -195,7 +207,7 @@ export class SerialMonitorSendInput extends React.Component<SerialMonitorSendInp
195207
return <input
196208
ref={this.setRef}
197209
type='text'
198-
className={this.props.monitorConfig ? '' : 'not-connected'}
210+
className={this.props.monitorConfig ? '' : 'warning'}
199211
placeholder={this.placeholder}
200212
value={this.state.text}
201213
onChange={this.onChange}

arduino-ide-extension/src/browser/style/arduino-select.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
.arduino-select__option--is-selected {
1515
background-color: var(--theia-accent-color3) !important;
1616
color: var(--theia-content-font-color0) !important;
17-
border-color: var(--theia-accent-color3) !important;
17+
border-color: var(--theia-accent-color3) !important;
1818
}
1919

2020
.arduino-select__option--is-focused {

arduino-ide-extension/src/browser/style/index.css

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,40 @@
44
@import './editor.css';
55
@import './monitor.css';
66
@import './arduino-select.css';
7+
8+
input:focus {
9+
outline-width: 1px;
10+
outline-style: solid;
11+
outline-offset: -1px;
12+
opacity: 1 !important;
13+
outline-color: var(--theia-accent-color3);
14+
}
15+
16+
input.warning:focus {
17+
outline-width: 1px;
18+
outline-style: solid;
19+
outline-offset: -1px;
20+
opacity: 1 !important;
21+
color: var(--theia-warn-font-color0);
22+
background-color: var(--theia-warn-color0);
23+
}
24+
25+
input.warning {
26+
background-color: var(--theia-warn-color0);
27+
}
28+
29+
input.warning::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
30+
color: var(--theia-warn-font-color0);
31+
background-color: var(--theia-warn-color0);
32+
opacity: 1; /* Firefox */
33+
}
34+
35+
input.warning:-ms-input-placeholder { /* Internet Explorer 10-11 */
36+
color: var(--theia-warn-font-color0);
37+
background-color: var(--theia-warn-color0);
38+
}
39+
40+
input.warning::-ms-input-placeholder { /* Microsoft Edge */
41+
color: var(--theia-warn-font-color0);
42+
background-color: var(--theia-warn-color0);
43+
}

arduino-ide-extension/src/browser/style/monitor.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
border-color: var(--theia-accent-color3);
3434
}
3535

36-
.serial-monitor .head .send > input.not-connected {
37-
background-color: var(--theia-warn-color0);
38-
}
39-
4036
.serial-monitor .head .config {
4137
display: flex;
4238
}

0 commit comments

Comments
 (0)