@bigbinary/neeto-image-uploader-frontend 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/index.cjs.js +950 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +950 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +6 -0
package/README.md
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
- [Components](#components)
|
|
12
12
|
- [1. AssetLibrary](#1-assetlibrary)
|
|
13
13
|
- [2. ImageUploader](#2-imageuploader)
|
|
14
|
+
- [Hooks](#hooks)
|
|
15
|
+
- [1. useImageUpload](#1-useimageuploader)
|
|
14
16
|
- [Development instructions](#development-instructions)
|
|
15
17
|
- [Engine development](#engine-development)
|
|
16
18
|
- [Frontend package development](#frontend-package-development)
|
|
@@ -124,6 +126,34 @@ The frontend exports two components `AssetLibrary` and `ImageUploader`.
|
|
|
124
126
|
<img src="https://github.com/bigbinary/neeto-editor/assets/70290286/d293d887-38fd-4e55-a53d-dd591a52f053" alt="Image Uploader"/>
|
|
125
127
|
</div>
|
|
126
128
|
|
|
129
|
+
# Hooks
|
|
130
|
+
|
|
131
|
+
## 1. useImageUpload
|
|
132
|
+
|
|
133
|
+
The `useImageUpload` hook is a React custom hook that simplifies the process of uploading images in your application. It handles both development and production scenarios, tracks upload progress, and provides a clean interface for image uploading.
|
|
134
|
+
|
|
135
|
+
### Import the hook
|
|
136
|
+
|
|
137
|
+
```jsx
|
|
138
|
+
import { useImageUpload } from "@bigbinary/neeto-image-uploader-frontend";
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Invoke the hook
|
|
142
|
+
|
|
143
|
+
```jsx
|
|
144
|
+
const { uploadImage, uploadProgress, uploadedImage } = useImageUpload();
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Call uploadImage to Upload an Image
|
|
148
|
+
|
|
149
|
+
```jsx
|
|
150
|
+
const handleImageUpload = async (file) => {
|
|
151
|
+
uploadImage(file, (uploadedImageData) => {
|
|
152
|
+
// Handle the uploaded image data
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
```
|
|
156
|
+
|
|
127
157
|
# Development instructions
|
|
128
158
|
|
|
129
159
|
## Engine development
|