image
image copied to clipboard
feat: add `onSelectFile` config option to `ImageConfig`
This config option, if passed will be invoked on clicking "select an image". This callback receive the current imageTool as parameter, in order to permit user carry call methods like onUpload with the response object ({ success: true, file: ... })
This should close #56
I use this on my website, and it works perfectly.
const imageToolConfig = {
class: EditorJSImage,
config: {
onSelectFile: tool => {
toggleLibrary(img => {
const data = tool.data;
data.file = img; // set image
data.caption = data.caption || img.meta;
tool.data = data;
toggleLibrary(undefined);
});
},
uploader: {
uploadByFile: ...
uploadByUrl: ...
}
}
}
Would be great to have it merged, very useful feature to have. Right it's impossible to integrate image uploading with CMS, Strapi for example.
in order to permit user carry call methods like onUpload
Please, clarify. Why not use a custom uploader?