hivewrite-sdk 1.0.2 → 1.0.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 +44 -35
- package/bundle.min.js +1 -1
- package/index.d.ts +27 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,8 @@ const MyEditor = () => {
|
|
|
36
36
|
apiKey: 'your-api-key',
|
|
37
37
|
container: containerRef.current,
|
|
38
38
|
mode: 'FULL_EDITOR',
|
|
39
|
+
theme: 'dark', // 'light' or 'dark'
|
|
40
|
+
locale: 'en', // 'en', 'es', 'fr'
|
|
39
41
|
callbacks: {
|
|
40
42
|
onLoad: () => console.log('Editor ready'),
|
|
41
43
|
onSave: (design) => console.log('Saved:', design),
|
|
@@ -56,14 +58,18 @@ const MyEditor = () => {
|
|
|
56
58
|
|
|
57
59
|
<script src="https://cdn.jsdelivr.net/npm/hivewrite-sdk/bundle.min.js"></script>
|
|
58
60
|
<script>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
EmailEditor.init({
|
|
62
|
+
apiKey: 'your-api-key',
|
|
63
|
+
container: '#editor-container',
|
|
64
|
+
mode: 'FULL_EDITOR',
|
|
65
|
+
theme: 'dark', // 'light' or 'dark'
|
|
66
|
+
locale: 'en', // 'en', 'es', 'fr'
|
|
67
|
+
callbacks: {
|
|
68
|
+
onLoad: () => console.log('Editor ready'),
|
|
69
|
+
onSave: (design) => console.log('Saved:', design),
|
|
70
|
+
onExport: (html) => console.log('HTML:', html)
|
|
71
|
+
}
|
|
72
|
+
});
|
|
67
73
|
</script>
|
|
68
74
|
```
|
|
69
75
|
|
|
@@ -80,10 +86,12 @@ Initializes and mounts the editor.
|
|
|
80
86
|
| :--- | :--- | :--- | :--- |
|
|
81
87
|
| `apiKey` | `string` | Yes | Your HiveWrite API Key. |
|
|
82
88
|
| `container` | `string \| HTMLElement` | Yes | CSS selector or DOM element to mount the editor. |
|
|
83
|
-
| `mode` | `string` | Yes | `'FULL_EDITOR'`, `'DESIGN_ONLY'`, `'READ_ONLY'
|
|
84
|
-
| `
|
|
89
|
+
| `mode` | `string` | Yes | `'FULL_EDITOR'`, `'DESIGN_ONLY'`, `'READ_ONLY'` |
|
|
90
|
+
| `theme` | `string` | No | `'light'` (default) or `'dark'`. |
|
|
91
|
+
| `locale` | `string` | No | `'en'` (default), `'es'`, or `'fr'`. |
|
|
85
92
|
| `branding` | `object` | No | Custom white-labeling options (see below). |
|
|
86
|
-
| `
|
|
93
|
+
| `permissions`| `object` | No | Toggle features: `exportHTML`, `aiMagic`, `uploadImages`. |
|
|
94
|
+
| `mergeTags` | `array` | No | Array of `{ name, value, category }` for dynamic content. |
|
|
87
95
|
| `callbacks` | `object` | No | Event hooks for SDK actions. |
|
|
88
96
|
|
|
89
97
|
---
|
|
@@ -93,49 +101,50 @@ Initializes and mounts the editor.
|
|
|
93
101
|
| Callback | Arguments | Description |
|
|
94
102
|
| :--- | :--- | :--- |
|
|
95
103
|
| `onLoad` | `()` | Triggered when the editor is fully initialized. |
|
|
96
|
-
| `onSave` | `(
|
|
104
|
+
| `onSave` | `(json: any)` | Triggered when the user clicks save or `saveDesign` is called. |
|
|
97
105
|
| `onExport` | `(html: string)` | Triggered when the user exports or `exportHtml` is called. |
|
|
98
106
|
| `onError` | `(err: any)` | Triggered during initialization or processing errors. |
|
|
99
107
|
| `onImageUpload`| `(file: File)` | **Async**. Intercept image uploads and return a URL string. |
|
|
100
|
-
| `onTemplateChange`| `(id: string)` | Triggered when a new template is selected. |
|
|
101
108
|
|
|
102
109
|
---
|
|
103
110
|
|
|
104
|
-
### Methods
|
|
105
|
-
|
|
106
|
-
#### `loadTemplate(data: { templateId?: string; design?: any })`
|
|
107
|
-
Loads a template by ID or a raw JSON design object.
|
|
111
|
+
### Methods (Returned by `init`)
|
|
108
112
|
|
|
109
|
-
#### `
|
|
110
|
-
|
|
113
|
+
#### `export(options: { format: 'html' | 'json', minify?: boolean, inlineCSS?: boolean })`
|
|
114
|
+
Advanced export with minification and CSS inlining options.
|
|
111
115
|
|
|
112
|
-
#### `
|
|
113
|
-
|
|
116
|
+
#### `saveTemplate(options: { name: string })`
|
|
117
|
+
Saves the design as a template and returns metadata (e.g., `templateId`).
|
|
114
118
|
|
|
115
119
|
#### `importHTML(data: { html: string })`
|
|
116
|
-
|
|
120
|
+
Experimental: Attempts to parse HTML into editor blocks.
|
|
121
|
+
|
|
122
|
+
#### `setTheme(theme: 'light' | 'dark')`
|
|
123
|
+
Switch themes dynamically at runtime.
|
|
117
124
|
|
|
118
125
|
---
|
|
119
126
|
|
|
120
127
|
## Advanced Features
|
|
121
128
|
|
|
122
129
|
### White Labeling (`branding`)
|
|
123
|
-
Customize the editor appearance
|
|
124
|
-
- `primaryColor`:
|
|
125
|
-
- `
|
|
126
|
-
- `
|
|
127
|
-
- `
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
Customize the editor appearance:
|
|
131
|
+
- `primaryColor`: Main button and active state color.
|
|
132
|
+
- `secondaryColor`: Secondary button and sidebar accents.
|
|
133
|
+
- `accentColor`: Highlight colors for focus states.
|
|
134
|
+
- `logoUrl`: Link to your company logo.
|
|
135
|
+
- `customCSS`: Inject global CSS overrides.
|
|
136
|
+
|
|
137
|
+
### Permissions
|
|
138
|
+
Control what your users can do:
|
|
131
139
|
```javascript
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
140
|
+
permissions: {
|
|
141
|
+
exportHTML: true,
|
|
142
|
+
aiMagic: true,
|
|
143
|
+
uploadImages: false // Users can only use stock images or URLs
|
|
144
|
+
}
|
|
136
145
|
```
|
|
137
146
|
|
|
138
147
|
---
|
|
139
148
|
|
|
140
149
|
## License
|
|
141
|
-
MIT © [
|
|
150
|
+
MIT © [Babber Maven](https://github.com/babbermaven)
|