I'm currently having an issue trying to insert an image after it has been uploaded. I've followed the documentation on https://xdsoft.net/jodit/, but still having issues.
Here is my config object:
{
readonly: false,
enableDragAndDropFileToEditor: true,
uploader: {
url: this.url_upload,
data: {
dir: this.dir
},
baseurl: relativePathURL,
process: (response) => {
let files = [];
response.list.map((file) => {
files.push(file.name);
});
return {
files,
path: relativePathURL,
baseurl: '/content/assets',
error: (response.success ? 0 : 1),
msg: response.message
};
},
defaultHandlerSuccess: (response) => {
if (response.files && response.files.length) {
for (let i = 0; i < response.files.length; i++) {
let full_file_path = response.path + response.files[i];
this.selection.insertImage(full_file_path);
}
}
}
}
}
I understand the return object from process is the response passed on to defaultHandlerSuccess where the file gets inserted. However, I keep getting this o is undefined error every time.

I'm looking for some insight on how to properly insert the image. What is it that I'm doing wrong?
I ended up doing some further testing to diagnose the problem.
I renamed the original node_modules/jodit/build/jodit.min.js to node_modules/jodit/build/_jodit.min.js, and node_modules/jodit/build/jodit.js to node_modules/jodit/build/jodit.min.js, so I can truly understand the issue.
After doing this, the error was in the insertImage function, line 671,defaultWidth was undefined.
https://github.com/xdan/jodit/blob/master/src/modules/Selection.ts#L655
So the change was simply providing the other two parameters when calling the insertImage function as so:
this.selection.insertImage(full_file_path, null, 250);
In the provided example (https://xdsoft.net/jodit/v.2/doc/tutorial-uploader-settings.html), there is no mention of the parameters being required.
Hope this helps anyone else with the same issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With