Skip to content
Snippets Groups Projects
Commit ac38c1f1 authored by Tim's avatar Tim
Browse files

fix form clear

parent 014c4fbf
No related branches found
No related tags found
No related merge requests found
...@@ -118,6 +118,7 @@ class ReplyEditor extends React.Component { ...@@ -118,6 +118,7 @@ class ReplyEditor extends React.Component {
resetForm() resetForm()
this.setAutoVote() this.setAutoVote()
this.setState({rte_value: stateFromHtml()}) this.setState({rte_value: stateFromHtml()})
this.refs.rte.reset()
if(onCancel) onCancel(e) if(onCancel) onCancel(e)
} }
this.onChange = this.onChange.bind(this); this.onChange = this.onChange.bind(this);
...@@ -213,7 +214,7 @@ class ReplyEditor extends React.Component { ...@@ -213,7 +214,7 @@ class ReplyEditor extends React.Component {
// As rte_editor is updated, keep the (invisible) 'body' field in sync. // As rte_editor is updated, keep the (invisible) 'body' field in sync.
onChange(rte_value) { onChange(rte_value) {
this.setState({rte_value}) //this.setState({rte_value})
const html = stateToHtml(rte_value) const html = stateToHtml(rte_value)
const body = this.props.fields.body const body = this.props.fields.body
if(body.value !== html) body.onChange(html); if(body.value !== html) body.onChange(html);
......
...@@ -50,6 +50,10 @@ export default class SlateEditor extends React.Component { ...@@ -50,6 +50,10 @@ export default class SlateEditor extends React.Component {
this.state = {state: props.initialState} this.state = {state: props.initialState}
} }
reset = () => {
this.setState({state: this.props.initialState})
}
componentDidMount = () => { componentDidMount = () => {
this.updateMenu() this.updateMenu()
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment