johndatserakis / file-upload-with-preview

🖼 Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.

Home Page:https://johndatserakis.github.io/file-upload-with-preview

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using the clear button does not trigger image delete event

ThisIsPita opened this issue · comments

As the title says. I assume this is intentional since the event is probably meant to trigger on individual image deletion. Don't know if it'd be worth adding an event for when all the images are cleared, even programmatically. In the meantime I'm just looking for a click on elements with the "custom-file-container__image-clear" class to detect when the clear button is used.

Thanks for your work on this awesome plugin.

Sorry for the extremely late response. This as been added in v4.2.0 with the fileUploadWithPreview:clearButtonClicked event. That will be released and downloadable later tonight.

window.addEventListener('fileUploadWithPreview:clearButtonClicked', function (e) {
    console.log('clearButtonClicked')
    console.log(e.detail.uploadId)
})