Browse Source

fix safe textarea

dev
xmcp 6 years ago
parent
commit
436ec949cb
  1. 8
      src/Common.js

8
src/Common.js

@ -57,7 +57,7 @@ export class SafeTextarea extends Component {
constructor(props) {
super(props);
this.state={
text: window.TEXTAREA_BACKUP[props.id]||'',
text: '',
};
this.on_change_bound=this.on_change.bind(this);
this.on_keydown_bound=this.on_keydown.bind(this);
@ -68,6 +68,12 @@ export class SafeTextarea extends Component {
this.submit_callback=props.on_submit||(()=>{});
}
componentDidMount() {
this.setState({
text: window.TEXTAREA_BACKUP[this.props.id]||''
});
}
componentWillUnmount() {
window.TEXTAREA_BACKUP[this.props.id]=this.state.text;
this.change_callback(this.state.text);

Loading…
Cancel
Save