hivewrite-sdk 1.2.3 → 1.2.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 +54 -0
- package/bundle.min.js +1 -1
- package/index.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,6 +127,38 @@ Initializes and mounts the editor.
|
|
|
127
127
|
| `warnings` | `object` | No | Optional warning settings. `{ placeholderImages: false }` disables the placeholder-image confirmation on manual save (defaults to `true`). |
|
|
128
128
|
| `callbacks` | `object` | No | Event hooks for SDK actions |
|
|
129
129
|
|
|
130
|
+
### Editor Modes
|
|
131
|
+
|
|
132
|
+
The `mode` option controls what the person using the editor can see and do. Features that are switched off for your account stay hidden in every mode.
|
|
133
|
+
|
|
134
|
+
| Mode | Who it is for | What the user gets |
|
|
135
|
+
| :------------ | :------------ | :----------------- |
|
|
136
|
+
| `FULL_EDITOR` | Developers and power users | Everything: visual editing, templates, AI, save, **Export** (HTML/MJML), **Import HTML**, the **Custom HTML** block and its code editor, and downloading saved sections. |
|
|
137
|
+
| `DESIGN_ONLY` | Marketers and non-technical users | Visual design only. No code goes in or out through the editor UI. See below. |
|
|
138
|
+
| `READ_ONLY` | Reviewers and approvers | A preview of the email. No toolbar, no sidebar and no top-bar actions. |
|
|
139
|
+
|
|
140
|
+
#### What `DESIGN_ONLY` users see
|
|
141
|
+
|
|
142
|
+
**Available**
|
|
143
|
+
|
|
144
|
+
- Drag and drop, add, move, duplicate and delete blocks (all block types except Custom HTML)
|
|
145
|
+
- All style, layout, canvas and branding settings in the sidebar
|
|
146
|
+
- Templates gallery, AI Magic and AI Chat
|
|
147
|
+
- Desktop/mobile view and preview
|
|
148
|
+
- Undo/redo, merge tags, image uploads and the file manager
|
|
149
|
+
- Saving, inserting, duplicating, renaming and deleting saved sections
|
|
150
|
+
- **Save** (calls `onSave` as usual; `context.html` still contains the final HTML for your backend)
|
|
151
|
+
|
|
152
|
+
**Hidden**
|
|
153
|
+
|
|
154
|
+
- **Export** button and the HTML/MJML export dialog
|
|
155
|
+
- **Import HTML** button
|
|
156
|
+
- **Custom HTML** in the add-block menu
|
|
157
|
+
- The code editor for existing HTML blocks, e.g. from a template or a loaded design. The block still renders and can be styled, moved or deleted. The sidebar shows a short note instead of the code.
|
|
158
|
+
- **Download** on saved sections (the file contains the section's HTML)
|
|
159
|
+
|
|
160
|
+
Your own code can still call `hivewrite.export()`, `exportHtml()`, `exportMjml()` and `exportJson()` in `DESIGN_ONLY` mode. Only the editor UI is restricted, so your app can still produce the HTML it sends.
|
|
161
|
+
|
|
130
162
|
---
|
|
131
163
|
|
|
132
164
|
## 🧱 Available Block Types
|
|
@@ -599,10 +631,32 @@ Exported HTML is fully compatible with:
|
|
|
599
631
|
| `setTemplateId(id, version?)` | Store the backend template id/version for the next save |
|
|
600
632
|
| `getTemplateId()` | Get the currently stored template id |
|
|
601
633
|
| `getTemplateVersion()` | Get the currently stored template version |
|
|
634
|
+
| `setLocked(locked, message?)` | Lock the editor while another session is editing the template (see below) |
|
|
635
|
+
| `isLocked()` | Whether the editor is currently locked |
|
|
636
|
+
| `isDesignDirty()` | Whether there are unsaved changes (tracked when `autosave` is on) |
|
|
602
637
|
| `setTheme(theme)` | Switch theme at runtime |
|
|
603
638
|
| `setLocale(locale)` | Switch locale at runtime |
|
|
604
639
|
| `destroy()` | Unmount and cleanup |
|
|
605
640
|
|
|
641
|
+
### Locking a template (concurrent editing)
|
|
642
|
+
|
|
643
|
+
When the same template is open in two places, lock the editor in the session that does not hold the edit lock:
|
|
644
|
+
|
|
645
|
+
```javascript
|
|
646
|
+
hivewrite.setLocked(true, "This template is being edited in another session.");
|
|
647
|
+
// later, when this session gets the lock back
|
|
648
|
+
hivewrite.setLocked(false);
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
While locked, the editor behaves exactly like `READ_ONLY` mode:
|
|
652
|
+
|
|
653
|
+
- The email is shown as a preview: blocks cannot be clicked, selected, typed into, dragged, added or deleted.
|
|
654
|
+
- The toolbar, sidebar and top-bar actions (including Save) are hidden, and open dialogs and pages (templates, AI, file manager, saved sections) close.
|
|
655
|
+
- Edits, undo/redo and late AI or template results are refused. `hivewrite.save()` returns `{ success: false }` with the lock message.
|
|
656
|
+
- `loadDesign()` still works, so you can show the other session's latest version.
|
|
657
|
+
|
|
658
|
+
`setLocked(false)` returns to the mode the editor was started in. Call `setLocked` from `onLoad` with the initial lock state, then whenever the lock changes.
|
|
659
|
+
|
|
606
660
|
---
|
|
607
661
|
|
|
608
662
|
## 📄 License
|