hivewrite-sdk 1.1.8 → 1.1.10
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 +10 -9
- package/bundle.min.js +1 -1
- package/index.d.ts +1 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,7 +54,6 @@ const MyEditor = () => {
|
|
|
54
54
|
locale: 'en',
|
|
55
55
|
callbacks: {
|
|
56
56
|
onLoad: () => console.log('Editor ready'),
|
|
57
|
-
onSave: (design) => console.log('Saved:', design),
|
|
58
57
|
onExport: (html) => console.log('HTML:', html)
|
|
59
58
|
}
|
|
60
59
|
});
|
|
@@ -80,7 +79,6 @@ const MyEditor = () => {
|
|
|
80
79
|
locale: 'en',
|
|
81
80
|
callbacks: {
|
|
82
81
|
onLoad: () => console.log('Editor ready'),
|
|
83
|
-
onSave: (design) => console.log('Saved:', design),
|
|
84
82
|
onExport: (html) => console.log('HTML:', html)
|
|
85
83
|
}
|
|
86
84
|
});
|
|
@@ -106,7 +104,7 @@ Initializes and mounts the editor.
|
|
|
106
104
|
| `theme` | `string` | No | `'light'` (default) or `'dark'` |
|
|
107
105
|
| `locale` | `string` | No | `'en'` (default), `'es'`, or `'fr'` |
|
|
108
106
|
| `branding` | `object` | No | Custom white-labeling options |
|
|
109
|
-
| `permissions` | `object` | No | Toggle features: `
|
|
107
|
+
| `permissions` | `object` | No | Toggle features: `export`, `aiMagic`, `uploadImages` |
|
|
110
108
|
| `mergeTags` | `array` | No | Array of `{ label, value }` for dynamic content |
|
|
111
109
|
| `callbacks` | `object` | No | Event hooks for SDK actions |
|
|
112
110
|
|
|
@@ -192,7 +190,7 @@ Control what features are available:
|
|
|
192
190
|
|
|
193
191
|
```javascript
|
|
194
192
|
permissions: {
|
|
195
|
-
|
|
193
|
+
export: true, // Allow HTML export
|
|
196
194
|
aiMagic: true, // Enable AI features
|
|
197
195
|
uploadImages: false // Disable uploads (stock images only)
|
|
198
196
|
}
|
|
@@ -219,8 +217,7 @@ mergeTags: [
|
|
|
219
217
|
| Callback | Arguments | Description |
|
|
220
218
|
| :--- | :--- | :--- |
|
|
221
219
|
| `onLoad` | `()` | Editor fully initialized |
|
|
222
|
-
| `
|
|
223
|
-
| `onExport` | `(html: string, userId?: string)` | User exports or `exportHtml` called |
|
|
220
|
+
| `onExport` | `(html: string, userId?: string)` | User exports or `export` called |
|
|
224
221
|
| `onError` | `(err: any, userId?: string)` | Initialization or processing error |
|
|
225
222
|
| `onTemplateChange` | `(templateId: string, userId?: string)` | Template selection changed |
|
|
226
223
|
| `onImageUpload` | `(file: File, userId?: string)` | **Async**. Handle image uploads, return URL |
|
|
@@ -241,10 +238,14 @@ callbacks: {
|
|
|
241
238
|
|
|
242
239
|
### Response Examples
|
|
243
240
|
|
|
244
|
-
#### `
|
|
245
|
-
|
|
241
|
+
#### `hivewrite.save()`
|
|
242
|
+
Returns the current design state as a JSON object.
|
|
246
243
|
|
|
247
244
|
```javascript
|
|
245
|
+
const design = hivewrite.save();
|
|
246
|
+
console.log(design);
|
|
247
|
+
|
|
248
|
+
// Output:
|
|
248
249
|
{
|
|
249
250
|
"blocks": [ ... ], // Array of block objects
|
|
250
251
|
"canvasSettings": { ... }, // Canvas styles (width, background, etc)
|
|
@@ -297,7 +298,7 @@ Exported HTML is fully compatible with:
|
|
|
297
298
|
| :--- | :--- |
|
|
298
299
|
| `init(config)` | Initialize the editor |
|
|
299
300
|
| `export({ format, minify?, inlineCSS? })` | Export design to HTML or JSON |
|
|
300
|
-
| `
|
|
301
|
+
| `save()` | Save current design state to JSON |
|
|
301
302
|
| `importHTML({ html })` | Import HTML into editor (experimental) |
|
|
302
303
|
| `setTheme(theme)` | Switch theme at runtime |
|
|
303
304
|
| `setUserId(userId)` | Update user ID at runtime |
|