hivewrite-sdk 1.1.6 → 1.1.7
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 +4 -4
- package/bundle.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -223,19 +223,19 @@ mergeTags: [
|
|
|
223
223
|
| `onExport` | `(html: string, userId?: string)` | User exports or `exportHtml` called |
|
|
224
224
|
| `onError` | `(err: any, userId?: string)` | Initialization or processing error |
|
|
225
225
|
| `onTemplateChange` | `(templateId: string, userId?: string)` | Template selection changed |
|
|
226
|
-
| `onImageUpload` | `(file: File)` | **Async**. Handle image uploads, return URL |
|
|
226
|
+
| `onImageUpload` | `(file: File, userId?: string)` | **Async**. Handle image uploads, return URL |
|
|
227
227
|
|
|
228
228
|
### Image Upload Example
|
|
229
229
|
```javascript
|
|
230
230
|
callbacks: {
|
|
231
|
-
onImageUpload: async (file) => {
|
|
231
|
+
onImageUpload: async (file, userId) => {
|
|
232
232
|
const formData = new FormData();
|
|
233
233
|
formData.append('image', file);
|
|
234
|
+
if (userId) formData.append('userId', userId);
|
|
234
235
|
const res = await fetch('/api/upload', { method: 'POST', body: formData });
|
|
235
236
|
const data = await res.json();
|
|
236
237
|
return data.url; // Return the uploaded image URL
|
|
237
238
|
}
|
|
238
|
-
}
|
|
239
239
|
}
|
|
240
240
|
```
|
|
241
241
|
|
|
@@ -244,7 +244,7 @@ callbacks: {
|
|
|
244
244
|
#### `onSave(design, userId)`
|
|
245
245
|
The `design` object contains the full state of the editor.
|
|
246
246
|
|
|
247
|
-
```
|
|
247
|
+
```javascript
|
|
248
248
|
{
|
|
249
249
|
"blocks": [ ... ], // Array of block objects
|
|
250
250
|
"canvasSettings": { ... }, // Canvas styles (width, background, etc)
|