esender-email-editor 1.1.2 → 1.2.1
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 +11 -6
- package/dist/index.cjs +6 -6
- package/dist/index.d.ts +50 -2
- package/dist/index.js +6 -6
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -134,7 +134,8 @@ export const Composer = () => {
|
|
|
134
134
|
|---|---|---|
|
|
135
135
|
| `getJson()` | `string` | Stringified MJML JSON tree (export-ready). |
|
|
136
136
|
| `getHtml()` | `string` | Compiled email HTML via `mjml-browser`. Triggers `onHtmlExport`. |
|
|
137
|
-
| `loadJson(json, raw?)` | `void` | Load a previously saved template. `json`
|
|
137
|
+
| `loadJson(json, raw?)` | `void` | Load a previously saved template. `json` accepts either the stringified output of `getJson()` or a deserialized object. Pass `null` to clear the canvas. |
|
|
138
|
+
| `loadHtml(html)` | `void` | Load raw HTML into the editor. The HTML is wrapped in an MJML `mj-raw` block and rendered verbatim. The editor cannot break arbitrary HTML back into editable blocks — for full editability, prefer `loadJson` with a previously saved template. |
|
|
138
139
|
| `saveTemplate({ projectId, templateId? })` | `Promise<TemplateApiResponse>` | Create or update a template. Omit `templateId` to create; include it to update. POSTs to `https://esender.in/api/license/template/create`. |
|
|
139
140
|
| `loadTemplate({ projectId, templateId? })` | `Promise<TemplateApiResponse>` | GET from `https://esender.in/api/license/template/:projectId[/:templateId]` and pipe the JSON back into `loadJson(...)`. |
|
|
140
141
|
|
|
@@ -158,13 +159,11 @@ Callbacks are stored internally in a ref, so inline arrow functions are safe —
|
|
|
158
159
|
|
|
159
160
|
## Theme isolation
|
|
160
161
|
|
|
161
|
-
The editor
|
|
162
|
+
The editor does **not** mount its own `<ConfigProvider>` or antd `<App />`. It inherits the host application's antd theme, locale, and static-method context — nothing the editor renders will override your colors, components, or token configuration.
|
|
162
163
|
|
|
163
|
-
-
|
|
164
|
-
- Your host app's `<ConfigProvider theme={…}>` will **not** restyle the editor.
|
|
165
|
-
- Antd's `message` / `notification` / `Modal.useApp` are scoped via `<App />` inside the editor.
|
|
164
|
+
All editor-specific CSS lives under a single `.aee-root` class scope (the wrapper div around the editor), so SCSS overrides and resets cannot reach host components either.
|
|
166
165
|
|
|
167
|
-
|
|
166
|
+
If you want the editor branded purple like the default screenshots, wrap your host app in your own `<ConfigProvider theme={{ token: { colorPrimary: '#7747ff' } }}>` — the editor will inherit it.
|
|
168
167
|
|
|
169
168
|
## License handshake
|
|
170
169
|
|
|
@@ -266,6 +265,12 @@ import Package, {
|
|
|
266
265
|
type SaveEvent,
|
|
267
266
|
type LoadEvent,
|
|
268
267
|
type MediaUploadEvent,
|
|
268
|
+
// convenience aliases
|
|
269
|
+
type EditorInstance, // = EditorHandle
|
|
270
|
+
type TemplateData, // = TemplateDocument
|
|
271
|
+
type TemplateJson, // shape of getJson()/loadJson() payload
|
|
272
|
+
type SaveTemplatePayload, // = SaveTemplateOptions
|
|
273
|
+
type LoadTemplatePayload, // = LoadTemplateOptions
|
|
269
274
|
} from 'esender-email-editor';
|
|
270
275
|
```
|
|
271
276
|
|