Skip to content

Commit 7207b3c

Browse files
author
Akos Kitta
committed
feat: force placeholder text when not connected
but preserve the state until the connection is back Signed-off-by: Akos Kitta <[email protected]>
1 parent 79d649d commit 7207b3c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: arduino-ide-extension/src/browser/serial/monitor/serial-monitor-send-input.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,16 @@ export class SerialMonitorSendInput extends React.Component<
112112
override render(): React.ReactNode {
113113
const inputClassName = this.inputClassName;
114114
const placeholder = this.placeholder;
115+
const readOnly = Boolean(inputClassName);
115116
return (
116117
<input
117118
ref={this.setRef}
118119
type="text"
119120
className={`theia-input ${inputClassName}`}
120-
readOnly={Boolean(inputClassName)}
121+
readOnly={readOnly}
121122
placeholder={placeholder}
122123
title={placeholder}
123-
value={this.state.text}
124+
value={readOnly ? '' : this.state.text} // always show the placeholder if cannot edit the <input>
124125
onChange={this.onChange}
125126
onKeyDown={this.onKeyDown}
126127
/>

0 commit comments

Comments
 (0)