forked from newthuhole/hole_thu_frontend
fix safe textarea
This commit is contained in:
@@ -57,7 +57,7 @@ export class SafeTextarea extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state={
|
this.state={
|
||||||
text: window.TEXTAREA_BACKUP[props.id]||'',
|
text: '',
|
||||||
};
|
};
|
||||||
this.on_change_bound=this.on_change.bind(this);
|
this.on_change_bound=this.on_change.bind(this);
|
||||||
this.on_keydown_bound=this.on_keydown.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||(()=>{});
|
this.submit_callback=props.on_submit||(()=>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.setState({
|
||||||
|
text: window.TEXTAREA_BACKUP[this.props.id]||''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
window.TEXTAREA_BACKUP[this.props.id]=this.state.text;
|
window.TEXTAREA_BACKUP[this.props.id]=this.state.text;
|
||||||
this.change_callback(this.state.text);
|
this.change_callback(this.state.text);
|
||||||
|
|||||||
Reference in New Issue
Block a user