mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-14 19:05:01 -05:00
Listen to input evbent in composer
Avoids having the pending text removed when re-rendering the component.
This commit is contained in:
parent
0aa8cca483
commit
1b0ac4339f
1 changed files with 3 additions and 3 deletions
|
@ -9,12 +9,12 @@ export default class Composer extends Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.handleChange = this.handleChange.bind(this);
|
||||
this.handleInput = this.handleInput.bind(this);
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
this.handleWindowKeyDown = this.handleWindowKeyDown.bind(this);
|
||||
}
|
||||
|
||||
handleChange(event) {
|
||||
handleInput(event) {
|
||||
this.setState({ [event.target.name]: event.target.value });
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ export default class Composer extends Component {
|
|||
|
||||
render() {
|
||||
return html`
|
||||
<form id="composer" class="${this.props.readOnly && !this.state.text ? "read-only" : ""}" onChange=${this.handleChange} onSubmit=${this.handleSubmit}>
|
||||
<form id="composer" class="${this.props.readOnly && !this.state.text ? "read-only" : ""}" onInput=${this.handleInput} onSubmit=${this.handleSubmit}>
|
||||
<input type="text" name="text" ref=${this.textInput} value=${this.state.text} placeholder="Type a message"/>
|
||||
</form>
|
||||
`;
|
||||
|
|
Loading…
Reference in a new issue