Open iarobinson opened 5 years ago
Hi Ian,
A PR for a better example here would be much appreciated! That's not a great example as it's just the default implementation. To override it you have to redefine window.ActiveStorageDragAndDrop.paintUploadIcon
so here's a very quick and dirty example that you should be able to put in your JavaScript bundle:
window.ActiveStorageDragAndDrop.paintUploadIcon = function (iconContainer, id, file, complete) {'
iconContainer.insertAdjacentHTML('afterbegin', `
<div data-direct-upload-id="${id}">
</div>
`)
}
It should replace the upload icon with an empty div
. If it isn't working for you or you need a more complete example let me know.
Sorry to 'me too' this, but I also would like some sort of working example on how to override the upload view. I couldn't get what you pasted in here to work...perhaps there are some punctuation issues? but I get an error on the page.
new:253 Uncaught TypeError: Cannot set property 'paintUploadIcon' of undefined
I am putting that on a page after
import ActiveStorageDragAndDrop from 'active_storage_drag_and_drop'
ActiveStorageDragAndDrop.start()
would have been called.
If you can provide insight for me on this, I'd be happy to create a PR with updated documentation.