unlayer / vue-email-editor

Drag-n-Drop Email Editor Component for Vue.js
https://unlayer.com/embed
568 stars 163 forks source link

Custom media library error #97

Open radilaci opened 9 months ago

radilaci commented 9 months ago

Hi,

I am trying to implement a custom media library for image selection.

this.$refs.emailEditor.editor.registerCallback('selectImage', function (data, done) {
    // Open modal, select image...
});

When I register the selectImage callback, an error immediately raised:

Error: Invalid result passed to selectImage callback. Expected object with url, width, height and size. Received: undefined
    at editor.js:2:779311
    at p (editor.js:2:770888)
    at Generator.<anonymous> (editor.js:2:772215)
    at Generator.next (editor.js:2:771298)
    at w (editor.js:2:776799)
    at a (editor.js:2:777002)
    at editor.js:2:777061
    at new Promise (<anonymous>)
    at editor.js:2:776942
    at editor.js:2:780880

This can be seen in the example page, too: https://examples.unlayer.com/media/custom-media-library/

Just add an image to the editor, and click on the Upload image button. The error is also visible behind the modal, under the button.

Any ideas?