From 265043ee872fc92beec1c5aefe20c5a396e9a86b Mon Sep 17 00:00:00 2001
From: John Datserakis
Date: Sat, 4 Sep 2021 21:51:33 -0400
Subject: [PATCH] Add additional event and clean up export
---
LICENSE.md | 2 +-
README.md | 30 +-
docs/8d34959997c6158d6a4d1c506f5ff73e.svg | 1 -
docs/badge.png | Bin 236257 -> 0 bytes
docs/favicon.png | Bin 676 -> 0 bytes
docs/index.html | 1 -
docs/logo-promosis.png | Bin 6348 -> 0 bytes
docs/main.34b59dda2bc5f58aff5d.css | 4 -
docs/main.546310cb9577066438f3.js | 1 -
docs/vendor.fb499262a9e09dc42cef.js | 1 -
example/index.html | 9 +-
example/main.js | 9 +-
package-lock.json | 12254 --------------------
package.json | 6 +-
public/badge.png | Bin 236257 -> 0 bytes
public/logo-promosis.png | Bin 6348 -> 0 bytes
src/file-upload-with-preview.js | 34 +-
webpack.config.js | 60 +-
yarn.lock | 9077 +++++++++++++++
19 files changed, 9156 insertions(+), 12333 deletions(-)
delete mode 100644 docs/8d34959997c6158d6a4d1c506f5ff73e.svg
delete mode 100644 docs/badge.png
delete mode 100644 docs/favicon.png
delete mode 100644 docs/index.html
delete mode 100644 docs/logo-promosis.png
delete mode 100644 docs/main.34b59dda2bc5f58aff5d.css
delete mode 100644 docs/main.546310cb9577066438f3.js
delete mode 100644 docs/vendor.fb499262a9e09dc42cef.js
delete mode 100644 package-lock.json
delete mode 100644 public/badge.png
delete mode 100644 public/logo-promosis.png
create mode 100644 yarn.lock
diff --git a/LICENSE.md b/LICENSE.md
index e60e53b..94deda8 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) Promosis
+Copyright (c) John Datserakis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index ef7fb14..a72a42c 100644
--- a/README.md
+++ b/README.md
@@ -6,21 +6,21 @@
-
-
+
+
### Links
-[View demo](https://promosis.github.io/file-upload-with-preview/)
+[View demo](https://johndatserakis.github.io/file-upload-with-preview)
[View on npm](https://www.npmjs.com/package/file-upload-with-preview)
-[View on GitHub](https://github.com/promosis/file-upload-with-preview#readme)
+[View on GitHub](https://github.com/johndatserakis/file-upload-with-preview#readme)
### About
-This is a simple frontend utility to help the file-upload process on your website. It is written in pure JavaScript, has no dependencies, and is a small 13.55 kB (gzipped). You can check out the live demo [here](https://promosis.github.io/file-upload-with-preview/).
+This is a simple frontend utility to help the file-upload process on your website. It is written in pure JavaScript, has no dependencies, and is a small 13.55 kB (gzipped). You can check out the live demo [here](https://johndatserakis.github.io/file-upload-with-preview).
For the most part, browsers do a good job of handling image-uploads. That being said - we find that the ability to show our users a preview of their upload can go a long way in increasing the confidence in their upload.
@@ -197,10 +197,11 @@ Make sure to set `multiple` on your input if you want to allow the user to selec
### Events
-| event | value | description |
-| ---------------------------------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
-| fileUploadWithPreview:imagesAdded | `e` (e.detail.uploadId, e.detail.cachedFileArray, e.detail.addedFilesCount) | Triggered each time file/files are selected. Delivers the `uploadId`, updated `cachedFilesArray`, and `addedFilesCount` for the event. |
-| fileUploadWithPreview:imageDeleted | `e` (e.detail.uploadId, e.detail.cachedFileArray, e.detail.currentFileCount) | Triggered each time a file is deleted. Delivers the `uploadId`, updated `cachedFilesArray`, and `currentFileCount` for the event. |
+| event | value | description |
+| ---------------------------------------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
+| fileUploadWithPreview:imagesAdded | `e` (e.detail.uploadId, e.detail.cachedFileArray, e.detail.addedFilesCount) | Triggered each time file/files are selected. Delivers the `uploadId`, updated `cachedFilesArray`, and `addedFilesCount` for the event. |
+| fileUploadWithPreview:imageDeleted | `e` (e.detail.uploadId, e.detail.cachedFileArray, e.detail.currentFileCount) | Triggered each time a file is deleted. Delivers the `uploadId`, updated `cachedFilesArray`, and `currentFileCount` for the event. |
+| fileUploadWithPreview:clearButtonClicked | `e` (e.detail.uploadId) | Triggered when the clear button is clicked. Delivers the `uploadId`. |
### Full Example
@@ -264,7 +265,6 @@ Make sure to set `multiple` on your input if you want to allow the user to selec
baseImage: importedBaseImage,
},
presetFiles: [
- "../public/logo-promosis.png",
"https://images.unsplash.com/photo-1557090495-fc9312e77b28?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=668&q=80",
],
});
@@ -310,7 +310,7 @@ Or, you can install babel-polyfill and import that in the main script of your ap
### Testing
-Use `npm run test` to run the tests.
+Use `yarn test` to run the tests.
### Development
@@ -318,13 +318,13 @@ Clone the repo, then use the following to work on the project locally:
```bash
# Install dependencies
-npm install
+yarn
# Watch changes
-npm run watch
+yarn watch
# When done working
-npm run build
+yarn build
```
### Other
@@ -333,6 +333,4 @@ Go ahead and fork the project! Submit an issue if needed. Have fun!
### License
-Copywrite 2017 [Promosis](https://promosis.com)
-
[MIT](http://opensource.org/licenses/MIT)
diff --git a/docs/8d34959997c6158d6a4d1c506f5ff73e.svg b/docs/8d34959997c6158d6a4d1c506f5ff73e.svg
deleted file mode 100644
index 269ae02..0000000
--- a/docs/8d34959997c6158d6a4d1c506f5ff73e.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/docs/badge.png b/docs/badge.png
deleted file mode 100644
index 16899e2c98084587bda7fdbfe830d5de96b6b1cc..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 236257
zcmeEvc{tSn*Eb@f5JDje*|(ByFrz{uLYC~&LiTm+V^T@h$da|P8~d7_>Rkz#$N*W?=a&pqW(MY{OuP{@y=hk`3pCH)o`K%mcNL43TFImiT@pD
z{6*A%=bgVT@oC=q3pan^=6}@^!(Wiz=7$qq5`gMiRK&Mh7QgSbW5Bl_h$*TH_j}DP
zWL+%ZY}kD6pJ|5360_AVL?YU|y-W8dUR59#@W``3H4Kl2)VI%B$#d!vs+Qc0{0eZe
z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