Commit 2739950d authored by Giannis Kopanas's avatar Giannis Kopanas

fix(editor): force the update for state in menus on transaction dispatch

parent e8c7c7fb
......@@ -40,7 +40,7 @@ class WaxView extends Component {
}
uploadImage = file => {
const { state, dispatch } = this.view;
const { state } = this.view;
const { findPlaceholder } = this;
const { fileUpload } = this.props;
......@@ -55,7 +55,7 @@ class WaxView extends Component {
add: { id, pos: tr.selection.from }
});
dispatch(tr);
this.view.dispatch(tr);
fileUpload(file).then(
url => {
......@@ -81,7 +81,7 @@ class WaxView extends Component {
},
() => {
// On failure, just clean up the placeholder
dispatch(tr.setMeta(placeholderPlugin, { remove: { id } }));
this.view.dispatch(tr.setMeta(placeholderPlugin, { remove: { id } }));
}
);
};
......@@ -97,6 +97,7 @@ class WaxView extends Component {
const state = this.view.state.apply(transaction);
this.view.updateState(state);
this.props.onChange(state.doc.content);
this.forceUpdate()
};
render() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment