Error while trying to registerCallback
M0hammedImran opened this issue · comments
When I try to registerCallback
for selectImage
I see the following error on the UI.
This is the code used to registerCallback
editor.registerCallback("selectImage", (file, done) => {
this.setState({ openImageSelectionModal: true });
this.done = done;
});
And when image is selected, I call done
callback
this.done({ url: data });
After calling done things seem to work as usual.
Thanks for reporting @M0hammedImran. While that is not fixed, you can use this workaround:
unlayer.registerCallback("selectImage", async (file) => {
const thiss = this;
return new Promise((resolve) => {
thiss.done = resolve;
});
});
Thanks for reporting @M0hammedImran. While that is not fixed, you can use this workaround:
unlayer.registerCallback("selectImage", async (file) => { const thiss = this; return new Promise((resolve) => { thiss.done = resolve; }); });
Thanks @brunolemos, this worked for me.
@M0hammedImran we have released a fix. please revert back to your original code instead of the workaround. thanks!