add click to reply

This commit is contained in:
xmcp
2019-03-08 13:45:34 +08:00
parent a324022b0f
commit f5d09abde6
4 changed files with 42 additions and 12 deletions

View File

@@ -72,6 +72,7 @@ export class SafeTextarea extends Component {
this.clear=this.clear.bind(this);
this.area_ref=React.createRef();
this.change_callback=props.on_change;
this.change_callback(this.state.text);
}
componentWillUnmount() {
@@ -91,6 +92,17 @@ export class SafeTextarea extends Component {
text: '',
});
}
set_and_focus(text) {
this.change_callback(text);
this.setState({
text: text,
},()=>{
this.area_ref.current.focus();
});
}
get() {
return this.state.text;
}
render() {
return (