mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-13 06:16:33 +00:00
Set focus on send field initially
Signed-off-by: jbicker <jan.bicker@typefox.io>
This commit is contained in:
parent
dac9c6437e
commit
d8454456a9
@ -96,7 +96,7 @@ export class MonitorViewContribution extends AbstractViewContribution<MonitorWid
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected renderAutoScrollButton(): React.ReactNode {
|
protected renderAutoScrollButton(): React.ReactNode {
|
||||||
return <React.Fragment>
|
return <React.Fragment key='autoscroll-toolbar-item'>
|
||||||
<div
|
<div
|
||||||
title='Toggle Autoscroll'
|
title='Toggle Autoscroll'
|
||||||
className={`item enabled fa fa-angle-double-down arduino-monitor ${this.model.autoscroll ? 'toggled' : ''}`}
|
className={`item enabled fa fa-angle-double-down arduino-monitor ${this.model.autoscroll ? 'toggled' : ''}`}
|
||||||
@ -111,7 +111,7 @@ export class MonitorViewContribution extends AbstractViewContribution<MonitorWid
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected renderTimestampButton(): React.ReactNode {
|
protected renderTimestampButton(): React.ReactNode {
|
||||||
return <React.Fragment>
|
return <React.Fragment key='line-ending-toolbar-item'>
|
||||||
<div
|
<div
|
||||||
title='Toggle Timestamp'
|
title='Toggle Timestamp'
|
||||||
className={`item enabled fa fa-clock-o arduino-monitor ${this.model.timestamp ? 'toggled' : ''}`}
|
className={`item enabled fa fa-clock-o arduino-monitor ${this.model.timestamp ? 'toggled' : ''}`}
|
||||||
|
@ -25,6 +25,9 @@ export namespace SerialMonitorSendField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class SerialMonitorSendField extends React.Component<SerialMonitorSendField.Props, SerialMonitorSendField.State> {
|
export class SerialMonitorSendField extends React.Component<SerialMonitorSendField.Props, SerialMonitorSendField.State> {
|
||||||
|
|
||||||
|
protected inputField: HTMLInputElement | null;
|
||||||
|
|
||||||
constructor(props: SerialMonitorSendField.Props) {
|
constructor(props: SerialMonitorSendField.Props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = { value: '' };
|
this.state = { value: '' };
|
||||||
@ -33,10 +36,22 @@ export class SerialMonitorSendField extends React.Component<SerialMonitorSendFie
|
|||||||
this.handleSubmit = this.handleSubmit.bind(this);
|
this.handleSubmit = this.handleSubmit.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
if (this.inputField) {
|
||||||
|
this.inputField.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <React.Fragment>
|
return <React.Fragment>
|
||||||
<form onSubmit={this.handleSubmit}>
|
<form onSubmit={this.handleSubmit}>
|
||||||
<input type='text' id='serial-monitor-send' autoComplete='off' value={this.state.value} onChange={this.handleChange} />
|
<input
|
||||||
|
tabIndex={-1}
|
||||||
|
ref={ref => this.inputField = ref}
|
||||||
|
type='text' id='serial-monitor-send'
|
||||||
|
autoComplete='off'
|
||||||
|
value={this.state.value}
|
||||||
|
onChange={this.handleChange} />
|
||||||
<input className="btn" type="submit" value="Submit" />
|
<input className="btn" type="submit" value="Submit" />
|
||||||
</form>
|
</form>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
@ -47,7 +47,7 @@ export class ArduinoToolbarComponent extends React.Component<ArduinoToolbarCompo
|
|||||||
render(): React.ReactNode {
|
render(): React.ReactNode {
|
||||||
const tooltip = <div key='arduino-toolbar-tooltip' className={'arduino-toolbar-tooltip'}>{this.state.tooltip}</div>;
|
const tooltip = <div key='arduino-toolbar-tooltip' className={'arduino-toolbar-tooltip'}>{this.state.tooltip}</div>;
|
||||||
const items = [
|
const items = [
|
||||||
<React.Fragment>
|
<React.Fragment key={this.props.side + '-arduino-toolbar-tooltip'}>
|
||||||
{[...this.props.items].map(item => TabBarToolbarItem.is(item) ? this.renderItem(item) : item.render())}
|
{[...this.props.items].map(item => TabBarToolbarItem.is(item) ? this.renderItem(item) : item.render())}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
]
|
]
|
||||||
@ -103,6 +103,7 @@ export class ArduinoToolbar extends ReactWidget {
|
|||||||
|
|
||||||
protected render(): React.ReactNode {
|
protected render(): React.ReactNode {
|
||||||
return <ArduinoToolbarComponent
|
return <ArduinoToolbarComponent
|
||||||
|
key='arduino-toolbar-component'
|
||||||
side={this.side}
|
side={this.side}
|
||||||
items={[...this.items.values()]}
|
items={[...this.items.values()]}
|
||||||
commands={this.commands}
|
commands={this.commands}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user