esender-email-editor 1.1.2 → 1.3.0
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 -37
- package/dist/index.cjs +6 -7
- package/dist/index.d.ts +50 -2
- package/dist/index.js +6 -7
- package/dist/styles.css +1 -1
- package/package.json +2 -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,9 @@ 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.
|
|
166
|
-
|
|
167
|
-
You can safely nest `<Package />` inside a host app that already uses antd with a different theme.
|
|
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.
|
|
168
165
|
|
|
169
166
|
## License handshake
|
|
170
167
|
|
|
@@ -266,6 +263,12 @@ import Package, {
|
|
|
266
263
|
type SaveEvent,
|
|
267
264
|
type LoadEvent,
|
|
268
265
|
type MediaUploadEvent,
|
|
266
|
+
// convenience aliases
|
|
267
|
+
type EditorInstance, // = EditorHandle
|
|
268
|
+
type TemplateData, // = TemplateDocument
|
|
269
|
+
type TemplateJson, // shape of getJson()/loadJson() payload
|
|
270
|
+
type SaveTemplatePayload, // = SaveTemplateOptions
|
|
271
|
+
type LoadTemplatePayload, // = LoadTemplateOptions
|
|
269
272
|
} from 'esender-email-editor';
|
|
270
273
|
```
|
|
271
274
|
|
|
@@ -282,36 +285,6 @@ import Package, {
|
|
|
282
285
|
| `You cannot render a <Router> inside another <Router>` | You're on an outdated version. Update — current package uses `MemoryRouter` internally. |
|
|
283
286
|
| Renders during SSR throw | Mount the component client-side only (see Next.js example above). |
|
|
284
287
|
|
|
285
|
-
## Publishing (maintainers)
|
|
286
|
-
|
|
287
|
-
```bash
|
|
288
|
-
# 1. Bump version (semver)
|
|
289
|
-
npm version patch # or minor / major
|
|
290
|
-
|
|
291
|
-
# 2. prepublishOnly chains: check-secrets → typecheck → rollup (clean + bundle + obfuscate + bundle check)
|
|
292
|
-
npm publish
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
Pre-publish hooks:
|
|
296
|
-
- `check-secrets` — scans for forbidden files (`.env`, `.pem`, `.key`) and provider-prefixed key strings (AWS / OpenAI / SendGrid / Google / GitHub / Slack / private-key blocks).
|
|
297
|
-
- `typecheck` — `tsc --noEmit`.
|
|
298
|
-
- `rollup` — produces `dist/index.js`, `dist/index.cjs`, `dist/index.d.ts`, `dist/styles.css`, then runs `scripts/obfuscate.js` and `scripts/check-bundle.js`.
|
|
299
|
-
|
|
300
|
-
Inspect the publish tarball before pushing:
|
|
301
|
-
|
|
302
|
-
```bash
|
|
303
|
-
npm pack --dry-run
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
Only the contents of `dist/`, `README.md`, `LICENSE`, and `package.json` ship.
|
|
307
|
-
|
|
308
|
-
## Versioning
|
|
309
|
-
|
|
310
|
-
Strict semver:
|
|
311
|
-
- **PATCH** — bug fixes, no API changes.
|
|
312
|
-
- **MINOR** — additive features, no breakage.
|
|
313
|
-
- **MAJOR** — breaking changes to `<Package />` props or `EditorHandle`.
|
|
314
|
-
|
|
315
288
|
## Author
|
|
316
289
|
|
|
317
290
|
bitbeast private limited
|