I have added a WYSWYG editor sumernote and changed the settings to store the uploaded image on my server. By default the editor seem to base64 encode images to be stored in db. Now that I can upload image I need to be able to delete it when either the image is deleted from the post.
I am having the hardest time figuring out how to get the image name on delete button click with jQuery.
I forked one of the summernote Jsfiddle examples. It works here
You can try to use onMediaDelete
event of summernote and $target.context.dataset.filename
to get filename of image about to delete.
$(".summernote").summernote({
onMediaDelete : function($target, editor, $editable) {
alert($target.context.dataset.filename);
$target.remove();
}
})