Open dinakar17 opened 2 years ago
Pls look into my issue!!
Sorry for the late reply :( I'll check.
Currently, it is possible in a slightly cumbersome way.
const onImageUpload = (
targetImgElement: HTMLImageElement, index: number, state: string, imageInfo: object, remainingFilesCount: number
) => {
if(state === "delete"){
console.log("fileInfo", editorInstance.core.context.image._infoList[index]);
}
};
const handleImageStateChange = (
_targetImgElement: HTMLImageElement,
index: number,
state: TStateImageUpload,
imageInfo: UploadInfo<HTMLImageElement>
) => {
if (state === EImageStatusEditor.DELETE) {
console.log("fileInfo", editor.current?.core.context.image._infoList);
}
};
I try your solution but when i console it's empty :(
Basically, I want to upload and delete an image to the server as soon as the image is uploaded or deleted from the sunedtior respectively.
I've been successfully able to upload images to the server using the following 'imageUploadBefore' call back function
But when I try to delete the image from the server using 'onImageUpload' callback
Essentially, I am getting no info on the image I am deleting. Could you please figure out what should I do in order to grab the image Info for deleting the image from the server?
By the way, I really wanted to say this so badly. "suneditor" is really awesome. The effort you put into making docs and examples websites and fine-tuning js code is really jaw-dropping. And the fact that it is an open-source makes it even more awesome.