Open artknight opened 3 years ago
In case anyone is finding this through Google, here's an example:
new EasyMDE({
imageUploadFunction: (file, onSuccess, onError) => {
const reader = new FileReader();
reader.onload = () => onSuccess(reader.result);
reader.onerror = () => onError(`Error loading ${file.name}`);
reader.readAsDataURL(file);
}
})
I wouldn't recommend storing the images as data URIs in your markdown document, this is just a simple example. The file
variable is a File object: https://developer.mozilla.org/en-US/docs/Web/API/File.
It would be great to see some code on how the
imageUploadFunction
method is supposed to be used! The docs are very slim on that!Art